Compare commits

...
67 Commits
Author SHA1 Message Date
8255d7aed3 Forge 1.19.3
Created a CreativeModeTabEvent to register creative mode tabs and populate entries per tab
Moved datapack registries to DataPackRegistryEvent.NewRegistry event instead of tying them to ForgeRegistry
Made it easier for mods to datagen datapack builtin entries with DatapackBuiltinEntriesProvider
Provided access to lookupProvider for datagen
Updated dependencies to match versions used by vanilla and update JarJar to 0.3.18
Added a test mod for the new CreativeModeTabEvent
Throws better error message for Forge registries in tag datagen
Deleted ForgeRegistryTagsProvider
Updated ClientChatReceivedEvent and ServerChatEvent for Mojang changes
Added patches for both sign related methods in ModelLayers
Changed RegisterShadersEvent to use ResourceProvider
Migrated old Mojang math types to JOML

Co-authored-by: Marc Hermans <[email protected]>
Co-authored-by: LexManos <[email protected]>
Co-authored-by: sciwhiz12 <[email protected]>
Co-authored-by: coehlrich <[email protected]>
2022-12-08 01:45:22 -06:00
LexManos 617ecb7ad3 43.2 Recommended Build. 2022-12-07 23:20:28 -08:00
Su5eD dd8239c255 Allow discovering services from the mods folder that use java's modular definition. (#9143) 2022-11-30 14:50:30 -08:00
Brennan Ward bdddc8c5d4 Make Datapack Registries support ICondition(s) (#9113) 2022-11-30 14:45:00 -08:00
Marc Hermans c1c619a109 Enable additional build types to handle pull request validation. (#9159) 2022-11-30 14:08:05 -08:00
sciwhiz12 f7eea35cb9 Check source permission level before selector permission (#9147)
In some situations, such as execution of a function by an advancement as
part of its reward, a command source stack may have a backing source of
a ServerPlayer which may lack the entity selector permission and have an
explicit permission level that should allow the use of entity selectors,
through CommandSourceStack#withPermission.

We now check if the permission level of the command source stack is
sufficient for entity selectors _before_ checking if the source is a
player and if they have the requisite permission.

This means that an operator permission level of 2 will always override
the Forge entity selector permission.

Fixes #9137
2022-11-30 14:07:18 -08:00
J.T. McQuigg a2434e1607 Fix fires spreading too/igniting custom portal frames. (#9142) 2022-11-30 14:06:22 -08:00
Minecraftschurli b806ecd0ff Add supplier to FlowerBlock so it works with custom MobEffects (#9139) 2022-11-30 14:04:15 -08:00
KnightMiner 8358b800e9 Fix some logical bugs related to the Grindstone Event (#9089) 2022-11-30 14:00:59 -08:00
Néstor Amador b25a092cf1 Call baked model's getModelData before getRenderTypes (#9163) 2022-11-28 17:53:19 +01:00
Jonathan Coates d812fdd0a3 Make Util.memoize thread-safe (#9155) 2022-11-23 09:18:04 +01:00
Néstor Amador 2d3ee8a228 Rendering tweaks and fixes: Part 4 (#9065) 2022-11-23 09:17:43 +01:00
matyrobbrt 97a9ca65f1 Fix Transformation loading PoseStack (#9083) 2022-11-21 20:49:41 +01:00
Néstor Amador f043fbbc51 Add simple block appearance API (#9066) 2022-11-21 20:48:30 +01:00
SizableShrimp a19ab3a8d4 Fix invalidated modded packets when on LAN (#9157) 2022-11-20 18:34:21 -08:00
Dennis C bc0517a404 Improve extensibility of DetectorRailBlock and PoweredRailBlock (#9130) 2022-11-08 12:18:48 -08:00
Su5eD dc9c0d7e35 Fix launch handler minecraft classpath locator (#9120) 2022-11-08 12:17:48 -08:00
matyrobbrt 1a2207b3b2 Add HitResult to EntityTeleportEvent$EnderPearl (#9135) 2022-11-08 12:17:18 -08:00
sciwhiz12 84ab9764e3 Throw aggregate exception for erroneous registry event dispatch (#9111)
This means that exceptions occurring during the dispatch of the registry
events, such as those from the suppliers of RegistryObjects, properly
cause a crash rather than merely being logged and allowing the game to
reach the main menu.

Fixes #8720
2022-11-08 12:17:00 -08:00
Nexus-Dino bef68991f0 Add missing semi-colon near the Dist import statement in example mod. 2022-11-08 12:16:49 -08:00
Nexus-Dino 526c13d662 Fix ClientModEvents example not subscribing to client-sided events (#9097) 2022-10-21 13:22:57 -07:00
matyrobbrt 67ffb78c23 Use GitHub action to lock issues with the spam label (#9087) 2022-10-21 13:22:31 -07:00
sciwhiz12 8f407c3a22 Remove structures slave map to Feature registry (#9091) 2022-10-21 13:22:18 -07:00
Dennis C 8980252e16 Improve logging of missing or unsupported dependencies (#9104) 2022-10-21 13:21:49 -07:00
DBotThePony 3baee80485 [1.19.x] Fix ValueSpec caching the return value incorrectly (#9046) 2022-10-14 17:43:21 +01:00
eerussianguy ca9599bb4d [1.19.x] Add event for registering spawn placements, and modifying existing (#9024) 2022-10-14 17:39:14 +01:00
eerussianguy 051db7907a [1.19.x] Add event for items being stacked or swapped in a GUI. (#9050) 2022-10-14 17:30:12 +01:00
Magnus Jensen bdba5ef2d3 [1.19.x] Fix PlayerInteractEvent.EntityInteractSpecific not cancelling on a server (#9079) 2022-10-14 17:18:17 +01:00
DBotThePony 838b9c0eda Fix canceling phantom spawns preventing any further attempts that tick. (#9041) 2022-10-13 11:40:56 -07:00
Magnus Jensen be584c54aa Rename fluid type milk translation keys (#9077) 2022-10-12 12:54:34 -07:00
ChampionAsh5357 1b3640b42d Fix minecart speed with water (#9076) 2022-10-12 12:51:13 -07:00
Sara Freimer be5dab5801 Add a cancellable event that gets fired when a Totem of Undying is used (#9069) 2022-10-12 12:46:08 -07:00
Marc Hermans aae628cd18 Fix performance issue and logging when resource caching is enabled (#9029) 2022-10-12 12:00:25 -07:00
Magnus Jensen e7bd08649f Fix NPE when feeding wolves and cats (#9074) 2022-10-07 19:55:40 -07:00
Paint_Ninja e1017a4c7e Fix logically breaking change to ForgeConfigSpec.Builder#comment where modders could not add a empty line to the start of comments. (#9061) 2022-10-03 11:50:32 -07:00
SizableShrimp 6f8ba9d295 Fix ServiceLoader bug
Signed-off-by: SizableShrimp <[email protected]>
2022-09-29 22:11:12 -07:00
SizableShrimp ac94478ae7 Fix ClientChatReceivedEvent for system messages
Signed-off-by: SizableShrimp <[email protected]>
2022-09-29 22:11:12 -07:00
DBotThePony 515c6082e0 Make ForgeConfigSpec$Builder.comment able to be called multiple times for the same entry. (#9056) 2022-09-27 23:23:59 -07:00
ChampionAsh5357 a753598113 Fix control modifier for mac with KeyMappings using Alt instead of Super (#9057) 2022-09-27 11:15:11 -07:00
J.T. McQuigg bc6c4be4e4 Fix is_desert tag not being applied correctly. (#9051) 2022-09-26 11:08:24 -07:00
Andy Dingley 98823a8f07 Fix mob griefing event for SmallFireballs not using owner entity. (#9038) 2022-09-21 13:24:25 -07:00
David Dempsey ecd8f1e54d Fix minecarts on rails not properly slowing down in water (#9033) 2022-09-21 13:20:03 -07:00
LexManos b0caea8e20 Change codestyle for BookShelves tag. Closes #9027
Add IS_CAVE tag Closes #8885
Add IS_DESERT tag Closes #8979
Simplify Mangrove Swamp tags Closes #8980
2022-09-09 11:27:39 -07:00
nikita488 e0477f8776 Allow faces of an "elements" model to have disabled ambient occlusion (#9019) 2022-09-08 16:17:44 +01:00
bconlon 94e1e54b53 [1.19.x] Recipe ID-based grouping between modded and vanilla recipes. (#8876) 2022-09-08 16:13:07 +01:00
nitro_dynamite18 9ce72331b7 Update fence_gates/wooden (#8936) 2022-09-08 16:12:26 +01:00
Jais Djurhuus-Kempel 1c31f42dae [1.19.x] Added event for growing fungus (#8981) 2022-09-08 16:11:59 +01:00
agnor99 0978a94358 Added Bookshelves block tag (#8991) 2022-09-08 16:11:39 +01:00
GizmoTheMoonPig e956a9c9f3 Create a Forge EntityType Tag for Bosses (#9017) 2022-09-08 16:10:48 +01:00
Monica S 82026d11a4 Allow mods to specify shader import namespace (#9021) 2022-09-08 16:10:31 +01:00
ferriarnus 6d233ac75c Grindstone Events (#8934)
One to modify the output, and one to modify the input.
2022-09-08 15:55:43 +01:00
Reece Mackie 73c1934e7e Fix the serialized names of the enum (#9014) 2022-09-04 19:46:54 +01:00
Technici4n bf1194ec75 Fix tryEmptyContainerAndStow duping fluids with stackable containers (#9004) 2022-09-03 21:48:07 +01:00
Ted Senft 22d2740725 Add mod mismatch event (#8989) 2022-09-03 21:26:43 +01:00
Minecraftschurli 02f26dc7a1 [1.19.x] add methods with more context to tree growers (#8956) 2022-09-03 20:24:00 +01:00
28Pollux28 db14cbb0e0 [1.19.X] Adding more precise events for Advancements (#8360) 2022-09-03 20:17:16 +01:00
Luke BemishandLexManos a2b35cae92 Default IItemHandler capability for shulker box itemstacks (#8827)
Co-authored-by: LexManos <[email protected]>
2022-09-03 20:16:25 +01:00
Take Weiland aab0e4c82e [1.19] Add hook for items to remain in the hotbar when picking blocks/entities (#8872) 2022-09-03 20:12:13 +01:00
Reece Mackieandsciwhiz12 6609708d14 [1.19.x] Block Model Builder Root Transform Support (#8860)
Co-authored-by: sciwhiz12 <[email protected]>
2022-09-03 20:11:46 +01:00
Budschie ed198f062c [1.19.x] Make LivingSetAttackTargetEvent compatible with the Brain/Behavior system. (Port of PR #8918) (#8954) 2022-09-03 20:11:10 +01:00
thedarkcolour 4e2d656e9d [1.19.x] Add IForgeBlock#onTreeGrow to replace IForgeBlock#onPlantGrow from 1.16 (#8999) 2022-09-03 20:07:09 +01:00
bconlon 2a4230868f [1.19.x] Moved Player.resetAttackStrengthTicker() to the end of Player.attack() (#9000) 2022-09-03 20:06:35 +01:00
Sirttas cf778b1759 fix misplaced patch in sapling block (#9005) 2022-09-03 20:05:37 +01:00
Brennan Ward 1b6daddd40 Fix failed entity interactions consuming the click. (#9007) 2022-09-03 20:00:57 +01:00
sciwhiz12 d7b137d144 Fix entity selector permission check to check original source (#8995)
Permission checks should be against the command source and not the
target entity, as is done in vanilla.

Fixes #8994
2022-08-25 11:42:11 -07:00
한현빈 b5d5855559 Hotfix for 1.19.2 item animation bug (#8987)
* [HOT FIX]: Fixes #8985 by no-oping for vanilla models instead of throwing error

Signed-off-by: tmvkrpxl0 <[email protected]>
2022-08-20 11:38:24 +02:00
LexManos c0aa8dd808 Add ability to Auto register capabilities via annotation (#8972) 2022-08-17 15:06:35 -07:00
850 changed files with 12124 additions and 7006 deletions

No files matched your search

+42
View File
@@ -0,0 +1,42 @@
name: 'Spam label'
on:
issues:
types: [labeled]
pull_request:
types: [labeled]
discussion:
types: [labeled]
permissions:
contents: read
issues: write
pull-requests: write
discussions: write
jobs:
lock:
if: ${{ (github.event.label.name == 'spam') && (github.event.action == 'labeled') }}
runs-on: ubuntu-latest
steps:
- uses: peter-evans/close-issue@v2
name: Close Issue
with:
close-reason: 'not_planned'
if: ${{ github.event_name != 'pull_request' }}
- run: gh pr close ${{ github.event.pull_request.html_url }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
name: Close PR
if: ${{ github.event_name == 'pull_request' }}
- uses: maxkomarychev/[email protected]
name: Lock PR
if: ${{ github.event_name == 'pull_request' }}
with:
token: "${{ secrets.GITHUB_TOKEN }}"
issue_number: ${{ github.event.number }}
- uses: OSDKDev/[email protected]
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
name: Lock issue
if: ${{ github.event_name != 'pull_request' }}
+74 -2
View File
@@ -1,5 +1,7 @@
import jetbrains.buildServer.configs.kotlin.v2019_2.*
import jetbrains.buildServer.configs.kotlin.v2019_2.projectFeatures.githubIssues
import jetbrains.buildServer.configs.kotlin.*
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.gradle
/*
The settings script is an entry point for defining a TeamCity
@@ -30,11 +32,13 @@ project {
buildType(Build)
buildType(BuildSecondaryBranches)
buildType(PullRequests)
buildType(PullRequestChecks)
buildType(PullRequestCompatibility)
params {
text("docker_jdk_version", "17", 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", "7.4", 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.18.x", label = "Git Main Branch", description = "The git main or default branch to use in VCS operations.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
text("docker_gradle_version", "7.5.1", 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.19.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*)
@@ -134,3 +138,71 @@ object PullRequests : BuildType({
""".trimIndent()
}
})
object PullRequestChecks : BuildType({
templates(AbsoluteId("MinecraftForge_BuildPullRequests"), AbsoluteId("MinecraftForge_SetupGradleUtilsCiEnvironmen"), AbsoluteId("MinecraftForge_BuildWithDiscordNotifications"), AbsoluteId("MinecraftForge_SetupProjectUsingGradle"))
id("MinecraftForge_MinecraftForge__PullRequestChecks")
name = "Pull Requests (Checks)"
description = "Checks pull requests for the project"
steps {
gradle {
name = "Check"
id = "RUNNER_10_Check"
tasks = "checkAll"
gradleParams = "--continue %gradle_custom_args%"
enableStacktrace = true
dockerImage = "%docker_gradle_image%"
dockerRunParameters = """
-v "/opt/cache/agent/gradle:/home/gradle/.gradle"
-v "/opt/cache/shared/gradle:/home/gradle/rocache:ro"
--network=host
-u 1000:1000
%docker_additional_args%
""".trimIndent()
}
}
vcs {
branchFilter = """
+:*
-:1.*
-:<default>
""".trimIndent()
}
})
object PullRequestCompatibility : BuildType({
templates(AbsoluteId("MinecraftForge_BuildPullRequests"), AbsoluteId("MinecraftForge_SetupGradleUtilsCiEnvironmen"), AbsoluteId("MinecraftForge_BuildWithDiscordNotifications"), AbsoluteId("MinecraftForge_SetupProjectUsingGradle"))
id("MinecraftForge_MinecraftForge__PullRequestCompatibility")
name = "Pull Requests (Compatibility)"
description = "Validates binary compatibility for pull requests made to the project"
steps {
gradle {
name = "Validate"
id = "RUNNER_10_Compatibility"
tasks = "checkJarCompatibility"
gradleParams = "--continue %gradle_custom_args%"
enableStacktrace = true
dockerImage = "%docker_gradle_image%"
dockerRunParameters = """
-v "/opt/cache/agent/gradle:/home/gradle/.gradle"
-v "/opt/cache/shared/gradle:/home/gradle/rocache:ro"
--network=host
-u 1000:1000
%docker_additional_args%
""".trimIndent()
}
}
vcs {
branchFilter = """
+:*
-:1.*
-:<default>
""".trimIndent()
}
})
+38 -46
View File
@@ -19,7 +19,7 @@ plugins {
id 'com.github.ben-manes.versions' version '0.36.0'
id 'net.minecraftforge.gradleutils' version '2.+'
id 'eclipse'
id 'de.undercouch.download' version '4.1.2'
id 'de.undercouch.download' version '5.1.3'
id 'net.minecraftforge.gradle.patcher' version '[5.1.50,5.2.0)' apply false
id 'net.minecraftforge.gradle.mcp' version '[5.1.50,5.2.0)' apply false
}
@@ -36,10 +36,10 @@ ext {
]
}
MAPPING_CHANNEL = 'official'
MAPPING_VERSION = '1.19.2'
MC_VERSION = '1.19.2'
MAPPING_VERSION = '1.19.3'
MC_VERSION = '1.19.3'
MC_NEXT_VERSION = '1.20'
MCP_VERSION = '20220805.130853'
MCP_VERSION = '20221207.122022'
SPI_VERSION = '6.0.0'
ACCESSTRANSFORMERS_VERSION = '8.0.4'
COREMODS_VERSION = '5.0.1'
@@ -56,17 +56,17 @@ ext {
JETBRAINS_ANNOTATIONS_VERSION = '23.0.0'
SLF4J_API_VERSION = '1.8.0-beta4'
APACHE_MAVEN_ARTIFACT_VERSION = '3.8.5'
JARJAR_VERSION = '0.3.18'
// These versions should be kept in sync with the version manifest JSON
// To use a version newer than the version manifest JSON, the dependency must be added to the installer configuration
MOJANG_LOGGING_VERSION = '1.0.0'
LOG4J_VERSION = '2.17.0'
GUAVA_VERSION = '31.0.1-jre'
GSON_VERSION = '2.8.9'
MOJANG_LOGGING_VERSION = '1.1.1'
LOG4J_VERSION = '2.19.0'
GUAVA_VERSION = '31.1-jre'
GSON_VERSION = '2.10'
APACHE_COMMONS_LANG3_VERSION = '3.12.0'
JOPT_SIMPLE_VERSION = '5.0.4'
COMMONS_IO_VERSION = '2.11.0'
JARJAR_VERSION = '0.3.16'
GIT_INFO = gradleutils.gitInfo
VERSION = gradleutils.getFilteredMCTagOffsetBranchVersion(true, '[0-9]', MC_VERSION)
@@ -77,7 +77,7 @@ ext {
INSTALLER_TOOLS = 'net.minecraftforge:installertools:1.3.0'
JAR_SPLITTER = 'net.minecraftforge:jarsplitter:1.1.4'
FART = 'net.minecraftforge:ForgeAutoRenamingTool:0.1.22:all'
MIN_TAG_FOR_CHANGELOG = "41.0"
MIN_TAG_FOR_CHANGELOG = '41.0'
}
println('Version: ' + VERSION +
@@ -1184,8 +1184,6 @@ project(':forge') {
excs.from patcher.excs
}
task checkAll(dependsOn: [checkATs, checkSAS, checkExcs, findFieldInstanceChecks]){}
task checkPatchesAndFix(type: CheckPatches, dependsOn: genPatches) {
patchDir = file("$rootDir/patches")
autoFix = true
@@ -1202,57 +1200,51 @@ project(':forge') {
lineEnding = '\n'
}
def baseForgeVersion = System.getProperty("forge.compatibility_check_version")
if (baseForgeVersion == null)
baseForgeVersion = "${MC_VERSION}-${GIT_INFO.tag}.0"
if (baseForgeVersion == "null")
baseForgeVersion = null // Allow disabling from system property if not wanted
def baseForgeUniversal = null
if (baseForgeVersion != null)
baseForgeUniversal = project.dependencies.create("net.minecraftforge:forge:${baseForgeVersion}:universal")
def baseForgeVersionProperty = project.objects.property(String)
baseForgeVersionProperty.set(project.provider { getLatestForgeVersion(MC_VERSION) }.map { MC_VERSION + '-' + it })
baseForgeVersionProperty.finalizeValueOnRead()
def jarCompatibilityTaskSetup = { task ->
task.group = 'jar compatibility'
task.onlyIf {
baseForgeVersion != null
baseForgeVersionProperty.getOrNull() != null
}
task.inputs.property 'baseForgeVersion', baseForgeVersion
}
task downloadBaseCompatibilityBinPatches(type: DownloadBaseCompatibilityBinPatches) {
inputVersion = baseForgeVersion
tasks.register('setupCheckJarCompatibility', SetupCheckJarCompatibility) {
inputVersion = baseForgeVersionProperty
}
task applyBaseCompatibilityJarBinPatches(type: ApplyBinPatches) {
tasks.register('applyBaseCompatibilityJarBinPatches', ApplyBinPatches) {
jarCompatibilityTaskSetup(it)
clean = createJoinedSRG.output
patch = downloadBaseCompatibilityBinPatches.output
clean = project.tasks.createJoinedSRG.output
patch = project.tasks.named('setupCheckJarCompatibility').flatMap { it.baseBinPatchesOutput }
output = project.layout.buildDirectory.dir(name).map { it.file('output.jar') }
}
task checkJarCompatibility(type: CheckJarCompatibility) {
tasks.register('mergeBaseForgeJar', MergeJars) {
jarCompatibilityTaskSetup(it)
if (baseForgeVersion != null) {
def fmlLibs = project.configurations.detachedConfiguration(PACKED_DEPS.collect {
def artifactId = it.split(':')[1]
return project.dependencies.create("net.minecraftforge:${artifactId}:${baseForgeVersion}")
}.toArray(Dependency[]::new))
baseJar = project.tasks.applyBaseCompatibilityJarBinPatches.output
baseLibraries.from(project.configurations.detachedConfiguration(baseForgeUniversal))
baseLibraries.from(project.tasks.createJoinedSRG.output)
baseLibraries.from(fmlLibs)
inputJar = project.tasks.reobfJar.output
concreteLibraries.from(PACKED_DEPS.collect { rootProject.tasks.getByPath(it).archiveFile })
commonLibraries.from(project.configurations.minecraftImplementation)
commonLibraries.from(project.configurations.installer)
commonLibraries.from(project.configurations.moduleonly)
}
inputJars.from(project.tasks.named('applyBaseCompatibilityJarBinPatches').flatMap { it.output })
inputJars.from(baseForgeVersionProperty.map { inputVersion ->
def output = project.layout.buildDirectory.dir(name).map { it.file("forge-${inputVersion}-universal.jar") }.get().asFile
project.rootProject.extensions.download.run {
src "https://maven.minecraftforge.net/net/minecraftforge/forge/${inputVersion}/forge-${inputVersion}-universal.jar"
dest output
}
return output
})
}
tasks.register('checkJarCompatibility', CheckJarCompatibility) {
jarCompatibilityTaskSetup(it)
dependsOn 'setupCheckJarCompatibility'
baseJar = project.tasks.named('mergeBaseForgeJar').flatMap { it.output }
}
task checkAll(dependsOn: [checkATs, checkSAS, checkExcs, findFieldInstanceChecks, checkPatches, checkLicenses]){}
task launcherJson(type: LauncherJson) {
packedDependencies = [':fmlloader:jar']
doFirst {
+1
View File
@@ -7,4 +7,5 @@ dependencies {
implementation 'org.ow2.asm:asm:9.3'
implementation 'org.ow2.asm:asm-tree:9.3'
implementation 'net.minecraftforge:srgutils:0.4.+'
implementation 'commons-io:commons-io:2.8.0'
}
@@ -1,39 +0,0 @@
package net.minecraftforge.forge.tasks
import org.gradle.api.DefaultTask
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.provider.Property
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.Optional
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.TaskAction
import java.nio.file.Files
abstract class DownloadBaseCompatibilityBinPatches extends DefaultTask {
DownloadBaseCompatibilityBinPatches() {
group = 'jar compatibility'
onlyIf {
inputVersion.getOrNull() != null
}
output.convention(project.layout.buildDirectory.dir(name).map { it.file('joined.lzma') })
}
@TaskAction
void run() {
def dep = project.dependencies.create("net.minecraftforge:forge:${inputVersion.get()}:userdev")
def baseForgeUserdev = project.configurations.detachedConfiguration(dep).resolve().iterator().next()
def joinedLzma = project.zipTree(baseForgeUserdev).matching { it.include('joined.lzma') }.singleFile
Files.copy(joinedLzma.toPath(), output.get().asFile.toPath())
}
@Input
@Optional
abstract Property<String> getInputVersion()
@OutputFile
abstract RegularFileProperty getOutput()
}
@@ -0,0 +1,44 @@
package net.minecraftforge.forge.tasks
import org.apache.commons.io.IOUtils
import org.gradle.api.DefaultTask
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.tasks.InputFiles
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.TaskAction
import java.util.zip.ZipEntry
import java.util.zip.ZipInputStream
import java.util.zip.ZipOutputStream
abstract class MergeJars extends DefaultTask {
MergeJars() {
output.convention(project.layout.buildDirectory.dir(name).map { it.file('output.jar') })
}
@TaskAction
void run() {
def jars = inputJars.files
try (ZipOutputStream zout = new ZipOutputStream(new FileOutputStream(output.get().asFile))) {
for (def jar : jars) {
try (ZipInputStream zin = new ZipInputStream(new FileInputStream(jar))) {
def entry
while ((entry = zin.getNextEntry()) != null) {
ZipEntry _new = new ZipEntry(entry.getName())
_new.setTime(0) //SHOULD be the same time as the main entry, but NOOOO _new.setTime(entry.getTime()) throws DateTimeException, so you get 0, screw you!
zout.putNextEntry(_new)
IOUtils.copy(zin, zout)
}
}
}
}
}
@InputFiles
abstract ConfigurableFileCollection getInputJars()
@OutputFile
abstract RegularFileProperty getOutput()
}
@@ -0,0 +1,64 @@
package net.minecraftforge.forge.tasks
import org.gradle.api.DefaultTask
import org.gradle.api.artifacts.Dependency
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.provider.Property
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.Optional
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.TaskAction
import java.nio.file.Files
import java.nio.file.StandardCopyOption
abstract class SetupCheckJarCompatibility extends DefaultTask {
SetupCheckJarCompatibility() {
group = 'jar compatibility'
onlyIf {
inputVersion.getOrNull() != null
}
baseBinPatchesOutput.convention(project.layout.buildDirectory.dir(name).map { it.file('joined.lzma') })
}
@TaskAction
void run() {
def inputVersion = inputVersion.get()
def fmlLibs = project.configurations.detachedConfiguration(project.PACKED_DEPS.collect {
def artifactId = it.split(':')[1]
return project.dependencies.create("net.minecraftforge:${artifactId}:${inputVersion}")
}.toArray(Dependency[]::new))
project.tasks.named('checkJarCompatibility') {
baseLibraries.from(project.tasks.createJoinedSRG.output)
baseLibraries.from(project.provider {
fmlLibs.resolvedConfiguration.lenientConfiguration.files
})
inputJar = project.tasks.reobfJar.output
concreteLibraries.from(project.PACKED_DEPS.collect { project.rootProject.tasks.getByPath(it).archiveFile })
commonLibraries.from(project.configurations.minecraftImplementation)
commonLibraries.from(project.configurations.installer)
commonLibraries.from(project.configurations.moduleonly)
}
def baseForgeUserdev = project.layout.buildDirectory.dir(name).map { it.file("forge-${inputVersion}-userdev.jar") }.get().asFile
project.rootProject.extensions.download.run {
src "https://maven.minecraftforge.net/net/minecraftforge/forge/${inputVersion}/forge-${inputVersion}-userdev.jar"
dest baseForgeUserdev
}
def joinedLzma = project.zipTree(baseForgeUserdev).matching { it.include('joined.lzma') }.singleFile
Files.copy(joinedLzma.toPath(), baseBinPatchesOutput.get().asFile.toPath(), StandardCopyOption.REPLACE_EXISTING)
}
@Input
@Optional
abstract Property<String> getInputVersion()
@OutputFile
abstract RegularFileProperty getBaseBinPatchesOutput()
}
@@ -18,17 +18,17 @@ public class Util {
return md.digest().collect {String.format "%02x", it}.join()
}
File.metaClass.getSha1 = { !delegate.exists() ? null : delegate.sha1() }
File.metaClass.json = { -> new JsonSlurper().parseText(delegate.text) }
File.metaClass.getJson = { return delegate.exists() ? new JsonSlurper().parse(delegate) : [:] }
File.metaClass.setJson = { json -> delegate.text = new JsonBuilder(json).toPrettyString() }
Date.metaClass.iso8601 = { ->
def format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")
def result = format.format(delegate)
return result[0..21] + ':' + result[22..-1]
}
String.metaClass.rsplit = { String del, int limit = -1 ->
def lst = new ArrayList()
def x = 0, idx
@@ -41,7 +41,7 @@ public class Util {
return lst
}
}
public static String[] getClasspath(project, libs, artifact) {
def ret = []
artifactTree(project, artifact).each { key, lib ->
@@ -51,7 +51,7 @@ public class Util {
}
return ret
}
public static def getArtifacts(project, config, classifiers) {
def ret = [:]
config.resolvedConfiguration.resolvedArtifacts.each {
@@ -75,7 +75,7 @@ public class Util {
url = "https://maven.minecraftforge.net/${path}"
}
//TODO remove when Mojang launcher is updated
if (!classifiers && art.classifier != null) {
if (!classifiers && art.classifier != null) {
//Mojang launcher doesn't currently support classifiers, so... move it to part of the version, and force the extension to 'jar'
// However, keep the path normal so that our mirror system works.
art.version = "${art.version}-${art.classifier}"
@@ -96,14 +96,14 @@ public class Util {
}
return ret
}
public static def getMavenPath(task) {
public static def getMavenPath(task) {
def classifier = task.archiveClassifier.get()
def dep = "${task.project.group}:${task.project.name}:${task.project.version}" + (classifier == '' ? '' : ':' + classifier)
return "${task.project.group.replace('.', '/')}/${task.project.name}/${task.project.version}/${task.project.name}-${task.project.version}".toString() + (classifier == '' ? '' : '-' + classifier) + '.jar'
}
public static def getMavenDep(task) {
public static def getMavenDep(task) {
def classifier = task.archiveClassifier.get()
return "${task.project.group}:${task.project.name}:${task.project.version}" + (classifier == '' ? '' : ':' + classifier)
}
@@ -127,7 +127,7 @@ public class Util {
def files = cfg.resolve()
return getArtifacts(project, cfg, true)
}
private static boolean checkExists(url) {
try {
def code = new URL(url).openConnection().with {
@@ -142,4 +142,9 @@ public class Util {
throw e
}
}
public static String getLatestForgeVersion(mcVersion) {
def json = new JsonSlurper().parseText(new URL("https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json").getText("UTF-8"))
return json.promos["$mcVersion-latest"]
}
}
@@ -22,13 +22,7 @@ import net.minecraftforge.forgespi.locating.IModFile;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.Executor;
@@ -256,10 +250,22 @@ public class ModLoader
.filter(Objects::nonNull)
.collect(Collectors.toList());
if (containers.size() != modInfoMap.size()) {
var modIds = modInfoMap.values().stream().map(IModInfo::getModId).sorted().collect(Collectors.toList());
var containerIds = containers.stream().map(c -> c != null ? c.getModId() : "(null)").sorted().collect(Collectors.toList());
LOGGER.fatal(LOADING,"File {} constructed {} mods: {}, but had {} mods specified: {}",
modFile.getFilePath(),
containers.size(), containers.stream().map(c -> c != null ? c.getModId() : "(null)").sorted().collect(Collectors.toList()),
modInfoMap.size(), modInfoMap.values().stream().map(IModInfo::getModId).sorted().collect(Collectors.toList()));
containers.size(), containerIds,
modInfoMap.size(), modIds);
var missingClasses = new ArrayList<>(modIds);
missingClasses.removeAll(containerIds);
LOGGER.fatal(LOADING, "The following classes are missing, but are reported in the mods.toml: {}", missingClasses);
var missingMods = new ArrayList<>(containerIds);
missingMods.removeAll(modIds);
LOGGER.fatal(LOADING, "The following mods are missing, but have classes in the jar: {}", missingMods);
loadingExceptions.add(new ModLoadingException(null, ModLoadingStage.CONSTRUCT, "fml.modloading.missingclasses", null, modFile.getFilePath()));
}
// remove errored mod containers
@@ -305,6 +311,14 @@ public class ModLoader
}
ModList.get().forEachModInOrder(mc -> mc.acceptEvent(e));
}
public <T extends Event & IModBusEvent> T postEventWithReturn(T e) {
if (!loadingStateValid) {
LOGGER.error("Cowardly refusing to send event {} to a broken mod state", e.getClass().getName());
return e;
}
ModList.get().forEachModInOrder(mc -> mc.acceptEvent(e));
return e;
}
public <T extends Event & IModBusEvent> void postEventWithWrapInModOrder(T e, BiConsumer<ModContainer, T> pre, BiConsumer<ModContainer, T> post) {
if (!loadingStateValid) {
LOGGER.error("Cowardly refusing to send event {} to a broken mod state", e.getClass().getName());
@@ -5,13 +5,18 @@
package net.minecraftforge.fml;
import com.mojang.logging.LogUtils;
import net.minecraftforge.fml.config.IConfigSpec;
import net.minecraftforge.fml.config.ModConfig;
import net.minecraftforge.fml.loading.FMLLoader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.function.Supplier;
public class ModLoadingContext
{
private static final Logger LOGGER = LogUtils.getLogger();
private static final ThreadLocal<ModLoadingContext> context = ThreadLocal.withInitial(ModLoadingContext::new);
private Object languageExtension;
private ModLoadingStage stage;
@@ -46,10 +51,24 @@ public class ModLoadingContext
}
public void registerConfig(ModConfig.Type type, IConfigSpec<?> spec) {
if (spec.isEmpty())
{
// This handles the case where a mod tries to register a config, without any options configured inside it.
LOGGER.debug("Attempted to register an empty config for type {} on mod {}", type, getActiveContainer().getModId());
return;
}
getActiveContainer().addConfig(new ModConfig(type, spec, getActiveContainer()));
}
public void registerConfig(ModConfig.Type type, IConfigSpec<?> spec, String fileName) {
if (spec.isEmpty())
{
// This handles the case where a mod tries to register a config, without any options configured inside it.
LOGGER.debug("Attempted to register an empty config for type {} on mod {} using file name {}", type, getActiveContainer().getModId(), fileName);
return;
}
getActiveContainer().addConfig(new ModConfig(type, spec, getActiveContainer(), fileName));
}
@@ -8,6 +8,7 @@ package net.minecraftforge.fml.loading;
import com.mojang.logging.LogUtils;
import org.slf4j.Logger;
import java.io.File;
import java.io.IOException;
import java.nio.file.FileAlreadyExistsException;
import java.nio.file.Files;
@@ -53,4 +54,16 @@ public class FileUtils
return "";
}
}
public static boolean matchFileName(String path, String... matches) {
// Extract file name from path
String name = path.substring(Math.min(path.lastIndexOf(File.separatorChar) + 1, path.length()));
// Check if it contains any of the desired keywords
for (String match : matches) {
if (name.contains(match)) {
return true;
}
}
return false;
}
}
@@ -6,21 +6,27 @@
package net.minecraftforge.fml.loading;
import com.mojang.logging.LogUtils;
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.slf4j.Logger;
import java.io.File;
import java.io.IOException;
import java.lang.module.ModuleDescriptor;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.zip.ZipFile;
import java.util.Set;
public class ModDirTransformerDiscoverer implements ITransformerDiscoveryService {
private static final Logger LOGGER = LogUtils.getLogger();
private static final Set<String> SERVICES = Set.of(
"cpw.mods.modlauncher.api.ITransformationService",
"net.minecraftforge.forgespi.locating.IModLocator",
"net.minecraftforge.forgespi.locating.IDependencyLocator"
);
@Override
public List<NamedPath> candidates(final Path gameDirectory) {
@@ -51,14 +57,11 @@ public class ModDirTransformerDiscoverer implements ITransformerDiscoveryService
if (!Files.isRegularFile(path)) return;
if (!path.toString().endsWith(".jar")) return;
if (LamdbaExceptionUtils.uncheck(() -> Files.size(path)) == 0) return;
try (ZipFile zf = new ZipFile(new File(path.toUri()))) {
if (zf.getEntry("META-INF/services/cpw.mods.modlauncher.api.ITransformationService") != null) {
found.add(new NamedPath(zf.getName(), path));
} else if (zf.getEntry("META-INF/services/net.minecraftforge.forgespi.locating.IModLocator") != null) {
found.add(new NamedPath(zf.getName(), path));
}
} catch (IOException ioe) {
LOGGER.error("Zip Error when loading jar file {}", path, ioe);
}
SecureJar jar = SecureJar.from(path);
jar.moduleDataProvider().descriptor().provides().stream()
.map(ModuleDescriptor.Provides::service)
.filter(SERVICES::contains)
.forEach(s -> found.add(new NamedPath(s, path)));
}
}
@@ -210,10 +210,24 @@ public class ModSorter
if (!missingVersions.isEmpty()) {
if (mandatoryMissing > 0) {
LOGGER.error(LOADING, "Missing mandatory dependencies: {}", missingVersions.stream().filter(IModInfo.ModVersion::isMandatory).map(IModInfo.ModVersion::getModId).collect(Collectors.joining(", ")));
LOGGER.error(
LOADING,
"Missing or unsupported mandatory dependencies:\n{}",
missingVersions.stream()
.filter(IModInfo.ModVersion::isMandatory)
.map(ver -> formatDependencyError(ver, modVersions))
.collect(Collectors.joining("\n"))
);
}
if (missingVersions.size() - mandatoryMissing > 0) {
LOGGER.error(LOADING, "Unsupported installed optional dependencies: {}", missingVersions.stream().filter(ver -> !ver.isMandatory()).map(IModInfo.ModVersion::getModId).collect(Collectors.joining(", ")));
LOGGER.error(
LOADING,
"Unsupported installed optional dependencies:\n{}",
missingVersions.stream()
.filter(ver -> !ver.isMandatory())
.map(ver -> formatDependencyError(ver, modVersions))
.collect(Collectors.joining("\n"))
);
}
return missingVersions.stream()
@@ -225,6 +239,18 @@ public class ModSorter
return Collections.emptyList();
}
private static String formatDependencyError(IModInfo.ModVersion dependency, Map<String, ArtifactVersion> modVersions)
{
ArtifactVersion installed = modVersions.get(dependency.getModId());
return String.format(
"\tMod ID: '%s', Requested by: '%s', Expected range: '%s', Actual version: '%s'",
dependency.getModId(),
dependency.getOwner().getModId(),
dependency.getVersionRange(),
installed != null ? installed.toString() : "[MISSING]"
);
}
private boolean modVersionNotContained(final IModInfo.ModVersion mv, final Map<String, ArtifactVersion> modVersions)
{
return !(VersionSupportMatrix.testVersionSupportMatrix(mv.getVersionRange(), mv.getModId(), "mod", (modId, range) -> modVersions.containsKey(modId) &&
@@ -6,6 +6,7 @@
package net.minecraftforge.fml.loading.targets;
import cpw.mods.jarhandling.SecureJar;
import net.minecraftforge.fml.loading.FileUtils;
import java.io.File;
import java.nio.file.Path;
@@ -29,7 +30,7 @@ public abstract class CommonDevLaunchHandler extends CommonLaunchHandler {
// The extra jar is on the classpath, so try and pull it out of the legacy classpath
var legacyCP = Objects.requireNonNull(System.getProperty("legacyClassPath"), "Missing legacyClassPath, cannot find client-extra").split(File.pathSeparator);
var extra = Paths.get(Arrays.stream(legacyCP).filter(e -> e.contains("client-extra")).findFirst().orElseThrow(() -> new IllegalStateException("Could not find client-extra in legacy classpath")));
var extra = findJarOnClasspath(legacyCP, "client-extra");
mcstream.add(extra);
// The MC code/Patcher edits are in exploded directories
@@ -77,11 +78,18 @@ public abstract class CommonDevLaunchHandler extends CommonLaunchHandler {
protected List<Path> getFmlStuff(String[] classpath) {
// We also want the FML things, fmlcore, javafmllanguage, mclanguage, I don't like hard coding these, but hey whatever works for now.
return Arrays.stream(classpath)
.filter(e -> e.contains("fmlcore") || e.contains("javafmllanguage") || e.contains("lowcodelanguage") || e.contains("mclanguage"))
.filter(e -> FileUtils.matchFileName(e, "fmlcore", "javafmllanguage", "lowcodelanguage", "mclanguage"))
.map(Paths::get)
.toList();
}
protected static Path findJarOnClasspath(String[] classpath, String match) {
return Paths.get(Arrays.stream(classpath)
.filter(e -> FileUtils.matchFileName(e, match))
.findFirst()
.orElseThrow(() -> new IllegalStateException("Could not find " + match + " in classpath")));
}
protected BiPredicate<String, String> getMcFilter(Path extra, List<Path> minecraft, Stream.Builder<List<Path>> mods) {
final var packages = getPackages();
final var extraPath = extra.toString().replace('\\', '/');
@@ -10,8 +10,6 @@ import net.minecraftforge.fml.loading.VersionInfo;
import java.io.File;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@@ -41,8 +39,4 @@ public abstract class CommonUserdevLaunchHandler extends CommonDevLaunchHandler
}
protected abstract void processStreams(String[] classpath, VersionInfo versionInfo, Stream.Builder<Path> mc, Stream.Builder<List<Path>> mods);
protected static Path findJarOnClasspath(String[] classpath, String match) {
return Paths.get(Arrays.stream(classpath).filter(e -> e.contains(match)).findFirst().orElseThrow(() -> new IllegalStateException("Could not find " + match + " in classpath")));
}
}
@@ -19,6 +19,7 @@ public final class CyclePresentException extends IllegalArgumentException {
* @param cycles the cycles present
*/
CyclePresentException(Set<Set<?>> cycles) {
super("Cycles present in graph: " + cycles);
this.cycles = cycles;
}
+1
View File
@@ -13,6 +13,7 @@
<MarkerFilter marker="REGISTRIES" onMatch="${sys:forge.logging.marker.registries:-DENY}" onMismatch="NEUTRAL"/>
<MarkerFilter marker="REGISTRYDUMP" onMatch="${sys:forge.logging.marker.registrydump:-DENY}" onMismatch="NEUTRAL"/>
<MarkerFilter marker="SPLASH" onMatch="${sys:forge.logging.marker.splash:-DENY}" onMismatch="NEUTRAL"/>
<MarkerFilter marker="RESOURCE-CACHE" onMatch="${sys:forge.logging.marker.resource.cache:-DENY}" onMismatch="NEUTRAL"/>
<MarkerFilter marker="FORGEMOD" onMatch="${sys:forge.logging.marker.forgemod:-ACCEPT}" onMismatch="NEUTRAL"/>
<MarkerFilter marker="LOADING" onMatch="${sys:forge.logging.marker.loading:-ACCEPT}" onMismatch="NEUTRAL"/>
<MarkerFilter marker="CORE" onMatch="${sys:forge.logging.marker.core:-ACCEPT}" onMismatch="NEUTRAL"/>
+1 -1
View File
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
@@ -51,7 +51,7 @@ public class LowCodeModLanguageProvider implements IModLanguageProvider
throw new ModLoadingException(info, ModLoadingStage.CONSTRUCT, "fml.modloading.failedtoloadmodclass", e);
}
} catch (NoSuchMethodException | ClassNotFoundException | InstantiationException | IllegalAccessException e) {
LOGGER.fatal(LOADING, "Unable to load FMLModContainer, wut?", e);
LOGGER.fatal(LOADING, "Unable to load LowCodeModContainer, wut?", e);
final Class<RuntimeException> mle = (Class<RuntimeException>) LamdbaExceptionUtils.uncheck(() -> Class.forName("net.minecraftforge.fml.ModLoadingException", true, Thread.currentThread().getContextClassLoader()));
final Class<ModLoadingStage> mls = (Class<ModLoadingStage>) LamdbaExceptionUtils.uncheck(() -> Class.forName("net.minecraftforge.fml.ModLoadingStage", true, Thread.currentThread().getContextClassLoader()));
throw LamdbaExceptionUtils.uncheck(() -> LamdbaExceptionUtils.uncheck(() -> mle.getConstructor(IModInfo.class, mls, String.class, Throwable.class)).newInstance(info, Enum.valueOf(mls, "CONSTRUCT"), "fml.modloading.failedtoloadmodclass", e));
-2
View File
@@ -132,8 +132,6 @@ dependencies {
minecraft '@FORGE_GROUP@:@FORGE_NAME@:@FORGE_VERSION@'
// Real mod deobf dependency examples - these get remapped to your current mappings
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency
// runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}") // Adds the full JEI mod as a runtime dependency
// implementation fg.deobf("com.tterrag.registrate:Registrate:MC${mc_version}-${registrate_version}") // Adds registrate as a dependency
// Examples using mod jars from ./libs
@@ -3,22 +3,21 @@ package com.example.examplemod;
import com.mojang.logging.LogUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.CreativeModeTabs;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.material.Material;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.CreativeModeTabEvent;
import net.minecraftforge.event.server.ServerStartingEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.InterModComms;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;
import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent;
import net.minecraftforge.event.server.ServerStartingEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
@@ -41,7 +40,7 @@ public class ExampleMod
// Creates a new Block with the id "examplemod:example_block", combining the namespace and path
public static final RegistryObject<Block> EXAMPLE_BLOCK = BLOCKS.register("example_block", () -> new Block(BlockBehaviour.Properties.of(Material.STONE)));
// Creates a new BlockItem with the id "examplemod:example_block", combining the namespace and path
public static final RegistryObject<Item> EXAMPLE_BLOCK_ITEM = ITEMS.register("example_block", () -> new BlockItem(EXAMPLE_BLOCK.get(), new Item.Properties().tab(CreativeModeTab.TAB_BUILDING_BLOCKS)));
public static final RegistryObject<Item> EXAMPLE_BLOCK_ITEM = ITEMS.register("example_block", () -> new BlockItem(EXAMPLE_BLOCK.get(), new Item.Properties()));
public ExampleMod()
{
@@ -57,6 +56,10 @@ public class ExampleMod
// Register ourselves for server and other game events we are interested in
MinecraftForge.EVENT_BUS.register(this);
// Register the item to a creative tab
modEventBus.addListener((CreativeModeTabEvent.BuildContents event) -> event.registerSimple(CreativeModeTabs.BUILDING_BLOCKS,
EXAMPLE_BLOCK_ITEM.get()));
}
private void commonSetup(final FMLCommonSetupEvent event)
@@ -75,7 +78,7 @@ public class ExampleMod
}
// You can use EventBusSubscriber to automatically register all static methods in the class annotated with @SubscribeEvent
@Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
@Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
public static class ClientModEvents
{
@SubscribeEvent
+2 -2
View File
@@ -1,8 +1,8 @@
{
"pack": {
"description": "examplemod resources",
"pack_format": 9,
"forge:resource_pack_format": 9,
"pack_format": 12,
"forge:resource_pack_format": 12,
"forge:data_pack_format": 10
}
}
@@ -1,6 +1,6 @@
--- a/com/mojang/blaze3d/platform/GlStateManager.java
+++ b/com/mojang/blaze3d/platform/GlStateManager.java
@@ -539,9 +_,16 @@
@@ -510,9 +_,16 @@
f_84077_[f_84076_].f_84800_ = false;
}
@@ -9,7 +9,7 @@
if (monitor != null) {
VideoMode videomode = monitor.m_84948_(this.f_85355_ ? this.f_85354_ : Optional.empty());
this.f_85350_ = this.f_85357_ = monitor.m_84951_() + videomode.m_85332_() / 2 - this.f_85359_ / 2;
@@ -303,6 +_,7 @@
@@ -263,6 +_,7 @@
GLFW.glfwGetFramebufferSize(this.f_85349_, aint, aint1);
this.f_85361_ = aint[0] > 0 ? aint[0] : 1;
this.f_85362_ = aint1[0] > 0 ? aint1[0] : 1;
@@ -1,7 +1,7 @@
--- a/com/mojang/blaze3d/vertex/BufferBuilder.java
+++ b/com/mojang/blaze3d/vertex/BufferBuilder.java
@@ -486,4 +_,14 @@
this.f_166822_ = p_166829_;
this.f_166822_ = p_254368_;
}
}
+
@@ -0,0 +1,11 @@
--- a/com/mojang/blaze3d/vertex/PoseStack.java
+++ b/com/mojang/blaze3d/vertex/PoseStack.java
@@ -11,7 +_,7 @@
import org.joml.Quaternionf;
@OnlyIn(Dist.CLIENT)
-public class PoseStack {
+public class PoseStack implements net.minecraftforge.client.extensions.IForgePoseStack {
private final Deque<PoseStack.Pose> f_85834_ = Util.m_137469_(Queues.newArrayDeque(), (p_85848_) -> {
Matrix4f matrix4f = new Matrix4f();
Matrix3f matrix3f = new Matrix3f();
@@ -20,7 +20,7 @@
float[] afloat = new float[]{p_85998_[0], p_85998_[1], p_85998_[2], p_85998_[3]};
int[] aint = new int[]{p_86002_[0], p_86002_[1], p_86002_[2], p_86002_[3]};
int[] aint1 = p_85997_.m_111303_();
@@ -101,12 +_,14 @@
@@ -99,11 +_,13 @@
f5 = afloat[k] * p_86001_;
}
@@ -28,12 +28,11 @@
+ int l = applyBakedLighting(p_86002_[k], bytebuffer);
float f9 = bytebuffer.getFloat(16);
float f10 = bytebuffer.getFloat(20);
Vector4f vector4f = new Vector4f(f, f1, f2, 1.0F);
vector4f.m_123607_(matrix4f);
- this.m_5954_(vector4f.m_123601_(), vector4f.m_123615_(), vector4f.m_123616_(), f3, f4, f5, 1.0F, f9, f10, p_86003_, l, vector3f.m_122239_(), vector3f.m_122260_(), vector3f.m_122269_());
+ applyBakedNormals(vector3f, bytebuffer, p_85996_.m_85864_());
Vector4f vector4f = matrix4f.transform(new Vector4f(f, f1, f2, 1.0F));
- this.m_5954_(vector4f.x(), vector4f.y(), vector4f.z(), f3, f4, f5, 1.0F, f9, f10, p_86003_, l, vector3f.x(), vector3f.y(), vector3f.z());
+ applyBakedNormals(vector3f, bytebuffer, p_85996_.m_252943_());
+ float vertexAlpha = p_86004_ ? alpha * (float) (bytebuffer.get(15) & 255) / 255.0F : alpha;
+ this.m_5954_(vector4f.m_123601_(), vector4f.m_123615_(), vector4f.m_123616_(), f3, f4, f5, vertexAlpha, f9, f10, p_86003_, l, vector3f.m_122239_(), vector3f.m_122260_(), vector3f.m_122269_());
+ this.m_5954_(vector4f.x(), vector4f.y(), vector4f.z(), f3, f4, f5, vertexAlpha, f9, f10, p_86003_, l, vector3f.x(), vector3f.y(), vector3f.z());
}
} catch (Throwable throwable1) {
if (memorystack != null) {
}
@@ -1,13 +0,0 @@
--- a/com/mojang/math/Matrix3f.java
+++ b/com/mojang/math/Matrix3f.java
@@ -588,4 +_,10 @@
public Matrix3f m_8183_() {
return new Matrix3f(this);
}
+
+ public void multiplyBackward(Matrix3f other) {
+ Matrix3f copy = other.m_8183_();
+ copy.m_8178_(this);
+ this.m_8169_(copy);
+ }
}
@@ -1,43 +0,0 @@
--- a/com/mojang/math/Matrix4f.java
+++ b/com/mojang/math/Matrix4f.java
@@ -559,4 +_,40 @@
matrix4f.f_27614_ = p_27656_;
return matrix4f;
}
+
+ // Forge start
+ public Matrix4f(float[] values) {
+ f_27603_ = values[0];
+ f_27604_ = values[1];
+ f_27605_ = values[2];
+ f_27606_ = values[3];
+ f_27607_ = values[4];
+ f_27608_ = values[5];
+ f_27609_ = values[6];
+ f_27610_ = values[7];
+ f_27611_ = values[8];
+ f_27612_ = values[9];
+ f_27613_ = values[10];
+ f_27614_ = values[11];
+ f_27615_ = values[12];
+ f_27616_ = values[13];
+ f_27617_ = values[14];
+ f_27618_ = values[15];
+ }
+
+ public void multiplyBackward(Matrix4f other) {
+ Matrix4f copy = other.m_27658_();
+ copy.m_27644_(this);
+ this.m_162210_(copy);
+ }
+
+ public void setTranslation(float x, float y, float z) {
+ this.f_27603_ = 1.0F;
+ this.f_27608_ = 1.0F;
+ this.f_27613_ = 1.0F;
+ this.f_27618_ = 1.0F;
+ this.f_27606_ = x;
+ this.f_27610_ = y;
+ this.f_27614_ = z;
+ }
}
@@ -1,15 +1,15 @@
--- a/com/mojang/math/Transformation.java
+++ b/com/mojang/math/Transformation.java
@@ -6,7 +_,7 @@
import net.minecraft.Util;
import org.apache.commons.lang3.tuple.Triple;
@@ -12,7 +_,7 @@
import org.joml.Vector3f;
import org.joml.Vector3fc;
-public final class Transformation {
+public final class Transformation implements net.minecraftforge.client.extensions.IForgeTransformation {
private final Matrix4f f_121078_;
private boolean f_121079_;
@Nullable
@@ -145,6 +_,19 @@
@@ -139,6 +_,19 @@
public int hashCode() {
return Objects.hash(this.f_121078_);
}
@@ -22,10 +22,10 @@
+ private void checkNormalTransform() {
+ if (normalTransform == null) {
+ normalTransform = new Matrix3f(f_121078_);
+ normalTransform.m_8187_();
+ normalTransform.m_8155_();
+ normalTransform.invert();
+ normalTransform.transpose();
+ }
+ }
public Transformation m_175937_(Transformation p_175938_, float p_175939_) {
Vector3f vector3f = this.m_175940_();
Vector3f vector3f = this.m_252829_();
@@ -1,28 +0,0 @@
--- a/com/mojang/math/Vector3f.java
+++ b/com/mojang/math/Vector3f.java
@@ -138,7 +_,7 @@
public boolean m_122278_() {
float f = this.f_122228_ * this.f_122228_ + this.f_122229_ * this.f_122229_ + this.f_122230_ * this.f_122230_;
- if ((double)f < 1.0E-5D) {
+ if (f < Float.MIN_NORMAL) { //Forge: Fix MC-239212
return false;
} else {
float f1 = Mth.m_14195_(f);
@@ -207,4 +_,16 @@
public String toString() {
return "[" + this.f_122228_ + ", " + this.f_122229_ + ", " + this.f_122230_ + "]";
}
+
+ public Vector3f(float[] values) {
+ set(values);
+ }
+ public void set(float[] values) {
+ this.f_122228_ = values[0];
+ this.f_122229_ = values[1];
+ this.f_122230_ = values[2];
+ }
+ public void setX(float x) { this.f_122228_ = x; }
+ public void setY(float y) { this.f_122229_ = y; }
+ public void setZ(float z) { this.f_122230_ = z; }
}
@@ -1,18 +0,0 @@
--- a/com/mojang/math/Vector4f.java
+++ b/com/mojang/math/Vector4f.java
@@ -147,4 +_,15 @@
public String toString() {
return "[" + this.f_123589_ + ", " + this.f_123590_ + ", " + this.f_123591_ + ", " + this.f_123592_ + "]";
}
+
+ public void set(float[] values) {
+ this.f_123589_ = values[0];
+ this.f_123590_ = values[1];
+ this.f_123591_ = values[2];
+ this.f_123592_ = values[3];
+ }
+ public void setX(float x) { this.f_123589_ = x; }
+ public void setY(float y) { this.f_123590_ = y; }
+ public void setZ(float z) { this.f_123591_ = z; }
+ public void setW(float w) { this.f_123592_ = w; }
}
@@ -13,6 +13,6 @@
+ return super.m_7933_(key, scanCode, modifiers);
+ }
+
public void m_6305_(PoseStack p_88679_, int p_88680_, int p_88681_, float p_88682_) {
public void m_86412_(PoseStack p_88679_, int p_88680_, int p_88681_, float p_88682_) {
this.m_7333_(p_88679_);
m_93215_(p_88679_, this.f_96547_, this.f_200947_.getFirst(), this.f_96543_ / 2, 80, 16777215);
@@ -1,6 +1,6 @@
--- a/net/minecraft/SharedConstants.java
+++ b/net/minecraft/SharedConstants.java
@@ -211,6 +_,7 @@
@@ -214,6 +_,7 @@
}
static {
@@ -12,7 +12,7 @@
public static ExecutorService m_183988_() {
return f_137443_;
}
@@ -248,7 +_,7 @@
@@ -242,7 +_,7 @@
try {
type = DataFixers.m_14512_().getSchema(DataFixUtils.makeKey(SharedConstants.m_183709_().getWorldVersion())).getChoiceType(p_137552_, p_137553_);
} catch (IllegalArgumentException illegalargumentexception) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/advancements/critereon/ItemPredicate.java
+++ b/net/minecraft/advancements/critereon/ItemPredicate.java
@@ -28,6 +_,8 @@
@@ -29,6 +_,8 @@
import net.minecraft.world.level.ItemLike;
public class ItemPredicate {
@@ -9,7 +9,7 @@
public static final ItemPredicate f_45028_ = new ItemPredicate();
@Nullable
private final TagKey<Item> f_45029_;
@@ -80,7 +_,7 @@
@@ -81,7 +_,7 @@
return false;
} else {
if (this.f_45033_.length > 0) {
@@ -18,7 +18,7 @@
for(EnchantmentPredicate enchantmentpredicate : this.f_45033_) {
if (!enchantmentpredicate.m_30476_(map)) {
@@ -107,6 +_,11 @@
@@ -108,6 +_,11 @@
public static ItemPredicate m_45051_(@Nullable JsonElement p_45052_) {
if (p_45052_ != null && !p_45052_.isJsonNull()) {
JsonObject jsonobject = GsonHelper.m_13918_(p_45052_, "item");
@@ -30,7 +30,7 @@
MinMaxBounds.Ints minmaxbounds$ints = MinMaxBounds.Ints.m_55373_(jsonobject.get("count"));
MinMaxBounds.Ints minmaxbounds$ints1 = MinMaxBounds.Ints.m_55373_(jsonobject.get("durability"));
if (jsonobject.has("data")) {
@@ -214,6 +_,14 @@
@@ -215,6 +_,14 @@
} else {
return new ItemPredicate[0];
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/Camera.java
+++ b/net/minecraft/client/Camera.java
@@ -211,6 +_,18 @@
@@ -206,6 +_,18 @@
this.f_90549_ = false;
}
@@ -1,11 +1,20 @@
--- a/net/minecraft/client/ClientRecipeBook.java
+++ b/net/minecraft/client/ClientRecipeBook.java
@@ -103,6 +_,8 @@
} else if (recipetype == RecipeType.f_44113_) {
return RecipeBookCategories.SMITHING;
} else {
+ RecipeBookCategories categories = net.minecraftforge.client.RecipeBookManager.findCategories((RecipeType) recipetype, p_90647_);
+ if (categories != null) return categories;
f_90618_.warn("Unknown recipe category: {}/{}", LogUtils.defer(() -> {
return Registry.f_122864_.m_7981_(p_90647_.m_6671_());
}), LogUtils.defer(p_90647_::m_6423_));
@@ -51,7 +_,7 @@
for(Recipe<?> recipe : p_90643_) {
if (!recipe.m_5598_() && !recipe.m_142505_()) {
RecipeBookCategories recipebookcategories = m_90646_(recipe);
- String s = recipe.m_6076_();
+ String s = recipe.m_6076_().isEmpty() ? recipe.m_6423_().toString() : recipe.m_6076_(); // FORGE: Group value defaults to the recipe's ID if the recipe's explicit group is empty.
if (s.isEmpty()) {
map.computeIfAbsent(recipebookcategories, (p_90645_) -> {
return Lists.newArrayList();
@@ -138,6 +_,8 @@
} else if (recipetype == RecipeType.f_44113_) {
return RecipeBookCategories.SMITHING;
} else {
+ RecipeBookCategories categories = net.minecraftforge.client.RecipeBookManager.findCategories((RecipeType) recipetype, p_90647_);
+ if (categories != null) return categories;
f_90618_.warn("Unknown recipe category: {}/{}", LogUtils.defer(() -> {
return BuiltInRegistries.f_256990_.m_7981_(p_90647_.m_6671_());
}), LogUtils.defer(p_90647_::m_6423_));
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/KeyboardHandler.java
+++ b/net/minecraft/client/KeyboardHandler.java
@@ -299,7 +_,9 @@
@@ -298,7 +_,9 @@
}
Screen screen = this.f_90867_.f_91080_;
@@ -11,7 +11,7 @@
if (this.f_90867_.f_91066_.f_92105_.m_90832_(p_90895_, p_90896_)) {
this.f_90867_.m_91268_().m_85438_();
this.f_90867_.f_91066_.m_231829_().m_231514_(this.f_90867_.m_91268_().m_85440_());
@@ -317,6 +_,8 @@
@@ -316,6 +_,8 @@
});
return;
}
@@ -20,9 +20,9 @@
}
if (this.f_90867_.m_240477_().m_93316_()) {
@@ -339,11 +_,15 @@
@@ -338,11 +_,15 @@
Screen.m_96579_(() -> {
if (p_90897_ != 1 && (p_90897_ != 2 || !this.f_90868_)) {
if (p_90897_ != 1 && p_90897_ != 2) {
if (p_90897_ == 0) {
- aboolean[0] = screen.m_7920_(p_90895_, p_90896_, p_90898_);
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyReleasedPre(screen, p_90895_, p_90896_, p_90898_);
@@ -38,7 +38,7 @@
}
}, "keyPressed event handler", screen.getClass().getCanonicalName());
@@ -396,22 +_,26 @@
@@ -395,22 +_,26 @@
}
}
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/Minecraft.java
+++ b/net/minecraft/client/Minecraft.java
@@ -244,7 +_,7 @@
@@ -245,7 +_,7 @@
import org.slf4j.Logger;
@OnlyIn(Dist.CLIENT)
@@ -9,16 +9,7 @@
static Minecraft f_90981_;
private static final Logger f_90982_ = LogUtils.getLogger();
public static final boolean f_91002_ = Util.m_137581_() == Util.OS.OSX;
@@ -398,7 +_,7 @@
this.f_91029_ = p_91084_.f_101908_.f_101928_;
this.f_90986_ = p_91084_.f_101905_.f_101944_;
this.f_91037_ = new ClientPackSource(new File(this.f_91069_, "server-resource-packs"), p_91084_.f_101907_.m_101925_());
- this.f_91038_ = new PackRepository(Minecraft::m_167933_, this.f_91037_, new FolderRepositorySource(this.f_90985_, PackSource.f_10527_));
+ this.f_91038_ = new PackRepository(Minecraft::createClientPackAdapter, this.f_91037_, new FolderRepositorySource(this.f_90985_, PackSource.f_10527_));
this.f_91030_ = p_91084_.f_101905_.f_101945_;
this.f_231338_ = new YggdrasilAuthenticationService(this.f_91030_);
this.f_91048_ = this.f_231338_.createMinecraftSessionService();
@@ -406,7 +_,6 @@
@@ -410,7 +_,6 @@
this.f_231339_ = SignatureValidator.m_216358_(this.f_231338_.getServicesKey());
this.f_90998_ = p_91084_.f_101905_.f_101942_;
f_90982_.info("Setting user: {}", (Object)this.f_90998_.m_92546_());
@@ -26,7 +17,7 @@
this.f_91033_ = p_91084_.f_101908_.f_101926_;
this.f_91034_ = !p_91084_.f_101908_.f_101929_;
this.f_91035_ = !p_91084_.f_101908_.f_101930_;
@@ -458,7 +_,7 @@
@@ -459,7 +_,7 @@
this.f_90990_.m_85380_(this.f_91066_.m_232035_().m_231551_());
this.f_91067_ = new MouseHandler(this);
@@ -35,28 +26,30 @@
this.f_91068_ = new KeyboardHandler(this);
this.f_91068_.m_90887_(this.f_90990_.m_85439_());
RenderSystem.m_69580_(this.f_91066_.f_92035_, false);
@@ -466,6 +_,7 @@
@@ -467,6 +_,7 @@
this.f_91042_.m_83931_(0.0F, 0.0F, 0.0F, 0.0F);
this.f_91042_.m_83954_(f_91002_);
this.f_91036_ = new ReloadableResourceManager(PackType.CLIENT_RESOURCES);
+ net.minecraftforge.client.loading.ClientModLoader.begin(this, this.f_91038_, this.f_91036_, this.f_91037_);
+ net.minecraftforge.client.loading.ClientModLoader.begin(this, this.f_91038_, this.f_91036_);
this.f_91038_.m_10506_();
this.f_91066_.m_92145_(this.f_91038_);
this.f_91039_ = new LanguageManager(this.f_91066_.f_92075_);
@@ -510,10 +_,12 @@
@@ -511,10 +_,13 @@
this.f_91063_ = new GameRenderer(this, this.f_90994_.m_234586_(), this.f_91036_, this.f_90993_);
this.f_91036_.m_7217_(this.f_91063_);
this.f_91036_.m_7217_(this.f_91063_.m_247116_());
this.f_91060_ = new LevelRenderer(this, this.f_90994_, this.f_167845_, this.f_90993_);
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.RenderLevelStageEvent.RegisterStageEvent());
this.f_91036_.m_7217_(this.f_91060_);
this.m_91271_();
- this.m_91271_();
+ // Forge: We delay this to allow registration of modded creative mode tabs
+ // this.createSearchTrees();
this.f_91036_.m_7217_(this.f_90997_);
this.f_91061_ = new ParticleEngine(this.f_91073_, this.f_90987_);
+ net.minecraftforge.client.ForgeHooksClient.onRegisterParticleProviders(f_91061_);
this.f_91036_.m_7217_(this.f_91061_);
this.f_91053_ = new PaintingTextureManager(this.f_90987_);
this.f_91036_.m_7217_(this.f_91053_);
@@ -522,7 +_,9 @@
@@ -523,7 +_,9 @@
this.f_91047_ = new GpuWarnlistManager();
this.f_91036_.m_7217_(this.f_91047_);
this.f_91036_.m_7217_(this.f_205120_);
@@ -67,7 +60,7 @@
this.f_91064_ = new DebugRenderer(this);
this.f_238717_ = new RealmsDataFetcher(RealmsClient.m_239151_(this));
RenderSystem.m_69900_(this::m_91113_);
@@ -541,6 +_,21 @@
@@ -542,6 +_,21 @@
TinyFileDialogs.tinyfd_messageBox("Minecraft", stringbuilder.toString(), "ok", "error", false);
}
@@ -89,14 +82,15 @@
this.f_90990_.m_85409_(this.f_91066_.m_231817_().m_231551_());
this.f_90990_.m_85424_(this.f_91066_.m_232123_().m_231551_());
this.f_90990_.m_85426_();
@@ -563,23 +_,23 @@
@@ -565,24 +_,24 @@
}
this.f_167847_.m_168556_();
+ if (net.minecraftforge.client.loading.ClientModLoader.completeModLoading()) return; // Do not overwrite the error screen
+ // FORGE: Move opening initial screen to after startup and events are enabled.
+ if (s != null) {
+ ConnectScreen.m_169267_(new TitleScreen(), this, new ServerAddress(s, i), (ServerData)null);
+ ServerAddress serveraddress = new ServerAddress(s, i);
+ ConnectScreen.m_169267_(new TitleScreen(), this, serveraddress, new ServerData(I18n.m_118938_("selectServer.defaultName"), serveraddress.toString(), false));
+ } else if (this.m_239929_()) {
+ this.m_91152_(BanNoticeScreen.m_239967_((p_238185_) -> {
+ if (p_238185_) {
@@ -111,8 +105,9 @@
});
}, false));
- if (s != null) {
- ServerAddress serveraddress = new ServerAddress(s, i);
- reloadinstance.m_7237_().thenRunAsync(() -> {
- ConnectScreen.m_169267_(new TitleScreen(), this, new ServerAddress(s, i), (ServerData)null);
- ConnectScreen.m_169267_(new TitleScreen(), this, serveraddress, new ServerData(I18n.m_118938_("selectServer.defaultName"), serveraddress.toString(), false));
- }, this);
- } else if (this.m_239929_()) {
- this.m_91152_(BanNoticeScreen.m_239967_((p_238185_) -> {
@@ -128,7 +123,7 @@
}
@@ -622,6 +_,8 @@
@@ -634,6 +_,8 @@
private UserApiService m_193585_(YggdrasilAuthenticationService p_193586_, GameConfig p_193587_) {
try {
@@ -137,7 +132,7 @@
return p_193586_.createUserApiService(p_193587_.f_101905_.f_101942_.m_92547_());
} catch (AuthenticationException authenticationexception) {
f_90982_.error("Failed to verify authentication", (Throwable)authenticationexception);
@@ -634,7 +_,7 @@
@@ -646,7 +_,7 @@
}
private void m_91239_(Throwable p_91240_) {
@@ -146,7 +141,45 @@
this.m_91241_(p_91240_, (Component)null);
} else {
Util.m_137559_(p_91240_);
@@ -792,13 +_,13 @@
@@ -723,7 +_,10 @@
}
public void m_91271_() {
- this.f_90997_.m_235232_(SearchRegistry.f_119941_, (p_231451_) -> {
+ var nameSearchKeys = net.minecraftforge.client.CreativeModeTabSearchRegistry.getNameSearchKeys();
+ var tagSearchKeys = net.minecraftforge.client.CreativeModeTabSearchRegistry.getTagSearchKeys();
+ for (var nameSearchKey : nameSearchKeys.values())
+ this.f_90997_.m_235232_(nameSearchKey, (p_231451_) -> {
return new FullTextSearchTree<>((p_210797_) -> {
return p_210797_.m_41651_((Player)null, TooltipFlag.Default.f_256752_.m_257777_()).stream().map((p_210807_) -> {
return ChatFormatting.m_126649_(p_210807_.getString()).trim();
@@ -734,7 +_,8 @@
return Stream.of(BuiltInRegistries.f_257033_.m_7981_(p_91317_.m_41720_()));
}, p_231451_);
});
- this.f_90997_.m_235232_(SearchRegistry.f_119942_, (p_231430_) -> {
+ for (var tagSearchKey : tagSearchKeys.values())
+ this.f_90997_.m_235232_(tagSearchKey, (p_231430_) -> {
return new IdSearchTree<>((p_231353_) -> {
return p_231353_.m_204131_().map(TagKey::f_203868_);
}, p_231430_);
@@ -754,9 +_,12 @@
});
}, p_231389_);
});
- CreativeModeTabs.m_258007_().m_257882_((p_255439_) -> {
- this.m_231374_(SearchRegistry.f_119941_, p_255439_);
- this.m_231374_(SearchRegistry.f_119942_, p_255439_);
+ nameSearchKeys.forEach((tab, nameSearchKey) -> {
+ var tagSearchKey = tagSearchKeys.get(tab);
+ tab.m_257882_(contents -> {
+ this.m_231374_(nameSearchKey, contents);
+ this.m_231374_(tagSearchKey, contents);
+ });
});
}
@@ -808,13 +_,13 @@
Bootstrap.m_135875_(p_91333_.m_127526_());
if (p_91333_.m_127527_() != null) {
Bootstrap.m_135875_("#@!@# Game crashed! Crash report saved to: #@!@# " + p_91333_.m_127527_());
@@ -163,7 +196,7 @@
}
}
@@ -922,10 +_,6 @@
@@ -932,10 +_,6 @@
f_90982_.error("setScreen called from non-game thread");
}
@@ -174,7 +207,7 @@
if (p_91153_ == null && this.f_91073_ == null) {
p_91153_ = new TitleScreen();
} else if (p_91153_ == null && this.f_91074_.m_21224_()) {
@@ -936,6 +_,19 @@
@@ -946,6 +_,19 @@
}
}
@@ -194,7 +227,7 @@
this.f_91080_ = p_91153_;
BufferUploader.m_166835_();
if (p_91153_ != null) {
@@ -1079,11 +_,14 @@
@@ -1091,11 +_,14 @@
RenderSystem.m_69481_();
this.f_91026_.m_7238_();
if (!this.f_91079_) {
@@ -209,7 +242,7 @@
}
if (this.f_91056_ != null) {
@@ -1210,10 +_,12 @@
@@ -1223,10 +_,12 @@
this.f_90990_.m_85378_((double)i);
if (this.f_91080_ != null) {
this.f_91080_.m_6574_(this, this.f_90990_.m_85445_(), this.f_90990_.m_85446_());
@@ -222,7 +255,7 @@
this.f_91063_.m_109097_(this.f_90990_.m_85441_(), this.f_90990_.m_85442_());
this.f_91067_.m_91599_();
}
@@ -1491,6 +_,7 @@
@@ -1499,6 +_,7 @@
}
public void m_91395_() {
@@ -230,7 +263,7 @@
this.f_91019_ = false;
}
@@ -1520,10 +_,18 @@
@@ -1528,10 +_,18 @@
if (p_91387_ && this.f_91077_ != null && this.f_91077_.m_6662_() == HitResult.Type.BLOCK) {
BlockHitResult blockhitresult = (BlockHitResult)this.f_91077_;
BlockPos blockpos = blockhitresult.m_82425_();
@@ -252,41 +285,41 @@
this.f_91074_.m_6674_(InteractionHand.MAIN_HAND);
}
}
@@ -1548,14 +_,20 @@
return false;
} else {
boolean flag = false;
- switch (this.f_91077_.m_6662_()) {
+ var inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.f_91066_.f_92096_, InteractionHand.MAIN_HAND);
+ HitResult.Type hitType = this.f_91077_.m_6662_();
+ if(this.f_91077_ instanceof EntityHitResult entityHit) { // Forge: Perform attack range checks here, instead of in GameRenderer#pick, so extended-reach interactions work.
+ if(!f_91074_.canHit(entityHit.m_82443_(), 0)) hitType = HitResult.Type.MISS; // No padding in client code.
+ }
+ if (!inputEvent.isCanceled())
+ switch(hitType) {
case ENTITY:
this.f_91072_.m_105223_(this.f_91074_, ((EntityHitResult)this.f_91077_).m_82443_());
break;
case BLOCK:
BlockHitResult blockhitresult = (BlockHitResult)this.f_91077_;
BlockPos blockpos = blockhitresult.m_82425_();
- if (!this.f_91073_.m_8055_(blockpos).m_60795_()) {
+ if (!this.f_91073_.m_46859_(blockpos)) {
this.f_91072_.m_105269_(blockpos, blockhitresult.m_82434_());
if (this.f_91073_.m_8055_(blockpos).m_60795_()) {
flag = true;
@@ -1568,8 +_,10 @@
}
@@ -1560,14 +_,20 @@
return false;
} else {
boolean flag = false;
- switch (this.f_91077_.m_6662_()) {
+ var inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.f_91066_.f_92096_, InteractionHand.MAIN_HAND);
+ HitResult.Type hitType = this.f_91077_.m_6662_();
+ if (this.f_91077_ instanceof EntityHitResult entityHit) { // Forge: Perform attack range checks here, instead of in GameRenderer#pick, so extended-reach interactions work.
+ if (!f_91074_.canHit(entityHit.m_82443_(), 0)) hitType = HitResult.Type.MISS; // No padding in client code.
+ }
+ if (!inputEvent.isCanceled())
+ switch(hitType) {
case ENTITY:
this.f_91072_.m_105223_(this.f_91074_, ((EntityHitResult)this.f_91077_).m_82443_());
break;
case BLOCK:
BlockHitResult blockhitresult = (BlockHitResult)this.f_91077_;
BlockPos blockpos = blockhitresult.m_82425_();
- if (!this.f_91073_.m_8055_(blockpos).m_60795_()) {
+ if (!this.f_91073_.m_46859_(blockpos)) {
this.f_91072_.m_105269_(blockpos, blockhitresult.m_82434_());
if (this.f_91073_.m_8055_(blockpos).m_60795_()) {
flag = true;
@@ -1580,8 +_,10 @@
}
this.f_91074_.m_36334_();
+ net.minecraftforge.common.ForgeHooks.onEmptyLeftClick(this.f_91074_);
this.f_91074_.m_36334_();
+ net.minecraftforge.common.ForgeHooks.onEmptyLeftClick(this.f_91074_);
}
+ if (inputEvent.shouldSwingHand())
this.f_91074_.m_6674_(InteractionHand.MAIN_HAND);
return flag;
}
+ if (inputEvent.shouldSwingHand())
this.f_91074_.m_6674_(InteractionHand.MAIN_HAND);
return flag;
}
@@ -1584,6 +_,11 @@
@@ -1597,6 +_,11 @@
}
for(InteractionHand interactionhand : InteractionHand.values()) {
@@ -296,13 +329,13 @@
+ return;
+ }
ItemStack itemstack = this.f_91074_.m_21120_(interactionhand);
if (this.f_91077_ != null) {
switch (this.f_91077_.m_6662_()) {
@@ -1594,13 +_,14 @@
if (!itemstack.m_246617_(this.f_91073_.m_246046_())) {
return;
@@ -1611,13 +_,14 @@
return;
}
+ if(!this.f_91074_.canInteractWith(entityhitresult.m_82443_(), 0)) return; //Forge: Entity may be traced via attack range, but the player may not have sufficient reach. No padding in client code.
+ if(!this.f_91074_.canInteractWith(entityhitresult.m_82443_(), 0)) break; //Forge: Entity may be traced via attack range, but the player may not have sufficient reach. No padding in client code.
InteractionResult interactionresult = this.f_91072_.m_105230_(this.f_91074_, entity, entityhitresult, interactionhand);
if (!interactionresult.m_19077_()) {
interactionresult = this.f_91072_.m_105226_(this.f_91074_, entity, interactionhand);
@@ -314,7 +347,7 @@
this.f_91074_.m_6674_(interactionhand);
}
@@ -1612,7 +_,7 @@
@@ -1629,7 +_,7 @@
int i = itemstack.m_41613_();
InteractionResult interactionresult1 = this.f_91072_.m_233732_(this.f_91074_, interactionhand, blockhitresult);
if (interactionresult1.m_19077_()) {
@@ -323,7 +356,7 @@
this.f_91074_.m_6674_(interactionhand);
if (!itemstack.m_41619_() && (itemstack.m_41613_() != i || this.f_91072_.m_105290_())) {
this.f_91063_.f_109055_.m_109320_(interactionhand);
@@ -1628,6 +_,9 @@
@@ -1645,6 +_,9 @@
}
}
@@ -333,7 +366,7 @@
if (!itemstack.m_41619_()) {
InteractionResult interactionresult2 = this.f_91072_.m_233721_(this.f_91074_, interactionhand);
if (interactionresult2.m_19077_()) {
@@ -1654,6 +_,8 @@
@@ -1671,6 +_,8 @@
--this.f_91011_;
}
@@ -342,7 +375,7 @@
this.f_91026_.m_6180_("gui");
this.f_240378_.m_240688_();
this.f_91065_.m_193832_(this.f_91012_);
@@ -1783,6 +_,8 @@
@@ -1800,6 +_,8 @@
this.f_91026_.m_6182_("keyboard");
this.f_91068_.m_90931_();
this.f_91026_.m_7238_();
@@ -351,7 +384,7 @@
}
private boolean m_91278_() {
@@ -1978,6 +_,7 @@
@@ -1996,6 +_,7 @@
}
public void m_91156_(ClientLevel p_91157_) {
@@ -359,7 +392,7 @@
ProgressScreen progressscreen = new ProgressScreen(true);
progressscreen.m_6309_(Component.m_237115_("connect.joining"));
this.m_91362_(progressscreen);
@@ -2011,10 +_,12 @@
@@ -2029,10 +_,12 @@
IntegratedServer integratedserver = this.f_91007_;
this.f_91007_ = null;
this.f_91063_.m_109150_();
@@ -372,15 +405,15 @@
if (integratedserver != null) {
this.f_91026_.m_6180_("waitForServer");
@@ -2029,6 +_,7 @@
@@ -2046,6 +_,7 @@
this.f_243981_.m_246151_();
this.f_91065_.m_93089_();
this.f_91008_ = null;
this.f_91010_ = false;
+ net.minecraftforge.client.ForgeHooksClient.handleClientLevelClosing(f_91073_);
this.f_91004_.m_90740_();
}
@@ -2124,6 +_,7 @@
@@ -2153,6 +_,7 @@
private void m_91280_() {
if (this.f_91077_ != null && this.f_91077_.m_6662_() != HitResult.Type.MISS) {
@@ -388,7 +421,7 @@
boolean flag = this.f_91074_.m_150110_().f_35937_;
BlockEntity blockentity = null;
HitResult.Type hitresult$type = this.f_91077_.m_6662_();
@@ -2136,10 +_,7 @@
@@ -2165,10 +_,7 @@
}
Block block = blockstate.m_60734_();
@@ -400,7 +433,7 @@
if (flag && Screen.m_96637_() && blockstate.m_155947_()) {
blockentity = this.f_91073_.m_7702_(blockpos);
@@ -2150,7 +_,7 @@
@@ -2179,7 +_,7 @@
}
Entity entity = ((EntityHitResult)this.f_91077_).m_82443_();
@@ -409,27 +442,7 @@
if (itemstack == null) {
return;
}
@@ -2688,8 +_,8 @@
return this.f_90993_;
}
- private static Pack m_167933_(String p_167934_, Component p_167935_, boolean p_167936_, Supplier<PackResources> p_167937_, PackMetadataSection p_167938_, Pack.Position p_167939_, PackSource p_167940_) {
- int i = p_167938_.m_10374_();
+ private static Pack createClientPackAdapter(String p_167934_, Component p_167935_, boolean p_167936_, Supplier<PackResources> p_167937_, PackMetadataSection p_167938_, Pack.Position p_167939_, PackSource p_167940_, boolean hidden) {
+ int i = p_167938_.getPackFormat(PackType.CLIENT_RESOURCES);
Supplier<PackResources> supplier = p_167937_;
if (i <= 3) {
supplier = m_91330_(p_167937_);
@@ -2699,7 +_,7 @@
supplier = m_91352_(supplier);
}
- return new Pack(p_167934_, p_167935_, p_167936_, supplier, p_167938_, PackType.CLIENT_RESOURCES, p_167939_, p_167940_);
+ return new Pack(p_167934_, p_167935_, p_167936_, supplier, p_167938_, PackType.CLIENT_RESOURCES, p_167939_, p_167940_, hidden);
}
private static Supplier<PackResources> m_91330_(Supplier<PackResources> p_91331_) {
@@ -2716,6 +_,19 @@
@@ -2721,6 +_,19 @@
public void m_91312_(int p_91313_) {
this.f_91051_.m_119410_(p_91313_);
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/Options.java
+++ b/net/minecraft/client/Options.java
@@ -539,7 +_,8 @@
@@ -507,7 +_,8 @@
}, new OptionInstance.LazyEnum<>(() -> {
return Stream.concat(Stream.of(""), Minecraft.m_91087_().m_91106_().m_194525_().stream()).toList();
}, (p_232011_) -> {
@@ -10,7 +10,7 @@
}, Codec.STRING), "", (p_231994_) -> {
SoundManager soundmanager = Minecraft.m_91087_().m_91106_();
soundmanager.m_194526_();
@@ -796,6 +_,7 @@
@@ -788,6 +_,7 @@
}
public Options(Minecraft p_92138_, File p_92139_) {
@@ -18,9 +18,9 @@
this.f_92060_ = p_92138_;
this.f_92110_ = new File(p_92139_, "options.txt");
boolean flag = p_92138_.m_91103_();
@@ -910,11 +_,20 @@
p_168428_.m_213982_("chatPreview", this.f_231796_);
p_168428_.m_213982_("onlyShowSecureChat", this.f_231798_);
@@ -904,11 +_,20 @@
p_168428_.m_213982_("panoramaScrollSpeed", this.f_244402_);
p_168428_.m_213982_("telemetryOptInExtra", this.f_260461_);
+ processOptionsForge(p_168428_);
+ }
@@ -41,7 +41,7 @@
}
}
@@ -935,6 +_,9 @@
@@ -927,6 +_,9 @@
}
public void m_92140_() {
@@ -51,7 +51,7 @@
try {
if (!this.f_92110_.exists()) {
return;
@@ -979,7 +_,8 @@
@@ -955,7 +_,8 @@
}
}
@@ -61,15 +61,15 @@
@Nullable
private String m_168458_(String p_168459_) {
return compoundtag1.m_128441_(p_168459_) ? compoundtag1.m_128461_(p_168459_) : null;
@@ -1082,6 +_,7 @@
@@ -1118,6 +_,7 @@
}
public void m_92169_() {
public void m_92172_() {
+ if (net.minecraftforge.client.loading.ClientModLoader.isLoading()) return; //Don't save settings before mods add keybindigns and the like to prevent them from being deleted.
try {
final PrintWriter printwriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(this.f_92110_), StandardCharsets.UTF_8));
if (this.f_92060_.f_91074_ != null) {
int i = 0;
@@ -1229,6 +_,23 @@
@@ -1182,6 +_,23 @@
}
p_92146_.m_10509_(set);
@@ -18,14 +18,16 @@
private final List<ItemStack> f_92261_;
private RecipeBookCategories(ItemStack... p_92267_) {
@@ -54,11 +_,15 @@
case SMOKER:
return f_92256_;
@@ -59,7 +_,7 @@
list = f_92256_;
break;
default:
- return ImmutableList.of();
- throw new IncompatibleClassChangeError();
+ return net.minecraftforge.client.RecipeBookManager.getCustomCategoriesOrEmpty(p_92270_);
}
}
return list;
@@ -67,5 +_,9 @@
public List<ItemStack> m_92268_() {
return this.f_92261_;
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/Screenshot.java
+++ b/net/minecraft/client/Screenshot.java
@@ -55,13 +_,23 @@
@@ -56,13 +_,23 @@
file2 = new File(file1, p_92307_);
}
@@ -19,7 +19,7 @@
}
public int m_92582_(BlockState p_92583_, Level p_92584_, BlockPos p_92585_) {
- BlockColor blockcolor = this.f_92571_.m_7942_(Registry.f_122824_.m_7447_(p_92583_.m_60734_()));
- BlockColor blockcolor = this.f_92571_.m_7942_(BuiltInRegistries.f_256975_.m_7447_(p_92583_.m_60734_()));
+ BlockColor blockcolor = this.f_92571_.get(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(p_92583_.m_60734_()));
if (blockcolor != null) {
return blockcolor.m_92566_(p_92583_, (BlockAndTintGetter)null, (BlockPos)null, 0);
@@ -28,7 +28,7 @@
}
public int m_92577_(BlockState p_92578_, @Nullable BlockAndTintGetter p_92579_, @Nullable BlockPos p_92580_, int p_92581_) {
- BlockColor blockcolor = this.f_92571_.m_7942_(Registry.f_122824_.m_7447_(p_92578_.m_60734_()));
- BlockColor blockcolor = this.f_92571_.m_7942_(BuiltInRegistries.f_256975_.m_7447_(p_92578_.m_60734_()));
+ BlockColor blockcolor = this.f_92571_.get(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(p_92578_.m_60734_()));
return blockcolor == null ? -1 : blockcolor.m_92566_(p_92578_, p_92579_, p_92580_, p_92581_);
}
@@ -37,7 +37,7 @@
+ @Deprecated
public void m_92589_(BlockColor p_92590_, Block... p_92591_) {
for(Block block : p_92591_) {
- this.f_92571_.m_122664_(p_92590_, Registry.f_122824_.m_7447_(block));
- this.f_92571_.m_122664_(p_92590_, BuiltInRegistries.f_256975_.m_7447_(block));
+ this.f_92571_.put(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(block), p_92590_);
}
@@ -19,7 +19,7 @@
}
public int m_92676_(ItemStack p_92677_, int p_92678_) {
- ItemColor itemcolor = this.f_92674_.m_7942_(Registry.f_122827_.m_7447_(p_92677_.m_41720_()));
- ItemColor itemcolor = this.f_92674_.m_7942_(BuiltInRegistries.f_257033_.m_7447_(p_92677_.m_41720_()));
+ ItemColor itemcolor = this.f_92674_.get(net.minecraftforge.registries.ForgeRegistries.ITEMS.getDelegateOrThrow(p_92677_.m_41720_()));
return itemcolor == null ? -1 : itemcolor.m_92671_(p_92677_, p_92678_);
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/Gui.java
+++ b/net/minecraft/client/gui/Gui.java
@@ -389,6 +_,7 @@
@@ -392,6 +_,7 @@
if (this.f_92986_.f_91076_ != null && this.f_92986_.f_91076_ instanceof LivingEntity && f >= 1.0F) {
flag = this.f_92986_.f_91074_.m_36333_() > 5.0F;
flag &= this.f_92986_.f_91076_.m_6084_();
@@ -8,7 +8,7 @@
}
int j = this.f_92978_ / 2 - 7 + 16;
@@ -441,6 +_,10 @@
@@ -444,6 +_,10 @@
for(MobEffectInstance mobeffectinstance : Ordering.natural().reverse().sortedCopy(collection)) {
MobEffect mobeffect = mobeffectinstance.m_19544_();
@@ -19,7 +19,7 @@
if (mobeffectinstance.m_19575_()) {
int i = this.f_92977_;
int j = 1;
@@ -469,6 +_,7 @@
@@ -472,6 +_,7 @@
}
}
@@ -27,7 +27,7 @@
TextureAtlasSprite textureatlassprite = mobeffecttexturemanager.m_118732_(mobeffect);
int l = i;
int i1 = j;
@@ -598,12 +_,13 @@
@@ -603,12 +_,13 @@
public void m_93069_(PoseStack p_93070_) {
this.f_92986_.m_91307_().m_6180_("selectedItemName");
if (this.f_92993_ > 0 && !this.f_92994_.m_41619_()) {
@@ -43,7 +43,7 @@
int j = (this.f_92977_ - i) / 2;
int k = this.f_92978_ - 59;
if (!this.f_92986_.f_91072_.m_105205_()) {
@@ -619,7 +_,13 @@
@@ -624,7 +_,13 @@
RenderSystem.m_69478_();
RenderSystem.m_69453_();
m_93172_(p_93070_, j - 2, k - 2, j + i + 2, k + 9 + 2, this.f_92986_.f_91066_.m_92143_(0));
@@ -58,7 +58,7 @@
RenderSystem.m_69461_();
}
}
@@ -1133,7 +_,7 @@
@@ -1138,7 +_,7 @@
ItemStack itemstack = this.f_92986_.f_91074_.m_150109_().m_36056_();
if (itemstack.m_41619_()) {
this.f_92993_ = 0;
@@ -6,5 +6,5 @@
if (!p_93294_ || mapdecoration.m_77809_()) {
+ if (mapdecoration.render(k)) { k++; continue; }
p_93292_.m_85836_();
p_93292_.m_85837_((double)(0.0F + (float)mapdecoration.m_77804_() / 2.0F + 64.0F), (double)(0.0F + (float)mapdecoration.m_77805_() / 2.0F + 64.0F), (double)-0.02F);
p_93292_.m_85845_(Vector3f.f_122227_.m_122240_((float)(mapdecoration.m_77806_() * 360) / 16.0F));
p_93292_.m_252880_(0.0F + (float)mapdecoration.m_77804_() / 2.0F + 64.0F, 0.0F + (float)mapdecoration.m_77805_() / 2.0F + 64.0F, -0.02F);
p_93292_.m_252781_(Axis.f_252403_.m_252977_((float)(mapdecoration.m_77806_() * 360) / 16.0F));
@@ -1,15 +1,15 @@
--- a/net/minecraft/client/gui/components/AbstractWidget.java
+++ b/net/minecraft/client/gui/components/AbstractWidget.java
@@ -85,7 +_,7 @@
this.m_93228_(p_93676_, this.f_93620_, this.f_93621_, 0, 46 + i * 20, this.f_93618_ / 2, this.f_93619_);
this.m_93228_(p_93676_, this.f_93620_ + this.f_93618_ / 2, this.f_93621_, 200 - this.f_93618_ / 2, 46 + i * 20, this.f_93618_ / 2, this.f_93619_);
@@ -130,7 +_,7 @@
this.m_93228_(p_93676_, this.m_252754_(), this.m_252907_(), 0, 46 + i * 20, this.f_93618_ / 2, this.f_93619_);
this.m_93228_(p_93676_, this.m_252754_() + this.f_93618_ / 2, this.m_252907_(), 200 - this.f_93618_ / 2, 46 + i * 20, this.f_93618_ / 2, this.f_93619_);
this.m_7906_(p_93676_, minecraft, p_93677_, p_93678_);
- int j = this.f_93623_ ? 16777215 : 10526880;
+ int j = getFGColor();
m_93215_(p_93676_, font, this.m_6035_(), this.f_93620_ + this.f_93618_ / 2, this.f_93621_ + (this.f_93619_ - 8) / 2, j | Mth.m_14167_(this.f_93625_ * 255.0F) << 24);
m_93215_(p_93676_, font, this.m_6035_(), this.m_252754_() + this.f_93618_ / 2, this.m_252907_() + (this.f_93619_ - 8) / 2, j | Mth.m_14167_(this.f_93625_ * 255.0F) << 24);
}
@@ -180,6 +_,10 @@
@@ -222,6 +_,10 @@
this.f_93618_ = p_93675_;
}
@@ -20,7 +20,7 @@
public void m_93650_(float p_93651_) {
this.f_93625_ = p_93651_;
}
@@ -202,6 +_,19 @@
@@ -244,6 +_,19 @@
protected void m_93692_(boolean p_93693_) {
this.f_93616_ = p_93693_;
@@ -3,7 +3,7 @@
@@ -409,6 +_,7 @@
list.add("");
list.add(ChatFormatting.UNDERLINE + "Targeted Entity");
list.add(String.valueOf((Object)Registry.f_122826_.m_7981_(entity.m_6095_())));
list.add(String.valueOf((Object)BuiltInRegistries.f_256780_.m_7981_(entity.m_6095_())));
+ entity.m_6095_().m_204041_().m_203616_().forEach(t -> list.add("#" + t.f_203868_()));
}
@@ -1,10 +0,0 @@
--- a/net/minecraft/client/gui/screens/DeathScreen.java
+++ b/net/minecraft/client/gui/screens/DeathScreen.java
@@ -36,6 +_,7 @@
})));
this.f_169295_.add(this.m_142416_(new Button(this.f_96543_ / 2 - 100, this.f_96544_ / 4 + 96, 200, 20, Component.m_237115_("deathScreen.titleScreen"), (p_95925_) -> {
if (this.f_95908_) {
+ m_95931_(true);
this.m_95934_();
} else {
ConfirmScreen confirmscreen = new ConfirmScreen(this::m_95931_, Component.m_237115_("deathScreen.quit.confirm"), CommonComponents.f_237098_, Component.m_237115_("deathScreen.titleScreen"), Component.m_237115_("deathScreen.respawn"));
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/LoadingOverlay.java
+++ b/net/minecraft/client/gui/screens/LoadingOverlay.java
@@ -119,6 +_,7 @@
@@ -121,6 +_,7 @@
int k1 = (int)((double)this.f_96163_.m_91268_().m_85446_() * 0.8325D);
float f6 = this.f_96164_.m_7750_();
this.f_96167_ = Mth.m_14036_(this.f_96167_ * 0.95F + f6 * 0.050000012F, 0.0F, 1.0F);
@@ -8,7 +8,7 @@
if (f < 1.0F) {
this.m_96182_(p_96178_, i / 2 - j1, k1 - 5, i / 2 + j1, k1 + 5, 1.0F - Mth.m_14036_(f, 0.0F, 1.0F));
}
@@ -128,6 +_,7 @@
@@ -130,6 +_,7 @@
}
if (this.f_96168_ == -1L && this.f_96164_.m_7746_() && (!this.f_96166_ || f1 >= 2.0F)) {
@@ -16,7 +16,7 @@
try {
this.f_96164_.m_7748_();
this.f_96165_.accept(Optional.empty());
@@ -135,7 +_,6 @@
@@ -137,7 +_,6 @@
this.f_96165_.accept(Optional.of(throwable));
}
@@ -13,7 +13,7 @@
} else {
@@ -47,9 +_,10 @@
if (screenconstructor == null) {
f_96195_.warn("Failed to create screen for menu type: {}", (Object)Registry.f_122863_.m_7981_(p_96202_));
f_96195_.warn("Failed to create screen for menu type: {}", (Object)BuiltInRegistries.f_256818_.m_7981_(p_96202_));
} else {
- screenconstructor.m_96209_(p_96205_, p_96202_, p_96203_, p_96204_);
+ return java.util.Optional.of(screenconstructor);
@@ -1,10 +1,9 @@
--- a/net/minecraft/client/gui/screens/OptionsScreen.java
+++ b/net/minecraft/client/gui/screens/OptionsScreen.java
@@ -140,4 +_,12 @@
m_93215_(p_96249_, this.f_96547_, this.f_96539_, this.f_96543_ / 2, 15, 16777215);
super.m_6305_(p_96249_, p_96250_, p_96251_, p_96252_);
@@ -168,6 +_,14 @@
super.m_86412_(p_96249_, p_96250_, p_96251_, p_96252_);
}
+
+ @Override
+ public void m_7379_() {
+ // We need to consider 2 potential parent screens here:
@@ -12,4 +11,7 @@
+ // 2. From the pause menu, in which case exit back to game
+ this.f_96541_.m_91152_(this.f_96235_ instanceof PauseScreen ? null : this.f_96235_);
+ }
}
+
private Button m_260993_(Component p_261565_, Supplier<Screen> p_262119_) {
return Button.m_253074_(p_261565_, (p_261361_) -> {
this.f_96541_.m_91152_(p_262119_.get());
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/Screen.java
+++ b/net/minecraft/client/gui/screens/Screen.java
@@ -126,7 +_,7 @@
@@ -143,7 +_,7 @@
}
public void m_7379_() {
@@ -8,8 +8,8 @@
+ this.f_96541_.popGuiLayer();
}
protected <T extends GuiEventListener & Widget & NarratableEntry> T m_142416_(T p_169406_) {
@@ -163,15 +_,29 @@
protected <T extends GuiEventListener & Renderable & NarratableEntry> T m_142416_(T p_169406_) {
@@ -180,15 +_,29 @@
this.f_169368_.clear();
}
@@ -40,16 +40,16 @@
- list.add(1, ClientTooltipComponent.m_169950_(p_169399_));
- });
+ List<ClientTooltipComponent> list = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(this.tooltipStack, p_169390_, p_169391_, p_169392_, f_96543_, f_96544_, this.tooltipFont, this.f_96547_);
this.m_169383_(p_169389_, list, p_169392_, p_169393_);
this.m_262809_(p_169389_, list, p_169392_, p_169393_, DefaultTooltipPositioner.f_262752_);
}
@@ -184,20 +_,44 @@
@@ -201,24 +_,48 @@
}
public void m_96597_(PoseStack p_96598_, List<Component> p_96599_, int p_96600_, int p_96601_) {
- this.m_96617_(p_96598_, Lists.transform(p_96599_, Component::m_7532_), p_96600_, p_96601_);
+ List<ClientTooltipComponent> components = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(this.tooltipStack, p_96599_, p_96600_, f_96543_, f_96544_, this.tooltipFont, this.f_96547_);
+ this.m_169383_(p_96598_, components, p_96600_, p_96601_);
+ this.m_262809_(p_96598_, components, p_96600_, p_96601_, DefaultTooltipPositioner.f_262752_);
+ }
+ public void renderComponentTooltip(PoseStack poseStack, List<? extends net.minecraft.network.chat.FormattedText> tooltips, int mouseX, int mouseY, ItemStack stack) {
+ this.renderComponentTooltip(poseStack, tooltips, mouseX, mouseY, null, stack);
@@ -62,13 +62,13 @@
+ this.tooltipFont = font;
+ this.tooltipStack = stack;
+ List<ClientTooltipComponent> components = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(stack, tooltips, mouseX, f_96543_, f_96544_, this.tooltipFont, this.f_96547_);
+ this.m_169383_(poseStack, components, mouseX, mouseY);
+ this.m_262809_(poseStack, components, mouseX, mouseY, DefaultTooltipPositioner.f_262752_);
+ this.tooltipFont = null;
+ this.tooltipStack = ItemStack.f_41583_;
}
public void m_96617_(PoseStack p_96618_, List<? extends FormattedCharSequence> p_96619_, int p_96620_, int p_96621_) {
this.m_169383_(p_96618_, p_96619_.stream().map(ClientTooltipComponent::m_169948_).collect(Collectors.toList()), p_96620_, p_96621_);
this.m_262809_(p_96618_, p_96619_.stream().map(ClientTooltipComponent::m_169948_).collect(Collectors.toList()), p_96620_, p_96621_, DefaultTooltipPositioner.f_262752_);
}
+ public void renderTooltip(PoseStack poseStack, List<? extends FormattedCharSequence> lines, int x, int y, Font font) {
@@ -77,81 +77,68 @@
+ this.tooltipFont = null;
+ }
+
private void m_169383_(PoseStack p_169384_, List<ClientTooltipComponent> p_169385_, int p_169386_, int p_169387_) {
if (!p_169385_.isEmpty()) {
+ net.minecraftforge.client.event.RenderTooltipEvent.Pre preEvent = net.minecraftforge.client.ForgeHooksClient.onRenderTooltipPre(this.tooltipStack, p_169384_, p_169386_, p_169387_, f_96543_, f_96544_, p_169385_, this.tooltipFont, this.f_96547_);
private void m_262835_(PoseStack p_263080_, Screen.DeferredTooltipRendering p_262968_, int p_263034_, int p_263076_) {
this.m_262809_(p_263080_, p_262968_.f_262736_().stream().map(ClientTooltipComponent::m_169948_).collect(Collectors.toList()), p_263034_, p_263076_, p_262968_.f_262758_());
}
private void m_262809_(PoseStack p_263064_, List<ClientTooltipComponent> p_262990_, int p_263065_, int p_262996_, ClientTooltipPositioner p_262920_) {
if (!p_262990_.isEmpty()) {
+ net.minecraftforge.client.event.RenderTooltipEvent.Pre preEvent = net.minecraftforge.client.ForgeHooksClient.onRenderTooltipPre(this.tooltipStack, p_263064_, p_263065_, p_262996_, f_96543_, f_96544_, p_262990_, this.tooltipFont, this.f_96547_);
+ if (preEvent.isCanceled()) return;
int i = 0;
int j = p_169385_.size() == 1 ? -2 : 0;
int j = p_262990_.size() == 1 ? -2 : 0;
for(ClientTooltipComponent clienttooltipcomponent : p_169385_) {
for(ClientTooltipComponent clienttooltipcomponent : p_262990_) {
- int k = clienttooltipcomponent.m_142069_(this.f_96547_);
+ int k = clienttooltipcomponent.m_142069_(preEvent.getFont());
if (k > i) {
i = k;
}
@@ -205,8 +_,8 @@
@@ -226,8 +_,8 @@
j += clienttooltipcomponent.m_142103_();
}
- int j2 = p_169386_ + 12;
- int k2 = p_169387_ - 12;
+ int j2 = preEvent.getX() + 12;
+ int k2 = preEvent.getY() - 12;
if (j2 + i > this.f_96543_) {
j2 -= 28 + i;
}
@@ -227,15 +_,16 @@
- int k1 = p_263065_ + 12;
- int l1 = p_262996_ - 12;
+ int k1 = preEvent.getX() + 12;
+ int l1 = preEvent.getY() - 12;
Vector2ic vector2ic = p_262920_.m_262814_(this, k1, l1, i, j);
k1 = vector2ic.x();
l1 = vector2ic.y();
@@ -240,6 +_,8 @@
RenderSystem.m_157427_(GameRenderer::m_172811_);
bufferbuilder.m_166779_(VertexFormat.Mode.QUADS, DefaultVertexFormat.f_85815_);
Matrix4f matrix4f = p_169384_.m_85850_().m_85861_();
- m_93123_(matrix4f, bufferbuilder, j2 - 3, k2 - 4, j2 + i + 3, k2 - 3, 400, -267386864, -267386864);
- m_93123_(matrix4f, bufferbuilder, j2 - 3, k2 + j + 3, j2 + i + 3, k2 + j + 4, 400, -267386864, -267386864);
- m_93123_(matrix4f, bufferbuilder, j2 - 3, k2 - 3, j2 + i + 3, k2 + j + 3, 400, -267386864, -267386864);
- m_93123_(matrix4f, bufferbuilder, j2 - 4, k2 - 3, j2 - 3, k2 + j + 3, 400, -267386864, -267386864);
- m_93123_(matrix4f, bufferbuilder, j2 + i + 3, k2 - 3, j2 + i + 4, k2 + j + 3, 400, -267386864, -267386864);
- m_93123_(matrix4f, bufferbuilder, j2 - 3, k2 - 3 + 1, j2 - 3 + 1, k2 + j + 3 - 1, 400, 1347420415, 1344798847);
- m_93123_(matrix4f, bufferbuilder, j2 + i + 2, k2 - 3 + 1, j2 + i + 3, k2 + j + 3 - 1, 400, 1347420415, 1344798847);
- m_93123_(matrix4f, bufferbuilder, j2 - 3, k2 - 3, j2 + i + 3, k2 - 3 + 1, 400, 1347420415, 1347420415);
- m_93123_(matrix4f, bufferbuilder, j2 - 3, k2 + j + 2, j2 + i + 3, k2 + j + 3, 400, 1344798847, 1344798847);
+ net.minecraftforge.client.event.RenderTooltipEvent.Color colorEvent = net.minecraftforge.client.ForgeHooksClient.onRenderTooltipColor(this.tooltipStack, p_169384_, j2, k2, preEvent.getFont(), p_169385_);
+ m_93123_(matrix4f, bufferbuilder, j2 - 3, k2 - 4, j2 + i + 3, k2 - 3, 400, colorEvent.getBackgroundStart(), colorEvent.getBackgroundStart());
+ m_93123_(matrix4f, bufferbuilder, j2 - 3, k2 + j + 3, j2 + i + 3, k2 + j + 4, 400, colorEvent.getBackgroundEnd(), colorEvent.getBackgroundEnd());
+ m_93123_(matrix4f, bufferbuilder, j2 - 3, k2 - 3, j2 + i + 3, k2 + j + 3, 400, colorEvent.getBackgroundStart(), colorEvent.getBackgroundEnd());
+ m_93123_(matrix4f, bufferbuilder, j2 - 4, k2 - 3, j2 - 3, k2 + j + 3, 400, colorEvent.getBackgroundStart(), colorEvent.getBackgroundEnd());
+ m_93123_(matrix4f, bufferbuilder, j2 + i + 3, k2 - 3, j2 + i + 4, k2 + j + 3, 400, colorEvent.getBackgroundStart(), colorEvent.getBackgroundEnd());
+ m_93123_(matrix4f, bufferbuilder, j2 - 3, k2 - 3 + 1, j2 - 3 + 1, k2 + j + 3 - 1, 400, colorEvent.getBorderStart(), colorEvent.getBorderEnd());
+ m_93123_(matrix4f, bufferbuilder, j2 + i + 2, k2 - 3 + 1, j2 + i + 3, k2 + j + 3 - 1, 400, colorEvent.getBorderStart(), colorEvent.getBorderEnd());
+ m_93123_(matrix4f, bufferbuilder, j2 - 3, k2 - 3, j2 + i + 3, k2 - 3 + 1, 400, colorEvent.getBorderStart(), colorEvent.getBorderStart());
+ m_93123_(matrix4f, bufferbuilder, j2 - 3, k2 + j + 2, j2 + i + 3, k2 + j + 3, 400, colorEvent.getBorderEnd(), colorEvent.getBorderEnd());
RenderSystem.m_69482_();
RenderSystem.m_69472_();
RenderSystem.m_69478_();
@@ -249,7 +_,7 @@
Matrix4f matrix4f = p_263064_.m_85850_().m_252922_();
+ // TODO 1.19.3: Tooltip rendering changed, rethink the color event.
+ // net.minecraftforge.client.event.RenderTooltipEvent.Color colorEvent = net.minecraftforge.client.ForgeHooksClient.onRenderTooltipColor(this.tooltipStack, p_263064_, k1, l1, preEvent.getFont(), p_262990_);
TooltipRenderUtil.m_262796_((p_262872_, p_262873_, p_262874_, p_262875_, p_262876_, p_262877_, p_262878_, p_262879_, p_262880_) -> {
GuiComponent.m_93123_(p_262872_, p_262873_, p_262874_, p_262875_, p_262876_, p_262877_, p_262878_, p_262879_, p_262880_);
}, matrix4f, bufferbuilder, k1, l1, i, j, 400);
@@ -256,7 +_,7 @@
for(int i2 = 0; i2 < p_169385_.size(); ++i2) {
ClientTooltipComponent clienttooltipcomponent1 = p_169385_.get(i2);
- clienttooltipcomponent1.m_142440_(this.f_96547_, j2, l1, matrix4f, multibuffersource$buffersource);
+ clienttooltipcomponent1.m_142440_(preEvent.getFont(), j2, l1, matrix4f, multibuffersource$buffersource);
l1 += clienttooltipcomponent1.m_142103_() + (i2 == 0 ? 2 : 0);
for(int j1 = 0; j1 < p_262990_.size(); ++j1) {
ClientTooltipComponent clienttooltipcomponent1 = p_262990_.get(j1);
- clienttooltipcomponent1.m_142440_(this.f_96547_, k1, i1, matrix4f, multibuffersource$buffersource);
+ clienttooltipcomponent1.m_142440_(preEvent.getFont(), k1, i1, matrix4f, multibuffersource$buffersource);
i1 += clienttooltipcomponent1.m_142103_() + (j1 == 0 ? 2 : 0);
}
@@ -259,7 +_,7 @@
@@ -266,7 +_,7 @@
for(int l2 = 0; l2 < p_169385_.size(); ++l2) {
ClientTooltipComponent clienttooltipcomponent2 = p_169385_.get(l2);
- clienttooltipcomponent2.m_183452_(this.f_96547_, j2, l1, p_169384_, this.f_96542_, 400);
+ clienttooltipcomponent2.m_183452_(preEvent.getFont(), j2, l1, p_169384_, this.f_96542_, 400);
l1 += clienttooltipcomponent2.m_142103_() + (l2 == 0 ? 2 : 0);
for(int i2 = 0; i2 < p_262990_.size(); ++i2) {
ClientTooltipComponent clienttooltipcomponent2 = p_262990_.get(i2);
- clienttooltipcomponent2.m_183452_(this.f_96547_, k1, i1, p_263064_, this.f_96542_, 400);
+ clienttooltipcomponent2.m_183452_(preEvent.getFont(), k1, i1, p_263064_, this.f_96542_, 400);
i1 += clienttooltipcomponent2.m_142103_() + (i2 == 0 ? 2 : 0);
}
@@ -361,9 +_,19 @@
@@ -368,9 +_,19 @@
this.f_96547_ = p_96607_.f_91062_;
this.f_96543_ = p_96608_;
this.f_96544_ = p_96609_;
+ java.util.function.Consumer<GuiEventListener> add = (b) -> {
+ if (b instanceof Widget w)
+ this.f_169369_.add(w);
+ if (b instanceof Renderable r)
+ this.f_169369_.add(r);
+ if (b instanceof NarratableEntry ne)
+ this.f_169368_.add(ne);
+ f_96540_.add(b);
@@ -165,7 +152,7 @@
}
protected void m_232761_() {
@@ -392,6 +_,7 @@
@@ -399,6 +_,7 @@
public void m_96558_(PoseStack p_96559_, int p_96560_) {
if (this.f_96541_.f_91073_ != null) {
this.m_93179_(p_96559_, 0, 0, this.f_96543_, this.f_96544_, -1072689136, -804253680);
@@ -173,7 +160,7 @@
} else {
this.m_96626_(p_96560_);
}
@@ -411,6 +_,7 @@
@@ -418,6 +_,7 @@
bufferbuilder.m_5483_((double)this.f_96543_, 0.0D, 0.0D).m_7421_((float)this.f_96543_ / 32.0F, (float)p_96627_).m_6122_(64, 64, 64, 255).m_5752_();
bufferbuilder.m_5483_(0.0D, 0.0D, 0.0D).m_7421_(0.0F, (float)p_96627_).m_6122_(64, 64, 64, 255).m_5752_();
tesselator.m_85914_();
@@ -181,7 +168,7 @@
}
public boolean m_7043_() {
@@ -496,6 +_,10 @@
@@ -503,6 +_,10 @@
}
public void m_7400_(List<Path> p_96591_) {
@@ -8,7 +8,7 @@
public TitleScreen() {
this(false);
@@ -112,11 +_,16 @@
@@ -112,11 +_,15 @@
int j = this.f_96543_ - i - 2;
int k = 24;
int l = this.f_96544_ / 4 + 48;
@@ -17,32 +17,31 @@
this.m_96772_(l, 24);
} else {
this.m_96763_(l, 24);
+ modButton = this.m_142416_(new Button(this.f_96543_ / 2 - 100, l + 24 * 2, 98, 20, Component.m_237115_("fml.menu.mods"), button -> {
+ this.f_96541_.m_91152_(new net.minecraftforge.client.gui.ModListScreen(this));
+ }));
+ modButton = this.m_142416_(Button.m_253074_(Component.m_237115_("fml.menu.mods"), button -> this.f_96541_.m_91152_(new net.minecraftforge.client.gui.ModListScreen(this)))
+ .m_252794_(this.f_96543_ / 2 - 100, l + 24 * 2).m_253046_(98, 20).m_253136_());
}
+ modUpdateNotification = net.minecraftforge.client.gui.TitleScreenModUpdateIndicator.init(this, modButton);
this.m_142416_(new ImageButton(this.f_96543_ / 2 - 124, l + 72 + 12, 20, 20, 0, 106, 20, Button.f_93617_, 256, 256, (p_96791_) -> {
this.f_96541_.m_91152_(new LanguageSelectScreen(this, this.f_96541_.f_91066_, this.f_96541_.m_91102_()));
@@ -167,7 +_,7 @@
Screen screen = (Screen)(this.f_96541_.f_91066_.f_92083_ ? new JoinMultiplayerScreen(this) : new SafetyScreen(this));
this.f_96541_.m_91152_(screen);
}, button$ontooltip))).f_93623_ = flag;
- (this.m_142416_(new Button(this.f_96543_ / 2 - 100, p_96764_ + p_96765_ * 2, 200, 20, Component.m_237115_("menu.online"), (p_210872_) -> {
+ (this.m_142416_(new Button(this.f_96543_ / 2 + 2, p_96764_ + p_96765_ * 2, 98, 20, Component.m_237115_("menu.online"), (p_96771_) -> {
@@ -161,7 +_,7 @@
}).m_252987_(this.f_96543_ / 2 - 100, p_96764_ + p_96765_ * 1, 200, 20).m_257505_(tooltip).m_253136_())).f_93623_ = flag;
(this.m_142416_(Button.m_253074_(Component.m_237115_("menu.online"), (p_210872_) -> {
this.m_96793_();
}, button$ontooltip))).f_93623_ = flag;
- }).m_252987_(this.f_96543_ / 2 - 100, p_96764_ + p_96765_ * 2, 200, 20).m_257505_(tooltip).m_253136_())).f_93623_ = flag;
+ }).m_252987_(this.f_96543_ / 2 + 2, p_96764_ + p_96765_ * 2, 98, 20).m_257505_(tooltip).m_253136_())).f_93623_ = flag;
}
@@ -310,6 +_,7 @@
@Nullable
@@ -267,6 +_,7 @@
this.f_232768_.m_232790_(p_96739_, l);
}
+ net.minecraftforge.client.ForgeHooksClient.renderMainMenu(this, p_96739_, this.f_96547_, this.f_96543_, this.f_96544_, l);
if (this.f_96721_ != null) {
p_96739_.m_85836_();
p_96739_.m_85837_((double)(this.f_96543_ / 2 + 90), 70.0D, 0.0D);
@@ -332,7 +_,14 @@
p_96739_.m_252880_((float)(this.f_96543_ / 2 + 90), 70.0F, 0.0F);
@@ -289,7 +_,14 @@
s = s + I18n.m_118938_("menu.modded");
}
@@ -58,11 +57,11 @@
for(GuiEventListener guieventlistener : this.m_6702_()) {
if (guieventlistener instanceof AbstractWidget) {
@@ -345,6 +_,7 @@
@@ -302,6 +_,7 @@
RenderSystem.m_69482_();
this.f_96726_.m_6305_(p_96739_, p_96740_, p_96741_, p_96742_);
this.f_96726_.m_86412_(p_96739_, p_96740_, p_96741_, p_96742_);
}
+ if (f1 >= 1.0f) modUpdateNotification.m_6305_(p_96739_, p_96740_, p_96741_, p_96742_);
+ if (f1 >= 1.0f) modUpdateNotification.m_86412_(p_96739_, p_96740_, p_96741_, p_96742_);
}
}
@@ -8,7 +8,7 @@
public AdvancementsScreen(ClientAdvancements p_97340_) {
super(GameNarrator.f_93310_);
@@ -57,7 +_,13 @@
@@ -57,7 +_,15 @@
} else {
this.f_97334_.m_104401_(this.f_97336_ == null ? null : this.f_97336_.m_97182_(), true);
}
@@ -16,8 +16,10 @@
+ if (this.f_97335_.size() > AdvancementTabType.MAX_TABS) {
+ int guiLeft = (this.f_96543_ - 252) / 2;
+ int guiTop = (this.f_96544_ - 140) / 2;
+ m_142416_(new net.minecraft.client.gui.components.Button(guiLeft, guiTop - 50, 20, 20, Component.m_237113_("<"), b -> tabPage = Math.max(tabPage - 1, 0 )));
+ m_142416_(new net.minecraft.client.gui.components.Button(guiLeft + 252 - 20, guiTop - 50, 20, 20, Component.m_237113_(">"), b -> tabPage = Math.min(tabPage + 1, maxPages)));
+ m_142416_(net.minecraft.client.gui.components.Button.m_253074_(Component.m_237113_("<"), b -> tabPage = Math.max(tabPage - 1, 0 ))
+ .m_252794_(guiLeft, guiTop - 50).m_253046_(20, 20).m_253136_());
+ m_142416_(net.minecraft.client.gui.components.Button.m_253074_(Component.m_237113_(">"), b -> tabPage = Math.min(tabPage + 1, maxPages))
+ .m_252794_(guiLeft + f_169556_ - 20, guiTop - 50).m_253046_(20, 20).m_253136_());
+ maxPages = this.f_97335_.size() / AdvancementTabType.MAX_TABS;
+ }
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/controls/KeyBindsList.java
+++ b/net/minecraft/client/gui/screens/controls/KeyBindsList.java
@@ -51,7 +_,7 @@
@@ -50,7 +_,7 @@
}
protected int m_5756_() {
@@ -9,34 +9,30 @@
}
public int m_5759_() {
@@ -107,7 +_,7 @@
KeyEntry(final KeyMapping p_193916_, final Component p_193917_) {
this.f_193910_ = p_193916_;
@@ -108,10 +_,11 @@
this.f_193911_ = p_193917_;
- this.f_193912_ = new Button(0, 0, 75, 20, p_193917_, (p_193939_) -> {
+ this.f_193912_ = new Button(0, 0, 75 + 20 /* Forge: Add space */, 20, p_193917_, (p_193939_) -> {
this.f_193912_ = Button.m_253074_(p_193917_, (p_193939_) -> {
KeyBindsList.this.f_193858_.f_193975_ = p_193916_;
}) {
protected MutableComponent m_5646_() {
@@ -115,6 +_,7 @@
}
};
this.f_193913_ = new Button(0, 0, 50, 20, Component.m_237115_("controls.reset"), (p_193935_) -> {
- }).m_252987_(0, 0, 75, 20).m_252778_((p_253311_) -> {
+ }).m_252987_(0, 0, 75 + 20 /* Forge: Add space */, 20).m_252778_((p_253311_) -> {
return p_193916_.m_90862_() ? Component.m_237110_("narrator.controls.unbound", p_193917_) : Component.m_237110_("narrator.controls.bound", p_193917_, p_253311_.get());
}).m_253136_();
this.f_193913_ = Button.m_253074_(Component.m_237115_("controls.reset"), (p_193935_) -> {
+ this.f_193910_.setToDefault();
KeyBindsList.this.f_93386_.f_91066_.m_92159_(p_193916_, p_193916_.m_90861_());
KeyMapping.m_90854_();
}) {
@@ -128,7 +_,7 @@
}).m_252987_(0, 0, 50, 20).m_252778_((p_253313_) -> {
@@ -123,7 +_,7 @@
boolean flag = KeyBindsList.this.f_193858_.f_193975_ == this.f_193910_;
float f = (float)(p_193926_ + 90 - KeyBindsList.this.f_193859_);
KeyBindsList.this.f_93386_.f_91062_.m_92889_(p_193923_, this.f_193911_, f, (float)(p_193925_ + p_193928_ / 2 - 9 / 2), 16777215);
- this.f_193913_.f_93620_ = p_193926_ + 190;
+ this.f_193913_.f_93620_ = p_193926_ + 190 + 20;
this.f_193913_.f_93621_ = p_193925_;
- this.f_193913_.m_252865_(p_193926_ + 190);
+ this.f_193913_.m_252865_(p_193926_ + 190 + 20);
this.f_193913_.m_252888_(p_193925_);
this.f_193913_.f_93623_ = !this.f_193910_.m_90864_();
this.f_193913_.m_6305_(p_193923_, p_193929_, p_193930_, p_193932_);
@@ -136,11 +_,12 @@
this.f_193912_.f_93621_ = p_193925_;
this.f_193913_.m_86412_(p_193923_, p_193929_, p_193930_, p_193932_);
@@ -131,11 +_,12 @@
this.f_193912_.m_252888_(p_193925_);
this.f_193912_.m_93666_(this.f_193910_.m_90863_());
boolean flag1 = false;
+ boolean keyCodeModifierConflict = true; // gracefully handle conflicts like SHIFT vs SHIFT+G
@@ -49,7 +45,7 @@
}
}
}
@@ -148,7 +_,7 @@
@@ -143,7 +_,7 @@
if (flag) {
this.f_193912_.m_93666_(Component.m_237113_("> ").m_7220_(this.f_193912_.m_6035_().m_6881_().m_130940_(ChatFormatting.YELLOW)).m_130946_(" <").m_130940_(ChatFormatting.YELLOW));
} else if (flag1) {
@@ -57,4 +53,4 @@
+ this.f_193912_.m_93666_(this.f_193912_.m_6035_().m_6881_().m_130940_(keyCodeModifierConflict ? ChatFormatting.GOLD : ChatFormatting.RED));
}
this.f_193912_.m_6305_(p_193923_, p_193929_, p_193930_, p_193932_);
this.f_193912_.m_86412_(p_193923_, p_193929_, p_193930_, p_193932_);
@@ -2,7 +2,7 @@
+++ b/net/minecraft/client/gui/screens/controls/KeyBindsScreen.java
@@ -31,7 +_,7 @@
this.m_7787_(this.f_193977_);
this.f_193978_ = this.m_142416_(new Button(this.f_96543_ / 2 - 155, this.f_96544_ - 29, 150, 20, Component.m_237115_("controls.resetAll"), (p_193999_) -> {
this.f_193978_ = this.m_142416_(Button.m_253074_(Component.m_237115_("controls.resetAll"), (p_193999_) -> {
for(KeyMapping keymapping : this.f_96282_.f_92059_) {
- keymapping.m_90848_(keymapping.m_90861_());
+ keymapping.setToDefault();
@@ -1,14 +1,14 @@
--- a/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java
@@ -90,6 +_,7 @@
@@ -89,6 +_,7 @@
int i = this.f_97735_;
int j = this.f_97736_;
this.m_7286_(p_97795_, p_97798_, p_97796_, p_97797_);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ContainerScreenEvent.Render.Background(this, p_97795_, p_97796_, p_97797_));
RenderSystem.m_69465_();
super.m_6305_(p_97795_, p_97796_, p_97797_, p_97798_);
super.m_86412_(p_97795_, p_97796_, p_97797_, p_97798_);
PoseStack posestack = RenderSystem.m_157191_();
@@ -111,11 +_,12 @@
@@ -110,11 +_,12 @@
this.f_97734_ = slot;
int l = slot.f_40220_;
int i1 = slot.f_40221_;
@@ -22,7 +22,7 @@
ItemStack itemstack = this.f_97711_.m_41619_() ? this.f_97732_.m_142621_() : this.f_97711_;
if (!itemstack.m_41619_()) {
int l1 = 8;
@@ -155,9 +_,13 @@
@@ -154,9 +_,13 @@
}
public static void m_169606_(PoseStack p_169607_, int p_169608_, int p_169609_, int p_169610_) {
@@ -37,7 +37,7 @@
RenderSystem.m_69444_(true, true, true, true);
RenderSystem.m_69482_();
}
@@ -175,8 +_,10 @@
@@ -174,8 +_,10 @@
RenderSystem.m_157182_();
this.m_93250_(200);
this.f_96542_.f_115093_ = 200.0F;
@@ -49,7 +49,7 @@
this.m_93250_(0);
this.f_96542_.f_115093_ = 0.0F;
}
@@ -286,7 +_,8 @@
@@ -285,7 +_,8 @@
if (super.m_6375_(p_97748_, p_97749_, p_97750_)) {
return true;
} else {
@@ -59,7 +59,7 @@
Slot slot = this.m_97744_(p_97748_, p_97749_);
long i = Util.m_137550_();
this.f_97723_ = this.f_97709_ == slot && i - this.f_97721_ < 250L && this.f_97722_ == p_97750_;
@@ -297,6 +_,7 @@
@@ -296,6 +_,7 @@
int j = this.f_97735_;
int k = this.f_97736_;
boolean flag1 = this.m_7467_(p_97748_, p_97749_, j, k, p_97750_);
@@ -67,7 +67,7 @@
int l = -1;
if (slot != null) {
l = slot.f_40219_;
@@ -322,7 +_,7 @@
@@ -321,7 +_,7 @@
}
} else if (!this.f_97738_) {
if (this.f_97732_.m_142621_().m_41619_()) {
@@ -76,7 +76,7 @@
this.m_6597_(slot, l, p_97750_, ClickType.CLONE);
} else {
boolean flag2 = l != -999 && (InputConstants.m_84830_(Minecraft.m_91087_().m_91268_().m_85439_(), 340) || InputConstants.m_84830_(Minecraft.m_91087_().m_91268_().m_85439_(), 344));
@@ -346,7 +_,7 @@
@@ -345,7 +_,7 @@
this.f_97717_ = 0;
} else if (p_97750_ == 1) {
this.f_97717_ = 1;
@@ -85,7 +85,7 @@
this.f_97717_ = 2;
}
}
@@ -415,10 +_,13 @@
@@ -414,10 +_,13 @@
}
public boolean m_6348_(double p_97812_, double p_97813_, int p_97814_) {
@@ -99,7 +99,7 @@
int k = -1;
if (slot != null) {
k = slot.f_40219_;
@@ -432,7 +_,7 @@
@@ -431,7 +_,7 @@
if (m_96638_()) {
if (!this.f_97724_.m_41619_()) {
for(Slot slot2 : this.f_97732_.f_38839_) {
@@ -108,7 +108,7 @@
this.m_6597_(slot2, slot2.f_40219_, p_97814_, ClickType.QUICK_MOVE);
}
}
@@ -495,7 +_,7 @@
@@ -494,7 +_,7 @@
this.m_6597_((Slot)null, -999, AbstractContainerMenu.m_38930_(2, this.f_97717_), ClickType.QUICK_CRAFT);
} else if (!this.f_97732_.m_142621_().m_41619_()) {
@@ -117,7 +117,7 @@
this.m_6597_(slot, k, p_97814_, ClickType.CLONE);
} else {
boolean flag1 = k != -999 && (InputConstants.m_84830_(Minecraft.m_91087_().m_91268_().m_85439_(), 340) || InputConstants.m_84830_(Minecraft.m_91087_().m_91268_().m_85439_(), 344));
@@ -542,34 +_,39 @@
@@ -541,34 +_,39 @@
}
public boolean m_7933_(int p_97765_, int p_97766_, int p_97767_) {
@@ -164,7 +164,7 @@
this.m_6597_(this.f_97734_, this.f_97734_.f_40219_, i, ClickType.SWAP);
return true;
}
@@ -604,6 +_,18 @@
@@ -603,6 +_,18 @@
public T m_6262_() {
return this.f_97732_;
@@ -1,257 +1,271 @@
--- a/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java
@@ -72,6 +_,8 @@
private Slot f_98512_;
private CreativeInventoryListener f_98513_;
private boolean f_98514_;
+ private static int tabPage = 0;
+ private int maxPages = 0;
@@ -75,6 +_,8 @@
private boolean f_98515_;
private final Set<TagKey<Item>> f_98516_ = new HashSet<>();
private final boolean f_256872_;
+ 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<>());
@@ -231,6 +_,12 @@
public CreativeModeInventoryScreen(Player p_259788_, FeatureFlagSet p_260074_, boolean p_259569_) {
super(new CreativeModeInventoryScreen.ItemPickerMenu(p_259788_), p_259788_.m_150109_(), CommonComponents.f_237098_);
@@ -109,7 +_,7 @@
private void m_257687_(Collection<ItemStack> p_261591_) {
int i = this.f_97732_.m_257485_(this.f_98508_);
(this.f_97732_).f_98639_.clear();
- if (f_98507_.m_257962_() == CreativeModeTab.Type.SEARCH) {
+ if (f_98507_.hasSearchBar()) {
this.m_98630_();
} else {
(this.f_97732_).f_98639_.addAll(p_261591_);
@@ -273,6 +_,30 @@
protected void m_7856_() {
if (this.f_96541_.f_91072_.m_105290_()) {
super.m_7856_();
+ int tabCount = CreativeModeTab.f_40748_.length;
+ if (tabCount > 12) {
+ m_142416_(new net.minecraft.client.gui.components.Button(f_97735_, f_97736_ - 50, 20, 20, Component.m_237113_("<"), b -> tabPage = Math.max(tabPage - 1, 0 )));
+ m_142416_(new net.minecraft.client.gui.components.Button(f_97735_ + f_97726_ - 20, f_97736_ - 50, 20, 20, Component.m_237113_(">"), b -> tabPage = Math.min(tabPage + 1, maxPages)));
+ maxPages = (int) Math.ceil((tabCount - 12) / 10D);
+ this.pages.clear();
+ int tabIndex = 0;
+ List<CreativeModeTab> currentPage = new java.util.ArrayList<>();
+ for (CreativeModeTab sortedCreativeModeTab : net.minecraftforge.common.CreativeModeTabRegistry.getSortedCreativeModeTabs()) {
+ currentPage.add(sortedCreativeModeTab);
+ tabIndex++;
+ if (tabIndex == 10) {
+ this.pages.add(new net.minecraftforge.client.gui.CreativeTabsScreenPage(currentPage));
+ currentPage = new java.util.ArrayList<>();
+ tabIndex = 0;
+ }
+ }
+ if (tabIndex != 0) {
+ this.pages.add(new net.minecraftforge.client.gui.CreativeTabsScreenPage(currentPage));
+ }
+ if (this.pages.isEmpty()) {
+ this.currentPage = new net.minecraftforge.client.gui.CreativeTabsScreenPage(new java.util.ArrayList<>());
+ } else {
+ this.currentPage = this.pages.get(0);
+ }
+ if (this.pages.size() > 1) {
+ m_142416_(net.minecraft.client.gui.components.Button.m_253074_(Component.m_237113_("<"), b -> setCurrentPage(this.pages.get(Math.max(this.pages.indexOf(this.currentPage) - 1, 0)))).m_252794_(f_97735_, f_97736_ - 50).m_253046_(20, 20).m_253136_());
+ m_142416_(net.minecraft.client.gui.components.Button.m_253074_(Component.m_237113_(">"), b -> setCurrentPage(this.pages.get(Math.min(this.pages.indexOf(this.currentPage) + 1, this.pages.size() - 1)))).m_252794_(f_97735_ + f_97726_ - 20, f_97736_ - 50).m_253046_(20, 20).m_253136_());
+ }
this.f_96541_.f_91068_.m_90926_(true);
this.f_98510_ = new EditBox(this.f_96547_, this.f_97735_ + 82, this.f_97736_ + 6, 80, 9, Component.m_237115_("itemGroup.search"));
this.f_98510_.m_94199_(50);
@@ -272,7 +_,7 @@
this.f_98510_.m_94182_(false);
@@ -318,7 +_,7 @@
public boolean m_5534_(char p_98521_, int p_98522_) {
if (this.f_98514_) {
return false;
- } else if (f_98507_ != CreativeModeTab.f_40754_.m_40775_()) {
+ } else if (!CreativeModeTab.f_40748_[f_98507_].hasSearchBar()) {
- } else if (f_98507_.m_257962_() != CreativeModeTab.Type.SEARCH) {
+ } else if (!f_98507_.hasSearchBar()) {
return false;
} else {
String s = this.f_98510_.m_94155_();
@@ -290,7 +_,7 @@
@@ -336,7 +_,7 @@
public boolean m_7933_(int p_98547_, int p_98548_, int p_98549_) {
this.f_98514_ = false;
- if (f_98507_ != CreativeModeTab.f_40754_.m_40775_()) {
+ if (!CreativeModeTab.f_40748_[f_98507_].hasSearchBar()) {
- if (f_98507_.m_257962_() != CreativeModeTab.Type.SEARCH) {
+ if (!f_98507_.hasSearchBar()) {
if (this.f_96541_.f_91066_.f_92098_.m_90832_(p_98547_, p_98548_)) {
this.f_98514_ = true;
this.m_98560_(CreativeModeTab.f_40754_);
@@ -327,6 +_,32 @@
this.m_98560_(CreativeModeTabs.m_258007_());
@@ -371,6 +_,7 @@
}
private void m_98630_() {
+ if (!f_98507_.hasSearchBar()) return;
(this.f_97732_).f_98639_.clear();
this.f_98516_.clear();
+
+ CreativeModeTab tab = CreativeModeTab.f_40748_[f_98507_];
+ if (tab.hasSearchBar() && tab != CreativeModeTab.f_40754_) {
+ tab.m_6151_(f_97732_.f_98639_);
+ if (!this.f_98510_.m_94155_().isEmpty()) {
+ //TODO: Make this a SearchTree not a manual search
+ String search = this.f_98510_.m_94155_().toLowerCase(Locale.ROOT);
+ java.util.Iterator<ItemStack> itr = f_97732_.f_98639_.iterator();
+ while (itr.hasNext()) {
+ ItemStack stack = itr.next();
+ boolean matches = false;
+ for (Component line : stack.m_41651_(this.f_96541_.f_91074_, this.f_96541_.f_91066_.f_92125_ ? TooltipFlag.Default.ADVANCED : TooltipFlag.Default.NORMAL)) {
+ if (ChatFormatting.m_126649_(line.getString()).toLowerCase(Locale.ROOT).contains(search)) {
+ matches = true;
+ break;
+ }
+ }
+ if (!matches)
+ itr.remove();
+ }
+ }
+ this.f_98508_ = 0.0F;
+ f_97732_.m_98642_(0.0F);
+ return;
+ }
+
String s = this.f_98510_.m_94155_();
if (s.isEmpty()) {
for(Item item : Registry.f_122827_) {
@@ -371,9 +_,9 @@
@@ -380,10 +_,10 @@
SearchTree<ItemStack> searchtree;
if (s.startsWith("#")) {
s = s.substring(1);
- searchtree = this.f_96541_.m_231372_(SearchRegistry.f_119942_);
+ searchtree = this.f_96541_.m_231372_(net.minecraftforge.client.CreativeModeTabSearchRegistry.getNameSearchKey(f_98507_));
this.m_98619_(s);
} else {
- searchtree = this.f_96541_.m_231372_(SearchRegistry.f_119941_);
+ searchtree = this.f_96541_.m_231372_(net.minecraftforge.client.CreativeModeTabSearchRegistry.getTagSearchKey(f_98507_));
}
(this.f_97732_).f_98639_.addAll(searchtree.m_6293_(s.toLowerCase(Locale.ROOT)));
@@ -416,7 +_,7 @@
protected void m_7027_(PoseStack p_98616_, int p_98617_, int p_98618_) {
CreativeModeTab creativemodetab = CreativeModeTab.f_40748_[f_98507_];
- if (creativemodetab.m_40789_()) {
+ if (creativemodetab != null && creativemodetab.m_40789_()) {
if (f_98507_.m_40789_()) {
RenderSystem.m_69461_();
- this.f_96547_.m_92889_(p_98616_, creativemodetab.m_40786_(), 8.0F, 6.0F, 4210752);
+ this.f_96547_.m_92889_(p_98616_, creativemodetab.m_40786_(), 8.0F, 6.0F, creativemodetab.getLabelColor());
- this.f_96547_.m_92889_(p_98616_, f_98507_.m_40786_(), 8.0F, 6.0F, 4210752);
+ this.f_96547_.m_92889_(p_98616_, f_98507_.m_40786_(), 8.0F, 6.0F, f_98507_.getLabelColor());
}
}
@@ -384,7 +_,7 @@
@@ -426,7 +_,7 @@
double d0 = p_98531_ - (double)this.f_97735_;
double d1 = p_98532_ - (double)this.f_97736_;
for(CreativeModeTab creativemodetab : CreativeModeTab.f_40748_) {
- if (this.m_98562_(creativemodetab, d0, d1)) {
+ if (creativemodetab != null && this.m_98562_(creativemodetab, d0, d1)) {
- for(CreativeModeTab creativemodetab : CreativeModeTabs.m_257388_()) {
+ for(CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) {
if (this.m_98562_(creativemodetab, d0, d1)) {
return true;
}
}
@@ -405,7 +_,7 @@
@@ -447,7 +_,7 @@
double d1 = p_98623_ - (double)this.f_97736_;
this.f_98509_ = false;
for(CreativeModeTab creativemodetab : CreativeModeTab.f_40748_) {
- if (this.m_98562_(creativemodetab, d0, d1)) {
+ if (creativemodetab != null && this.m_98562_(creativemodetab, d0, d1)) {
- for(CreativeModeTab creativemodetab : CreativeModeTabs.m_257388_()) {
+ for(CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) {
if (this.m_98562_(creativemodetab, d0, d1)) {
this.m_98560_(creativemodetab);
return true;
}
@@ -416,12 +_,15 @@
}
private boolean m_98631_() {
+ if (CreativeModeTab.f_40748_[f_98507_] == null) return false;
return f_98507_ != CreativeModeTab.f_40761_.m_40775_() && CreativeModeTab.f_40748_[f_98507_].m_40791_() && this.f_97732_.m_98654_();
}
@@ -465,6 +_,7 @@
private void m_98560_(CreativeModeTab p_98561_) {
+ if (p_98561_ == null) return;
int i = f_98507_;
f_98507_ = p_98561_.m_40775_();
CreativeModeTab creativemodetab = f_98507_;
f_98507_ = p_98561_;
+ slotColor = p_98561_.getSlotColor();
this.f_97737_.clear();
(this.f_97732_).f_98639_.clear();
this.m_238391_();
@@ -499,13 +_,15 @@
@@ -541,13 +_,15 @@
this.f_98511_ = null;
}
if (this.f_98510_ != null) {
- if (p_98561_ == CreativeModeTab.f_40754_) {
+ if (p_98561_.hasSearchBar()) {
this.f_98510_.m_94194_(true);
this.f_98510_.m_94190_(false);
this.f_98510_.m_94178_(true);
if (i != p_98561_.m_40775_()) {
this.f_98510_.m_94144_("");
}
+ this.f_98510_.m_93674_(p_98561_.getSearchbarWidth());
+ this.f_98510_.f_93620_ = this.f_97735_ + (82 /*default left*/ + 89 /*default width*/) - this.f_98510_.m_5711_();
- if (f_98507_.m_257962_() == CreativeModeTab.Type.SEARCH) {
+ if (f_98507_.hasSearchBar()) {
this.f_98510_.m_94194_(true);
this.f_98510_.m_94190_(false);
this.f_98510_.m_94178_(true);
if (creativemodetab != p_98561_) {
this.f_98510_.m_94144_("");
}
+ this.f_98510_.m_93674_(f_98507_.getSearchBarWidth());
+ this.f_98510_.m_252865_(this.f_97735_ + (82 /*default left*/ + 89 /*default width*/) - this.f_98510_.m_5711_());
this.m_98630_();
} else {
@@ -565,16 +_,34 @@
this.m_98630_();
} else {
@@ -604,7 +_,7 @@
this.m_7333_(p_98577_);
super.m_6305_(p_98577_, p_98578_, p_98579_, p_98580_);
super.m_86412_(p_98577_, p_98578_, p_98579_, p_98580_);
- for(CreativeModeTab creativemodetab : CreativeModeTab.f_40748_) {
- if (this.m_98584_(p_98577_, creativemodetab, p_98578_, p_98579_)) {
+ int start = tabPage * 10;
+ int end = Math.min(CreativeModeTab.f_40748_.length, ((tabPage + 1) * 10) + 2);
+ if (tabPage != 0) start += 2;
+ boolean rendered = false;
+
+ for (int x = start; x < end; x++) {
+ CreativeModeTab creativemodetab = CreativeModeTab.f_40748_[x];
+ if (creativemodetab != null && this.m_98584_(p_98577_, creativemodetab, p_98578_, p_98579_)) {
+ rendered = true;
- for(CreativeModeTab creativemodetab : CreativeModeTabs.m_257388_()) {
+ for(CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) {
if (this.m_98584_(p_98577_, creativemodetab, p_98578_, p_98579_)) {
break;
}
}
+ if (!rendered && !this.m_98584_(p_98577_, CreativeModeTab.f_40754_, p_98578_, p_98579_))
+ this.m_98584_(p_98577_, CreativeModeTab.f_40761_, p_98578_, p_98579_);
if (this.f_98512_ != null && f_98507_ == CreativeModeTab.f_40761_.m_40775_() && this.m_6774_(this.f_98512_.f_40220_, this.f_98512_.f_40221_, 16, 16, (double)p_98578_, (double)p_98579_)) {
@@ -614,6 +_,15 @@
this.m_96602_(p_98577_, f_98506_, p_98578_, p_98579_);
}
+ if (maxPages != 0) {
+ Component page = Component.m_237113_(String.format("%d / %d", tabPage + 1, maxPages + 1));
+ this.m_93250_(300);
+ this.f_96542_.f_115093_ = 300.0F;
+ f_96547_.m_92744_(p_98577_, page.m_7532_(), f_97735_ + (f_97726_ / 2) - (f_96547_.m_92852_(page) / 2), f_97736_ - 44, -1);
+ this.m_93250_(0);
+ this.f_96542_.f_115093_ = 0.0F;
+ if (this.pages.size() != 1) {
+ Component page = Component.m_237113_(String.format("%d / %d", this.pages.indexOf(this.currentPage) + 1, this.pages.size()));
+ this.m_93250_(300);
+ this.f_96542_.f_115093_ = 300.0F;
+ f_96547_.m_92744_(p_98577_, page.m_7532_(), f_97735_ + (f_97726_ / 2f) - (f_96547_.m_92852_(page) / 2f), f_97736_ - 44, -1);
+ this.m_93250_(0);
+ this.f_96542_.f_115093_ = 0.0F;
+ }
+
RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, 1.0F);
this.m_7025_(p_98577_, p_98578_, p_98579_);
}
@@ -609,7 +_,7 @@
list1.add(1, creativemodetab.m_40786_().m_6881_().m_130940_(ChatFormatting.BLUE));
}
@@ -621,7 +_,7 @@
protected void m_6057_(PoseStack p_98590_, ItemStack p_98591_, int p_98592_, int p_98593_) {
boolean flag = this.f_97734_ != null && this.f_97734_ instanceof CreativeModeInventoryScreen.CustomCreativeSlot;
boolean flag1 = f_98507_.m_257962_() == CreativeModeTab.Type.CATEGORY;
- boolean flag2 = f_98507_.m_257962_() == CreativeModeTab.Type.SEARCH;
+ boolean flag2 = f_98507_.hasSearchBar();
TooltipFlag.Default tooltipflag$default = this.f_96541_.f_91066_.f_92125_ ? TooltipFlag.Default.f_256730_ : TooltipFlag.Default.f_256752_;
TooltipFlag tooltipflag = flag ? tooltipflag$default.m_257777_() : tooltipflag$default;
List<Component> list = p_98591_.m_41651_(this.f_96541_.f_91074_, tooltipflag);
@@ -641,8 +_,8 @@
- this.m_169388_(p_98590_, list1, p_98591_.m_150921_(), p_98592_, p_98593_);
+ this.renderTooltip(p_98590_, list1, p_98591_.m_150921_(), p_98592_, p_98593_, p_98591_);
} else {
super.m_6057_(p_98590_, p_98591_, p_98592_, p_98593_);
}
@@ -620,16 +_,32 @@
int i = 1;
- for(CreativeModeTab creativemodetab : CreativeModeTabs.m_257388_()) {
- if (creativemodetab.m_257962_() != CreativeModeTab.Type.SEARCH && creativemodetab.m_257694_(p_98591_)) {
+ for(CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) {
+ if (!creativemodetab.hasSearchBar() && creativemodetab.m_257694_(p_98591_)) {
list1.add(i++, creativemodetab.m_40786_().m_6881_().m_130940_(ChatFormatting.BLUE));
}
}
@@ -654,7 +_,7 @@
protected void m_7286_(PoseStack p_98572_, float p_98573_, int p_98574_, int p_98575_) {
RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, 1.0F);
CreativeModeTab creativemodetab = CreativeModeTab.f_40748_[f_98507_];
- for(CreativeModeTab creativemodetab1 : CreativeModeTab.f_40748_) {
+ int start = tabPage * 10;
+ int end = Math.min(CreativeModeTab.f_40748_.length, ((tabPage + 1) * 10 + 2));
+ if (tabPage != 0) start += 2;
+
+ for (int idx = start; idx < end; idx++) {
- for(CreativeModeTab creativemodetab : CreativeModeTabs.m_257388_()) {
+ for(CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) {
RenderSystem.m_157427_(GameRenderer::m_172817_);
- RenderSystem.m_157456_(0, f_98504_);
- if (creativemodetab1.m_40775_() != f_98507_) {
+ CreativeModeTab creativemodetab1 = CreativeModeTab.f_40748_[idx];
+ if (creativemodetab1 != null && creativemodetab1.m_40775_() != f_98507_) {
+ RenderSystem.m_157456_(0, creativemodetab1.getTabsImage());
this.m_98581_(p_98572_, creativemodetab1);
}
RenderSystem.m_157456_(0, f_98504_);
if (creativemodetab != f_98507_) {
@@ -663,7 +_,7 @@
}
RenderSystem.m_157427_(GameRenderer::m_172817_);
- RenderSystem.m_157456_(0, new ResourceLocation("textures/gui/container/creative_inventory/tab_" + creativemodetab.m_40788_()));
+ if (tabPage != 0) {
+ if (creativemodetab != CreativeModeTab.f_40754_) {
+ RenderSystem.m_157456_(0, CreativeModeTab.f_40754_.getTabsImage());
+ m_98581_(p_98572_, CreativeModeTab.f_40754_);
+ }
+ if (creativemodetab != CreativeModeTab.f_40761_) {
+ RenderSystem.m_157456_(0, CreativeModeTab.f_40761_.getTabsImage());
+ m_98581_(p_98572_, CreativeModeTab.f_40761_);
+ }
+ }
+
+ RenderSystem.m_157456_(0, creativemodetab.getBackgroundImage());
- RenderSystem.m_157456_(0, new ResourceLocation("textures/gui/container/creative_inventory/tab_" + f_98507_.m_40788_()));
+ RenderSystem.m_157456_(0, f_98507_.getBackgroundLocation());
this.m_93228_(p_98572_, this.f_97735_, this.f_97736_, 0, 0, this.f_97726_, this.f_97727_);
this.f_98510_.m_6305_(p_98572_, p_98574_, p_98575_, p_98573_);
this.f_98510_.m_86412_(p_98572_, p_98574_, p_98575_, p_98573_);
RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, 1.0F);
@@ -637,11 +_,14 @@
int j = this.f_97736_ + 18;
int k = j + 112;
@@ -671,7 +_,7 @@
int k = this.f_97736_ + 18;
int i = k + 112;
RenderSystem.m_157427_(GameRenderer::m_172817_);
- RenderSystem.m_157456_(0, f_98504_);
+ RenderSystem.m_157456_(0, creativemodetab.getTabsImage());
if (creativemodetab.m_40791_()) {
this.m_93228_(p_98572_, i, j + (int)((float)(k - j - 17) * this.f_98508_), 232 + (this.m_98631_() ? 0 : 12), 0, 12, 15);
+ RenderSystem.m_157456_(0, f_98507_.getTabsImage());
if (f_98507_.m_40791_()) {
this.m_93228_(p_98572_, j, k + (int)((float)(i - k - 17) * this.f_98508_), 232 + (this.m_98631_() ? 0 : 12), 0, 12, 15);
}
+ if ((creativemodetab == null || creativemodetab.getTabPage() != tabPage) && (creativemodetab != CreativeModeTab.f_40754_ && creativemodetab != CreativeModeTab.f_40761_))
+ return;
+
this.m_98581_(p_98572_, creativemodetab);
if (creativemodetab == CreativeModeTab.f_40761_) {
InventoryScreen.m_98850_(this.f_97735_ + 88, this.f_97736_ + 45, 20, (float)(this.f_97735_ + 88 - p_98574_), (float)(this.f_97736_ + 45 - 30 - p_98575_), this.f_96541_.f_91074_);
@@ -650,6 +_,7 @@
@@ -684,7 +_,7 @@
}
protected boolean m_98562_(CreativeModeTab p_98563_, double p_98564_, double p_98565_) {
+ if (p_98563_.getTabPage() != tabPage && p_98563_ != CreativeModeTab.f_40754_ && p_98563_ != CreativeModeTab.f_40761_) return false;
int i = p_98563_.m_40793_();
int j = 28 * i;
private int m_258094_(CreativeModeTab p_260136_) {
- int i = p_260136_.m_257903_();
+ int i = currentPage.getColumn(p_260136_);
int j = 27;
int k = 27 * i;
if (p_260136_.m_6563_()) {
@@ -696,7 +_,7 @@
private int m_257995_(CreativeModeTab p_260181_) {
int i = 0;
- if (p_260181_.m_258064_() == CreativeModeTab.Row.TOP) {
+ if (currentPage.isTop(p_260181_)) {
i -= 32;
} else {
i += this.f_97727_;
@@ -724,8 +_,8 @@
protected void m_98581_(PoseStack p_98582_, CreativeModeTab p_98583_) {
boolean flag = p_98583_ == f_98507_;
- boolean flag1 = p_98583_.m_258064_() == CreativeModeTab.Row.TOP;
- int i = p_98583_.m_257903_();
+ boolean flag1 = currentPage.isTop(p_98583_);
+ int i = currentPage.getColumn(p_98583_);
int j = i * 26;
int k = 0;
@@ -718,6 +_,7 @@
int l = this.f_97735_ + this.m_258094_(p_98583_);
@@ -742,6 +_,7 @@
i1 += this.f_97727_ - 4;
}
+ RenderSystem.m_69478_(); //Forge: Make sure blend is enabled else tabs show a white border.
this.m_93228_(p_98582_, l, i1, j, k, 28, 32);
this.m_93228_(p_98582_, l, i1, j, k, 26, 32);
this.f_96542_.f_115093_ = 100.0F;
l += 6;
@@ -909,6 +_,22 @@
l += 5;
@@ -784,6 +_,15 @@
}
+ public net.minecraftforge.client.gui.CreativeTabsScreenPage getCurrentPage() {
+ return currentPage;
+ }
+
+ public void setCurrentPage(net.minecraftforge.client.gui.CreativeTabsScreenPage currentPage) {
+ this.currentPage = currentPage;
+ this.m_98560_(currentPage.getDefaultTab());
+ }
+
@OnlyIn(Dist.CLIENT)
static class CustomCreativeSlot extends Slot {
public CustomCreativeSlot(Container p_98633_, int p_98634_, int p_98635_, int p_98636_) {
@@ -947,6 +_,22 @@
public boolean m_8010_(Player p_98665_) {
return this.f_98655_.m_8010_(p_98665_);
@@ -30,7 +30,7 @@
+ }
MobEffect mobeffect = mobeffectinstance.m_19544_();
TextureAtlasSprite textureatlassprite = mobeffecttexturemanager.m_118732_(mobeffect);
RenderSystem.m_157456_(0, textureatlassprite.m_118414_().m_118330_());
RenderSystem.m_157456_(0, textureatlassprite.m_247685_());
@@ -108,6 +_,11 @@
int i = this.f_97736_;
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java
@@ -150,7 +_,7 @@
@@ -147,7 +_,7 @@
int i2 = 86 - this.f_96547_.m_92895_(s);
FormattedText formattedtext = EnchantmentNames.m_98734_().m_98737_(this.f_96547_, i2);
int j2 = 6839882;
@@ -9,7 +9,7 @@
this.m_93228_(p_98762_, j1, j + 14 + 19 * i1, 0, 185, 108, 19);
this.m_93228_(p_98762_, j1 + 1, j + 15 + 19 * i1, 16 * i1, 239, 16, 16);
this.f_96547_.m_92857_(formattedtext, k1, j + 16 + 19 * i1, i2, (j2 & 16711422) >> 1);
@@ -189,10 +_,13 @@
@@ -186,10 +_,13 @@
Enchantment enchantment = Enchantment.m_44697_((this.f_97732_).f_39447_[j]);
int l = (this.f_97732_).f_39448_[j];
int i1 = j + 1;
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/inventory/InventoryScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/InventoryScreen.java
@@ -100,6 +_,11 @@
@@ -99,6 +_,11 @@
public static void m_98850_(int p_98851_, int p_98852_, int p_98853_, float p_98854_, float p_98855_, LivingEntity p_98856_) {
float f = (float)Math.atan((double)(p_98854_ / 40.0F));
float f1 = (float)Math.atan((double)(p_98855_ / 40.0F));
@@ -11,4 +11,4 @@
+ float f1 = angleYComponent;
PoseStack posestack = RenderSystem.m_157191_();
posestack.m_85836_();
posestack.m_85837_((double)p_98851_, (double)p_98852_, 1050.0D);
posestack.m_252880_((float)p_98851_, (float)p_98852_, 1050.0F);
@@ -9,7 +9,7 @@
+ PoseStack posestack = new PoseStack();
+ posestack.m_85837_(0.0D, 0.0D, (f_96542_.f_115093_ + 200.0F));
+ net.minecraft.client.renderer.MultiBufferSource.BufferSource bufferSource = net.minecraft.client.renderer.MultiBufferSource.m_109898_(com.mojang.blaze3d.vertex.Tesselator.m_85913_().m_85915_());
+ f_96547_.m_92811_(String.valueOf(p_99164_.m_41613_()), (p_99166_ + 14) + 19 - 2 - f_96547_.m_92895_(String.valueOf(p_99164_.m_41613_())), p_99167_ + 6 + 3, 0xFFFFFF, true, posestack.m_85850_().m_85861_(), bufferSource, false, 0, 15728880);
+ f_96547_.m_252905_(String.valueOf(p_99164_.m_41613_()), (p_99166_ + 14) + 19 - 2 - f_96547_.m_92895_(String.valueOf(p_99164_.m_41613_())), p_99167_ + 6 + 3, 0xFFFFFF, true, posestack.m_85850_().m_252922_(), bufferSource, false, 0, 15728880);
+ bufferSource.m_109911_();
RenderSystem.m_157427_(GameRenderer::m_172817_);
RenderSystem.m_157456_(0, f_99113_);
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java
+++ b/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java
@@ -263,6 +_,11 @@
@@ -259,6 +_,11 @@
}
@@ -1,9 +1,9 @@
--- a/net/minecraft/client/gui/screens/packs/PackSelectionScreen.java
+++ b/net/minecraft/client/gui/screens/packs/PackSelectionScreen.java
@@ -137,7 +_,7 @@
@@ -130,7 +_,7 @@
private void m_100013_(TransferableSelectionList p_100014_, Stream<PackSelectionModel.Entry> p_100015_) {
p_100014_.m_6702_().clear();
p_100014_.m_6987_((TransferableSelectionList.PackEntry)null);
- p_100015_.forEach((p_170000_) -> {
+ p_100015_.filter(PackSelectionModel.Entry::notHidden).forEach((p_170000_) -> {
p_100014_.m_6702_().add(new TransferableSelectionList.PackEntry(this.f_96541_, p_100014_, this, p_170000_));
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java
+++ b/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java
@@ -106,7 +_,7 @@
@@ -108,7 +_,7 @@
this.m_5674_();
this.f_100279_.clear();
@@ -9,7 +9,7 @@
this.f_100279_.add(new RecipeBookTabButton(recipebookcategories));
}
@@ -318,7 +_,7 @@
@@ -305,7 +_,7 @@
}
if (itemstack != null && this.f_100272_.f_91080_ != null) {
@@ -1,39 +1,40 @@
--- a/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
+++ b/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
@@ -112,7 +_,7 @@
@@ -113,7 +_,8 @@
public static void m_232896_(Minecraft p_232897_, @Nullable Screen p_232898_) {
m_232899_(p_232897_, f_232866_);
PackRepository packrepository = new PackRepository(PackType.SERVER_DATA, new ServerPacksSource());
- WorldLoader.InitConfig worldloader$initconfig = m_232872_(packrepository, DataPackConfig.f_45842_);
+ WorldLoader.InitConfig worldloader$initconfig = m_232872_(packrepository, new DataPackConfig(ImmutableList.of("vanilla"), ImmutableList.of())); // FORGE: Load vanilla fallback with vanilla datapacks.
CompletableFuture<WorldCreationContext> completablefuture = WorldLoader.m_214362_(worldloader$initconfig, (p_232935_, p_232936_) -> {
RegistryAccess.Frozen registryaccess$frozen = RegistryAccess.m_206197_().m_203557_();
WorldGenSettings worldgensettings = WorldPresets.m_226449_(registryaccess$frozen);
@@ -122,7 +_,10 @@
return new WorldCreationContext(p_232884_, Lifecycle.stable(), p_232883_, p_232882_);
PackRepository packrepository = new PackRepository(new ServerPacksSource());
- WorldLoader.InitConfig worldloader$initconfig = m_245574_(packrepository, WorldDataConfiguration.f_244649_);
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.event.AddPackFindersEvent(net.minecraft.server.packs.PackType.SERVER_DATA, packrepository::addPackFinder));
+ WorldLoader.InitConfig worldloader$initconfig = m_245574_(packrepository, new WorldDataConfiguration(new DataPackConfig(ImmutableList.of("vanilla"), ImmutableList.of()), FeatureFlags.f_244332_)); // FORGE: Load vanilla fallback with vanilla datapacks.
CompletableFuture<WorldCreationContext> completablefuture = WorldLoader.m_214362_(worldloader$initconfig, (p_247792_) -> {
return new WorldLoader.DataLoadOutput<>(new CreateWorldScreen.DataPackReloadCookie(new WorldGenSettings(WorldOptions.m_247394_(), WorldPresets.m_246552_(p_247792_.f_244104_())), p_247792_.f_244127_()), p_247792_.f_243759_());
}, (p_247798_, p_247799_, p_247800_, p_247801_) -> {
@@ -121,7 +_,10 @@
return new WorldCreationContext(p_247801_.f_243966_(), p_247800_, p_247799_, p_247801_.f_243979_());
}, Util.m_183991_(), p_232897_);
p_232897_.m_18701_(completablefuture::isDone);
- p_232897_.m_91152_(new CreateWorldScreen(p_232898_, DataPackConfig.f_45842_, new WorldGenSettingsComponent(completablefuture.join(), Optional.of(WorldPresets.f_226437_), OptionalLong.empty())));
- p_232897_.m_91152_(new CreateWorldScreen(p_232898_, WorldDataConfiguration.f_244649_, new WorldGenSettingsComponent(completablefuture.join(), Optional.of(WorldPresets.f_226437_), OptionalLong.empty())));
+ // FORGE: Force load mods' datapacks after setting screen and ensure datapack selection reverts to vanilla if invalid.
+ CreateWorldScreen createWorldScreen = new CreateWorldScreen(p_232898_, new DataPackConfig(ImmutableList.of("vanilla"), ImmutableList.of()), new WorldGenSettingsComponent(completablefuture.join(), Optional.of(WorldPresets.f_226437_), OptionalLong.empty()));
+ CreateWorldScreen createWorldScreen = new CreateWorldScreen(p_232898_, new WorldDataConfiguration(new DataPackConfig(ImmutableList.of("vanilla"), ImmutableList.of()), FeatureFlags.f_244332_), new WorldGenSettingsComponent(completablefuture.join(), Optional.of(WorldPresets.f_226437_), OptionalLong.empty()));
+ p_232897_.m_91152_(createWorldScreen);
+ createWorldScreen.m_100878_(packrepository);
}
public static CreateWorldScreen m_205426_(@Nullable Screen p_205427_, WorldStem p_205428_, @Nullable Path p_205429_) {
@@ -478,7 +_,7 @@
if (p_232949_) {
this.m_100975_();
} else {
- this.f_100846_ = DataPackConfig.f_45842_;
+ this.f_100846_ = new DataPackConfig(ImmutableList.of("vanilla"), ImmutableList.of()); // FORGE: Revert to *actual* vanilla data
this.f_96541_.m_91152_(this);
}
public static CreateWorldScreen m_247077_(@Nullable Screen p_249522_, LevelSettings p_249091_, WorldCreationContext p_249742_, @Nullable Path p_252076_) {
@@ -491,7 +_,7 @@
if (p_232949_) {
this.m_100975_();
} else {
- this.f_244371_ = WorldDataConfiguration.f_244649_;
+ this.f_244371_ = new WorldDataConfiguration(new DataPackConfig(ImmutableList.of("vanilla"), ImmutableList.of()), FeatureFlags.f_244332_); // FORGE: Revert to *actual* vanilla data
this.f_96541_.m_91152_(this);
}
@@ -653,6 +_,7 @@
File file1 = path.toFile();
@@ -612,6 +_,7 @@
if (path != null) {
if (this.f_100832_ == null) {
this.f_100832_ = new PackRepository(PackType.SERVER_DATA, new ServerPacksSource(), new FolderRepositorySource(file1, PackSource.f_10527_));
this.f_100832_ = ServerPacksSource.m_245786_(path);
+ net.minecraftforge.resource.ResourcePackLoader.loadResourcePacks(this.f_100832_, net.minecraftforge.server.ServerLifecycleHooks::buildPackFinder);
this.f_100832_.m_10506_();
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java
+++ b/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java
@@ -132,13 +_,23 @@
@@ -158,13 +_,23 @@
}
private void m_233145_(Screen p_233146_, String p_233147_, boolean p_233148_, boolean p_233149_) {
@@ -12,7 +12,7 @@
+ private void doLoadLevel(Screen p_233146_, String p_233147_, boolean p_233148_, boolean p_233149_, boolean confirmExperimentalWarning) {
LevelStorageSource.LevelStorageAccess levelstoragesource$levelstorageaccess = this.m_233155_(p_233147_);
if (levelstoragesource$levelstorageaccess != null) {
PackRepository packrepository = m_233105_(levelstoragesource$levelstorageaccess);
PackRepository packrepository = ServerPacksSource.m_247728_(levelstoragesource$levelstorageaccess);
WorldStem worldstem;
try {
@@ -22,20 +22,20 @@
+ pld.withConfirmedWarning(true);
+ }
} catch (Exception exception) {
f_233088_.warn("Failed to load datapacks, can't proceed with server load", (Throwable)exception);
f_233088_.warn("Failed to load level data or datapacks, can't proceed with server load", (Throwable)exception);
this.f_233089_.m_91152_(new DatapackLoadFailureScreen(() -> {
@@ -151,7 +_,9 @@
@@ -177,7 +_,9 @@
WorldData worlddata = worldstem.f_206895_();
boolean flag = worlddata.m_5961_().m_64670_();
boolean flag = worlddata.m_246337_().m_247070_();
boolean flag1 = worlddata.m_5754_() != Lifecycle.stable();
- if (!p_233149_ || !flag && !flag1) {
+ // Forge: Skip confirmation if it has been done already for this world
+ boolean skipConfirmation = worlddata instanceof PrimaryLevelData pld && pld.hasConfirmedExperimentalWarning();
+ if (skipConfirmation || !p_233149_ || !flag && !flag1) {
this.f_233089_.m_91100_().m_235003_(levelstoragesource$levelstorageaccess).thenApply((p_233177_) -> {
this.f_233089_.m_247489_().m_247400_(levelstoragesource$levelstorageaccess).thenApply((p_233177_) -> {
return true;
}).exceptionallyComposeAsync((p_233183_) -> {
@@ -173,9 +_,11 @@
@@ -199,9 +_,11 @@
return null;
});
} else {
@@ -16,7 +16,7 @@
if (this.f_101693_.f_91066_.m_231828_().m_231551_() || p_101729_) {
RenderSystem.m_157456_(0, WorldSelectionList.f_101648_);
GuiComponent.m_93172_(p_101721_, p_101724_, p_101723_, p_101724_ + 32, p_101723_ + 32, -1601138544);
@@ -646,6 +_,21 @@
@@ -560,6 +_,21 @@
public boolean m_214209_() {
return !this.f_101695_.m_164916_();
@@ -24,7 +24,7 @@
+
+ // FORGE: Patch in experimental warning icon for worlds in the world selection screen
+ private void renderExperimentalWarning(PoseStack stack, int mouseX, int mouseY, int top, int left) {
+ if (this.f_101695_.isExperimental()) {
+ if (this.f_101695_.isLifecycleExperimental()) {
+ int leftStart = left + WorldSelectionList.this.m_5759_();
+ RenderSystem.m_157456_(0, WorldSelectionList.FORGE_EXPERIMENTAL_WARNING_ICON);
+ GuiComponent.m_93133_(stack, leftStart - 36, top, 0.0F, 0.0F, 32, 32, 32, 32);
@@ -27,7 +27,7 @@
EMPTY(false),
ITEM(false),
BLOCK(false),
@@ -411,10 +_,30 @@
@@ -411,10 +_,29 @@
private ArmPose(boolean p_102896_) {
this.f_102890_ = p_102896_;
@@ -52,8 +52,7 @@
+ }
+
+ public <T extends LivingEntity> void applyTransform(HumanoidModel<T> model, T entity, net.minecraft.world.entity.HumanoidArm arm) {
+ com.google.common.base.Preconditions.checkNotNull(this.forgeArmPose, "applyTransform() must not be called on a vanilla ArmPose!");
+ this.forgeArmPose.applyTransform(model, entity, arm);
+ if (this.forgeArmPose != null) this.forgeArmPose.applyTransform(model, entity, arm);
+ }
+ // FORGE END
}
@@ -1,8 +1,8 @@
--- a/net/minecraft/client/model/geom/LayerDefinitions.java
+++ b/net/minecraft/client/model/geom/LayerDefinitions.java
@@ -293,6 +_,7 @@
WoodType.m_61843_().forEach((p_171114_) -> {
builder.put(ModelLayers.m_171291_(p_171114_), layerdefinition20);
@@ -313,6 +_,7 @@
WoodType.m_61843_().forEach((p_247864_) -> {
builder.put(ModelLayers.m_247439_(p_247864_), layerdefinition24);
});
+ net.minecraftforge.client.ForgeHooksClient.loadLayerDefinitions(builder);
ImmutableMap<ModelLayerLocation, LayerDefinition> immutablemap = builder.build();
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/model/geom/ModelLayers.java
+++ b/net/minecraft/client/model/geom/ModelLayers.java
@@ -207,7 +_,8 @@
@@ -217,11 +_,13 @@
}
public static ModelLayerLocation m_171291_(WoodType p_171292_) {
@@ -9,4 +9,10 @@
+ return new ModelLayerLocation(new ResourceLocation(location.m_135827_(), "sign/" + location.m_135815_()), "main");
}
public static ModelLayerLocation m_247439_(WoodType p_252225_) {
- return m_171300_("hanging_sign/" + p_252225_.m_61846_(), "main");
+ ResourceLocation location = new ResourceLocation(p_252225_.m_61846_());
+ return new ModelLayerLocation(new ResourceLocation(location.m_135827_(), "hanging_sign/" + location.m_135815_()), "main");
}
public static Stream<ModelLayerLocation> m_171288_() {
@@ -0,0 +1,11 @@
--- a/net/minecraft/client/multiplayer/AccountProfileKeyPairManager.java
+++ b/net/minecraft/client/multiplayer/AccountProfileKeyPairManager.java
@@ -75,6 +_,8 @@
this.m_253216_(profilekeypair);
return Optional.of(profilekeypair);
} catch (CryptException | MinecraftClientException | IOException ioexception) {
+ // Forge: The offline user api service always returns a null profile key pair, so let's hide this useless exception if in dev
+ if (net.minecraftforge.fml.loading.FMLLoader.isProduction() || this.f_252526_ != UserApiService.OFFLINE)
f_252448_.error("Failed to retrieve profile key pair", (Throwable)ioexception);
this.m_253216_((ProfileKeyPair)null);
return p_254074_;
@@ -1,14 +1,14 @@
--- a/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java
+++ b/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java
@@ -130,6 +_,7 @@
@@ -127,6 +_,7 @@
this.f_104521_.accept(Component.m_237115_("connect.joining"));
this.f_104523_ = p_104547_.m_134774_();
this.f_104522_.m_129498_(ConnectionProtocol.PLAY);
+ net.minecraftforge.network.NetworkHooks.handleClientLoginSuccess(this.f_104522_);
this.f_104522_.m_129505_(new ClientPacketListener(this.f_104519_, this.f_104520_, this.f_104522_, this.f_104523_, this.f_104519_.m_193590_()));
this.f_104522_.m_129505_(new ClientPacketListener(this.f_104519_, this.f_104520_, this.f_104522_, this.f_243717_, this.f_104523_, this.f_104519_.m_261007_().m_260825_(this.f_260722_, this.f_260612_)));
}
@@ -137,7 +_,7 @@
@@ -134,7 +_,7 @@
if (this.f_104520_ != null && this.f_104520_ instanceof RealmsScreen) {
this.f_104519_.m_91152_(new DisconnectedRealmsScreen(this.f_104520_, CommonComponents.f_130661_, p_104543_));
} else {
@@ -17,7 +17,7 @@
}
}
@@ -158,6 +_,7 @@
@@ -155,6 +_,7 @@
}
public void m_7254_(ClientboundCustomQueryPacket p_104545_) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/multiplayer/ClientLevel.java
+++ b/net/minecraft/client/multiplayer/ClientLevel.java
@@ -115,12 +_,15 @@
@@ -117,12 +_,15 @@
p_194170_.put(BiomeColors.f_108791_, new BlockTintCache((p_194168_) -> {
return this.m_104762_(p_194168_, BiomeColors.f_108791_);
}));
@@ -16,7 +16,7 @@
public void m_233651_(int p_233652_) {
this.f_233599_.m_233856_(p_233652_, this);
@@ -174,6 +_,8 @@
@@ -176,6 +_,8 @@
this.f_194123_ = p_205510_;
this.m_46465_();
this.m_46466_();
@@ -25,15 +25,15 @@
}
public void m_194171_(Runnable p_194172_) {
@@ -260,6 +_,7 @@
@@ -262,6 +_,7 @@
this.m_46473_().m_6521_(() -> {
return Registry.f_122826_.m_7981_(p_104640_.m_6095_()).toString();
return BuiltInRegistries.f_256780_.m_7981_(p_104640_.m_6095_()).toString();
});
+ if (p_104640_.canUpdate())
p_104640_.m_8119_();
this.m_46473_().m_7238_();
@@ -322,8 +_,10 @@
@@ -324,8 +_,10 @@
}
private void m_104739_(int p_104740_, Entity p_104741_) {
@@ -44,33 +44,33 @@
}
public void m_171642_(int p_171643_, Entity.RemovalReason p_171644_) {
@@ -450,6 +_,12 @@
@@ -452,6 +_,12 @@
}
public void m_214150_(@Nullable Player p_233621_, double p_233622_, double p_233623_, double p_233624_, SoundEvent p_233625_, SoundSource p_233626_, float p_233627_, float p_233628_, long p_233629_) {
+ net.minecraftforge.event.PlayLevelSoundEvent.AtPosition event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtPosition(this, p_233622_, p_233623_, p_233624_, p_233625_, p_233626_, p_233627_, p_233628_);
public void m_262808_(@Nullable Player p_263381_, double p_263372_, double p_263404_, double p_263365_, Holder<SoundEvent> p_263335_, SoundSource p_263417_, float p_263416_, float p_263349_, long p_263408_) {
+ net.minecraftforge.event.PlayLevelSoundEvent.AtPosition event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtPosition(this, p_263372_, p_263404_, p_263365_, p_263335_, p_263417_, p_263416_, p_263349_);
+ if (event.isCanceled() || event.getSound() == null) return;
+ p_233625_ = event.getSound();
+ p_233626_ = event.getSource();
+ p_233627_ = event.getNewVolume();
+ p_233628_ = event.getNewPitch();
if (p_233621_ == this.f_104565_.f_91074_) {
this.m_233602_(p_233622_, p_233623_, p_233624_, p_233625_, p_233626_, p_233627_, p_233628_, false, p_233629_);
+ p_263335_ = event.getSound();
+ p_263417_ = event.getSource();
+ p_263416_ = event.getNewVolume();
+ p_263349_ = event.getNewPitch();
if (p_263381_ == this.f_104565_.f_91074_) {
this.m_233602_(p_263372_, p_263404_, p_263365_, p_263335_.m_203334_(), p_263417_, p_263416_, p_263349_, false, p_263408_);
}
@@ -457,6 +_,12 @@
@@ -459,6 +_,12 @@
}
public void m_213890_(@Nullable Player p_233631_, Entity p_233632_, SoundEvent p_233633_, SoundSource p_233634_, float p_233635_, float p_233636_, long p_233637_) {
+ net.minecraftforge.event.PlayLevelSoundEvent.AtEntity event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_233632_, p_233633_, p_233634_, p_233635_, p_233636_);
public void m_213890_(@Nullable Player p_263514_, Entity p_263536_, Holder<SoundEvent> p_263518_, SoundSource p_263487_, float p_263538_, float p_263524_, long p_263509_) {
+ net.minecraftforge.event.PlayLevelSoundEvent.AtEntity event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_263536_, p_263518_, p_263487_, p_263538_, p_263524_);
+ if (event.isCanceled() || event.getSound() == null) return;
+ p_233633_ = event.getSound();
+ p_233634_ = event.getSource();
+ p_233635_ = event.getNewVolume();
+ p_233636_ = event.getNewPitch();
if (p_233631_ == this.f_104565_.f_91074_) {
this.f_104565_.m_91106_().m_120367_(new EntityBoundSoundInstance(p_233633_, p_233634_, p_233635_, p_233636_, p_233632_, p_233637_));
+ p_263518_ = event.getSound();
+ p_263487_ = event.getSource();
+ p_263538_ = event.getNewVolume();
+ p_263524_ = event.getNewPitch();
if (p_263514_ == this.f_104565_.f_91074_) {
this.f_104565_.m_91106_().m_120367_(new EntityBoundSoundInstance(p_263518_.m_203334_(), p_263487_, p_263538_, p_263524_, p_263536_, p_263509_));
}
@@ -902,6 +_,7 @@
@@ -907,6 +_,7 @@
}
public void m_104851_(Difficulty p_104852_) {
@@ -78,7 +78,7 @@
this.f_104840_ = p_104852_;
}
@@ -939,14 +_,46 @@
@@ -944,14 +_,46 @@
ClientLevel.this.f_104566_.add((AbstractClientPlayer)p_171712_);
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/multiplayer/ClientPacketListener.java
+++ b/net/minecraft/client/multiplayer/ClientPacketListener.java
@@ -375,6 +_,7 @@
@@ -398,6 +_,7 @@
this.f_104888_.f_91064_.m_113434_();
this.f_104888_.f_91074_.m_172530_();
@@ -8,15 +8,15 @@
int i = p_105030_.f_132360_();
this.f_104888_.f_91074_.m_20234_(i);
this.f_104889_.m_104630_(i, this.f_104888_.f_91074_);
@@ -387,6 +_,7 @@
@@ -410,6 +_,7 @@
this.f_104888_.f_91074_.m_219749_(p_105030_.f_238174_());
this.f_104888_.f_91072_.m_171805_(p_105030_.f_132363_(), p_105030_.f_132364_());
this.f_104888_.f_91066_.m_193770_(p_105030_.f_132370_());
+ net.minecraftforge.network.NetworkHooks.sendMCRegistryPackets(f_104885_, "PLAY_TO_SERVER");
this.f_104888_.f_91066_.m_92172_();
this.f_104885_.m_129512_(new ServerboundCustomPayloadPacket(ServerboundCustomPayloadPacket.f_133979_, (new FriendlyByteBuf(Unpooled.buffer())).m_130070_(ClientBrandRetriever.m_129629_())));
this.f_104888_.m_91309_().m_90739_();
@@ -941,8 +_,10 @@
this.f_244346_ = new LastSeenMessagesTracker(20);
@@ -1003,8 +_,10 @@
localplayer1.m_21204_().m_22159_(localplayer.m_21204_());
}
@@ -27,7 +27,7 @@
this.f_104889_.m_104630_(i, localplayer1);
localplayer1.m_146922_(-180.0F);
localplayer1.f_108618_ = new KeyboardInput(this.f_104888_.f_91066_);
@@ -1046,10 +_,7 @@
@@ -1109,10 +_,7 @@
PacketUtils.m_131363_(p_104976_, this, this.f_104888_);
BlockPos blockpos = p_104976_.m_131704_();
this.f_104888_.f_91073_.m_141902_(blockpos, p_104976_.m_195645_()).ifPresent((p_205557_) -> {
@@ -39,18 +39,18 @@
if (p_205557_ instanceof CommandBlockEntity && this.f_104888_.f_91080_ instanceof CommandBlockEditScreen) {
((CommandBlockEditScreen)this.f_104888_.f_91080_).m_98398_();
@@ -1194,7 +_,9 @@
@@ -1257,7 +_,9 @@
public void m_7443_(ClientboundCommandsPacket p_104990_) {
PacketUtils.m_131363_(p_104990_, this, this.f_104888_);
- this.f_104899_ = new CommandDispatcher<>(p_104990_.m_237624_(new CommandBuildContext(this.f_104903_)));
+ var context = new CommandBuildContext(this.f_104903_);
- this.f_104899_ = new CommandDispatcher<>(p_104990_.m_237624_(CommandBuildContext.m_255418_(this.f_104903_.m_247579_(), this.f_244039_)));
+ var context = CommandBuildContext.m_255418_(this.f_104903_.m_247579_(), this.f_244039_);
+ this.f_104899_ = new CommandDispatcher<>(p_104990_.m_237624_(context));
+ this.f_104899_ = net.minecraftforge.client.ClientCommandHandler.mergeServerCommands(this.f_104899_, context);
}
public void m_7183_(ClientboundStopSoundPacket p_105116_) {
@@ -1213,6 +_,7 @@
@@ -1276,6 +_,7 @@
ClientRecipeBook clientrecipebook = this.f_104888_.f_91074_.m_108631_();
clientrecipebook.m_90625_(this.f_104900_.m_44051_());
this.f_104888_.m_231374_(SearchRegistry.f_119943_, clientrecipebook.m_90639_());
@@ -58,15 +58,17 @@
}
public void m_7244_(ClientboundPlayerLookAtPacket p_105054_) {
@@ -1314,6 +_,7 @@
@@ -1368,7 +_,8 @@
Blocks.m_50758_();
}
this.f_104888_.m_231374_(SearchRegistry.f_119941_, nonnulllist);
this.f_104888_.m_231374_(SearchRegistry.f_119942_, nonnulllist);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.TagsUpdatedEvent(this.f_104903_, true, f_104885_.m_129531_()));
- CreativeModeTabs.m_258007_().m_257466_();
+ CreativeModeTabs.m_257478_().stream().filter(net.minecraft.world.item.CreativeModeTab::hasSearchBar).forEach(net.minecraft.world.item.CreativeModeTab::m_257466_);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.TagsUpdatedEvent(this.f_104903_.m_247579_(), true, f_104885_.m_129531_()));
}
private <T> void m_205560_(ResourceKey<? extends Registry<? extends T>> p_205561_, TagNetworkSerialization.NetworkPayload p_205562_) {
@@ -1666,6 +_,7 @@
public void m_241155_(ClientboundUpdateEnabledFeaturesPacket p_251591_) {
@@ -1753,6 +_,7 @@
}
public void m_7413_(ClientboundCustomPayloadPacket p_105004_) {
@@ -74,7 +76,7 @@
PacketUtils.m_131363_(p_105004_, this, this.f_104888_);
ResourceLocation resourcelocation = p_105004_.m_132042_();
FriendlyByteBuf friendlybytebuf = null;
@@ -1863,7 +_,7 @@
@@ -1950,7 +_,7 @@
int j5 = friendlybytebuf.m_130242_();
this.f_104888_.f_91064_.f_173815_.m_173830_(positionsource, j5);
} else {
@@ -83,3 +85,20 @@
}
} finally {
if (friendlybytebuf != null) {
@@ -2284,6 +_,8 @@
}
public void m_246175_(String p_249888_) {
+ p_249888_ = net.minecraftforge.client.ForgeHooksClient.onClientSendMessage(p_249888_);
+ if (p_249888_.isEmpty()) return;
Instant instant = Instant.now();
long i = Crypt.SaltSupplier.m_216113_();
LastSeenMessagesTracker.Update lastseenmessagestracker$update = this.f_244346_.m_246442_();
@@ -2292,6 +_,7 @@
}
public void m_246623_(String p_250092_) {
+ if (net.minecraftforge.client.ClientCommandHandler.runCommand(p_250092_)) return;
Instant instant = Instant.now();
long i = Crypt.SaltSupplier.m_216113_();
LastSeenMessagesTracker.Update lastseenmessagestracker$update = this.f_244346_.m_246442_();
@@ -79,7 +79,7 @@
if (this.f_105193_ >= 1.0F) {
this.f_105196_ = false;
this.m_233729_(this.f_105189_.f_91073_, (p_233739_) -> {
@@ -263,7 +_,7 @@
@@ -247,7 +_,7 @@
}
public float m_105286_() {
@@ -88,7 +88,7 @@
}
public void m_105287_() {
@@ -280,7 +_,7 @@
@@ -264,7 +_,7 @@
ItemStack itemstack = this.f_105189_.f_91074_.m_21205_();
boolean flag = this.f_105192_.m_41619_() && itemstack.m_41619_();
if (!this.f_105192_.m_41619_() && !itemstack.m_41619_()) {
@@ -97,7 +97,7 @@
}
return p_105282_.equals(this.f_105191_) && flag;
@@ -312,20 +_,33 @@
@@ -296,25 +_,38 @@
private InteractionResult m_233746_(LocalPlayer p_233747_, InteractionHand p_233748_, BlockHitResult p_233749_) {
BlockPos blockpos = p_233749_.m_82425_();
ItemStack itemstack = p_233747_.m_21120_(p_233748_);
@@ -119,8 +119,13 @@
+ boolean flag = !p_233747_.m_21205_().doesSneakBypassUse(p_233747_.m_9236_(), blockpos, p_233747_) || !p_233747_.m_21206_().doesSneakBypassUse(p_233747_.m_9236_(), blockpos, p_233747_);
boolean flag1 = p_233747_.m_36341_() && flag;
- if (!flag1) {
BlockState blockstate = this.f_105189_.f_91073_.m_8055_(blockpos);
if (!this.f_105190_.m_246351_(blockstate.m_60734_().m_245183_())) {
return InteractionResult.FAIL;
}
+ if (event.getUseBlock() == net.minecraftforge.eventbus.api.Event.Result.ALLOW || (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY && !flag1)) {
InteractionResult interactionresult = this.f_105189_.f_91073_.m_8055_(blockpos).m_60664_(this.f_105189_.f_91073_, p_233747_, p_233748_, p_233749_);
InteractionResult interactionresult = blockstate.m_60664_(this.f_105189_.f_91073_, p_233747_, p_233748_, p_233749_);
if (interactionresult.m_19077_()) {
return interactionresult;
}
@@ -135,7 +140,7 @@
InteractionResult interactionresult1;
if (this.f_105197_.m_46408_()) {
int i = itemstack.m_41613_();
@@ -356,10 +_,17 @@
@@ -345,10 +_,17 @@
mutableobject.setValue(InteractionResult.PASS);
return serverbounduseitempacket;
} else {
@@ -153,7 +158,7 @@
}
mutableobject.setValue(interactionresultholder.m_19089_());
@@ -398,6 +_,9 @@
@@ -387,6 +_,9 @@
this.m_105297_();
Vec3 vec3 = p_105233_.m_82450_().m_82492_(p_105232_.m_20185_(), p_105232_.m_20186_(), p_105232_.m_20189_());
this.f_105190_.m_104955_(ServerboundInteractPacket.m_179612_(p_105232_, p_105231_.m_6144_(), p_105234_, vec3));
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/multiplayer/PlayerInfo.java
+++ b/net/minecraft/client/multiplayer/PlayerInfo.java
@@ -82,6 +_,7 @@
@@ -74,6 +_,7 @@
}
protected void m_105317_(GameType p_105318_) {
@@ -1,11 +0,0 @@
--- a/net/minecraft/client/multiplayer/ProfileKeyPairManager.java
+++ b/net/minecraft/client/multiplayer/ProfileKeyPairManager.java
@@ -76,6 +_,8 @@
this.m_233776_(profilekeypair);
return Optional.of(profilekeypair);
} catch (CryptException | MinecraftClientException | IOException ioexception) {
+ // Forge: The offline user api service always returns a null profile key pair, so let's hide this useless exception if in dev
+ if (net.minecraftforge.fml.loading.FMLLoader.isProduction() || this.f_243348_ != UserApiService.OFFLINE)
f_233765_.error("Failed to retrieve profile key pair", (Throwable)ioexception);
this.m_233776_((ProfileKeyPair)null);
return p_243401_;
@@ -1,8 +1,8 @@
--- a/net/minecraft/client/multiplayer/ServerData.java
+++ b/net/minecraft/client/multiplayer/ServerData.java
@@ -36,6 +_,7 @@
private ServerData.ChatPreview f_233800_;
private boolean f_233801_ = true;
@@ -26,6 +_,7 @@
private String f_105372_;
private boolean f_105373_;
private boolean f_242950_;
+ public net.minecraftforge.client.ExtendedServerListData forgeData = null;
@@ -1,21 +1,32 @@
--- a/net/minecraft/client/multiplayer/chat/ChatListener.java
+++ b/net/minecraft/client/multiplayer/chat/ChatListener.java
@@ -175,12 +_,16 @@
MessageSignature messagesignature = p_242317_.f_240893_();
FilterMask filtermask = p_242317_.f_242992_();
@@ -104,7 +_,9 @@
Instant instant = Instant.now();
this.m_246163_((MessageSignature)null, () -> {
Component component = p_251256_.m_240977_(p_250375_);
- this.f_240348_.f_91065_.m_93076_().m_93785_(component);
+ Component forgeComponent = net.minecraftforge.client.ForgeHooksClient.onClientChat(p_251256_, component, Util.f_137441_);
+ if (forgeComponent == null) return false;
+ this.f_240348_.f_91065_.m_93076_().m_93785_(forgeComponent);
this.m_241119_(p_251256_, p_250375_);
this.m_240498_(component, instant);
this.f_240659_ = Util.m_137550_();
@@ -121,12 +_,16 @@
MessageSignature messagesignature = p_249430_.f_244279_();
FilterMask filtermask = p_249430_.f_242992_();
if (filtermask.m_243095_()) {
- this.f_240348_.f_91065_.m_93076_().m_240964_(p_243337_, messagesignature, guimessagetag);
+ Component forgeComponent = net.minecraftforge.client.ForgeHooksClient.onClientChat(p_242290_, p_243337_, p_242317_, p_242317_.m_241067_());
- this.f_240348_.f_91065_.m_93076_().m_240964_(p_249231_, messagesignature, guimessagetag);
+ Component forgeComponent = net.minecraftforge.client.ForgeHooksClient.onClientPlayerChat(p_251766_, p_249231_, p_249430_, p_249430_.m_245167_());
+ if (forgeComponent == null) return false;
+ this.f_240348_.f_91065_.m_93076_().m_240964_(forgeComponent, messagesignature, guimessagetag);
this.m_241119_(p_242290_, p_242317_.m_237220_());
this.m_241119_(p_251766_, p_249430_.m_245692_());
} else {
Component component = filtermask.m_243081_(p_242317_.m_241775_());
Component component = filtermask.m_246134_(p_249430_.m_245728_());
if (component != null) {
- this.f_240348_.f_91065_.m_93076_().m_240964_(p_242290_.m_240977_(component), messagesignature, guimessagetag);
+ Component forgeComponent = net.minecraftforge.client.ForgeHooksClient.onClientChat(p_242290_, p_242290_.m_240977_(component), p_242317_, p_242317_.m_241067_());
- this.f_240348_.f_91065_.m_93076_().m_240964_(p_251766_.m_240977_(component), messagesignature, guimessagetag);
+ Component forgeComponent = net.minecraftforge.client.ForgeHooksClient.onClientPlayerChat(p_251766_, p_251766_.m_240977_(component), p_249430_, p_249430_.m_245167_());
+ if (forgeComponent == null) return false;
+ this.f_240348_.f_91065_.m_93076_().m_240964_(forgeComponent, messagesignature, guimessagetag);
this.m_241119_(p_242290_, component);
this.m_241119_(p_251766_, component);
}
}
@@ -0,0 +1,11 @@
--- a/net/minecraft/client/multiplayer/resolver/AddressCheck.java
+++ b/net/minecraft/client/multiplayer/resolver/AddressCheck.java
@@ -16,7 +_,7 @@
boolean m_142408_(ServerAddress p_171830_);
static AddressCheck m_171828_() {
- final ImmutableList<Predicate<String>> immutablelist = Streams.stream(ServiceLoader.load(BlockListSupplier.class)).map(BlockListSupplier::createBlockList).filter(Objects::nonNull).collect(ImmutableList.toImmutableList());
+ final ImmutableList<Predicate<String>> immutablelist = Streams.stream(ServiceLoader.load(BlockListSupplier.class, net.minecraftforge.fml.loading.FMLLoader.class.getClassLoader())).map(BlockListSupplier::createBlockList).filter(Objects::nonNull).collect(ImmutableList.toImmutableList());
return new AddressCheck() {
public boolean m_142649_(ResolvedServerAddress p_171835_) {
String s = p_171835_.m_142727_();
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/particle/ParticleEngine.java
+++ b/net/minecraft/client/particle/ParticleEngine.java
@@ -63,11 +_,11 @@
@@ -74,11 +_,11 @@
private static final int f_172264_ = 16384;
private static final List<ParticleRenderType> f_107288_ = ImmutableList.of(ParticleRenderType.f_107429_, ParticleRenderType.f_107430_, ParticleRenderType.f_107432_, ParticleRenderType.f_107431_, ParticleRenderType.f_107433_);
protected ClientLevel f_107287_;
@@ -14,37 +14,37 @@
private final Queue<Particle> f_107294_ = Queues.newArrayDeque();
private final Map<ResourceLocation, ParticleEngine.MutableSpriteSet> f_107295_ = Maps.newHashMap();
private final TextureAtlas f_107296_;
@@ -177,14 +_,18 @@
@@ -188,14 +_,18 @@
this.m_107378_(ParticleTypes.f_235901_, ShriekParticle.Provider::new);
}
+ /** @deprecated Register via {@link net.minecraftforge.client.event.RegisterParticleProvidersEvent} */
+ @Deprecated
public <T extends ParticleOptions> void m_107381_(ParticleType<T> p_107382_, ParticleProvider<T> p_107383_) {
- this.f_107293_.put(Registry.f_122829_.m_7447_(p_107382_), p_107383_);
+ this.f_107293_.put(Registry.f_122829_.m_7981_(p_107382_), p_107383_);
- this.f_107293_.put(BuiltInRegistries.f_257034_.m_7447_(p_107382_), p_107383_);
+ this.f_107293_.put(BuiltInRegistries.f_257034_.m_7981_(p_107382_), p_107383_);
}
+ /** @deprecated Register via {@link net.minecraftforge.client.event.RegisterParticleProvidersEvent} */
+ @Deprecated
public <T extends ParticleOptions> void m_107378_(ParticleType<T> p_107379_, ParticleEngine.SpriteParticleRegistration<T> p_107380_) {
ParticleEngine.MutableSpriteSet particleengine$mutablespriteset = new ParticleEngine.MutableSpriteSet();
this.f_107295_.put(Registry.f_122829_.m_7981_(p_107379_), particleengine$mutablespriteset);
- this.f_107293_.put(Registry.f_122829_.m_7447_(p_107379_), p_107380_.m_107419_(particleengine$mutablespriteset));
+ this.f_107293_.put(Registry.f_122829_.m_7981_(p_107379_), p_107380_.m_107419_(particleengine$mutablespriteset));
this.f_107295_.put(BuiltInRegistries.f_257034_.m_7981_(p_107379_), particleengine$mutablespriteset);
- this.f_107293_.put(BuiltInRegistries.f_257034_.m_7447_(p_107379_), p_107380_.m_107419_(particleengine$mutablespriteset));
+ this.f_107293_.put(BuiltInRegistries.f_257034_.m_7981_(p_107379_), p_107380_.m_107419_(particleengine$mutablespriteset));
}
public CompletableFuture<Void> m_5540_(PreparableReloadListener.PreparationBarrier p_107305_, ResourceManager p_107306_, ProfilerFiller p_107307_, ProfilerFiller p_107308_, Executor p_107309_, Executor p_107310_) {
@@ -288,7 +_,7 @@
@@ -313,7 +_,7 @@
@Nullable
private <T extends ParticleOptions> Particle m_107395_(T p_107396_, double p_107397_, double p_107398_, double p_107399_, double p_107400_, double p_107401_, double p_107402_) {
- ParticleProvider<T> particleprovider = (ParticleProvider<T>)this.f_107293_.get(Registry.f_122829_.m_7447_(p_107396_.m_6012_()));
+ ParticleProvider<T> particleprovider = (ParticleProvider<T>)this.f_107293_.get(Registry.f_122829_.m_7981_(p_107396_.m_6012_()));
- ParticleProvider<T> particleprovider = (ParticleProvider<T>)this.f_107293_.get(BuiltInRegistries.f_257034_.m_7447_(p_107396_.m_6012_()));
+ ParticleProvider<T> particleprovider = (ParticleProvider<T>)this.f_107293_.get(BuiltInRegistries.f_257034_.m_7981_(p_107396_.m_6012_()));
return particleprovider == null ? null : particleprovider.m_6966_(p_107396_, this.f_107287_, p_107397_, p_107398_, p_107399_, p_107400_, p_107401_, p_107402_);
}
@@ -369,15 +_,25 @@
@@ -394,15 +_,25 @@
}
}
@@ -62,7 +62,7 @@
+ RenderSystem.m_69388_(org.lwjgl.opengl.GL13.GL_TEXTURE0);
PoseStack posestack = RenderSystem.m_157191_();
posestack.m_85836_();
posestack.m_166854_(p_107337_.m_85850_().m_85861_());
posestack.m_252931_(p_107337_.m_85850_().m_252922_());
RenderSystem.m_157182_();
- for(ParticleRenderType particlerendertype : f_107288_) {
@@ -71,7 +71,7 @@
Iterable<Particle> iterable = this.f_107289_.get(particlerendertype);
if (iterable != null) {
RenderSystem.m_157427_(GameRenderer::m_172829_);
@@ -387,6 +_,7 @@
@@ -412,6 +_,7 @@
particlerendertype.m_6505_(bufferbuilder, this.f_107291_);
for(Particle particle : iterable) {
@@ -79,16 +79,16 @@
try {
particle.m_5744_(bufferbuilder, p_107340_, p_107341_);
} catch (Throwable throwable) {
@@ -417,7 +_,7 @@
@@ -441,7 +_,7 @@
}
public void m_107355_(BlockPos p_107356_, BlockState p_107357_) {
- if (!p_107357_.m_60795_()) {
- if (!p_107357_.m_60795_() && p_107357_.m_245147_()) {
+ if (!p_107357_.m_60795_() && !net.minecraftforge.client.extensions.common.IClientBlockExtensions.of(p_107357_).addDestroyEffects(p_107357_, this.f_107287_, p_107356_, this)) {
VoxelShape voxelshape = p_107357_.m_60808_(this.f_107287_, p_107356_);
double d0 = 0.25D;
voxelshape.m_83286_((p_172273_, p_172274_, p_172275_, p_172276_, p_172277_, p_172278_) -> {
@@ -437,7 +_,7 @@
@@ -461,7 +_,7 @@
double d7 = d4 * d1 + p_172273_;
double d8 = d5 * d2 + p_172274_;
double d9 = d6 * d3 + p_172275_;
@@ -97,7 +97,7 @@
}
}
}
@@ -481,12 +_,18 @@
@@ -505,12 +_,18 @@
d0 = (double)i + aabb.f_82291_ + (double)0.1F;
}
@@ -1,10 +1,10 @@
--- a/net/minecraft/client/particle/VibrationSignalParticle.java
+++ b/net/minecraft/client/particle/VibrationSignalParticle.java
@@ -100,6 +_,7 @@
@@ -105,6 +_,7 @@
this.f_107212_ = Mth.m_14139_(d0, this.f_107212_, vec3.m_7096_());
this.f_107213_ = Mth.m_14139_(d0, this.f_107213_, vec3.m_7098_());
this.f_107214_ = Mth.m_14139_(d0, this.f_107214_, vec3.m_7094_());
+ this.m_107264_(this.f_107212_, this.f_107213_, this.f_107214_); // FORGE: update the particle's bounding box
this.f_172460_ = this.f_172462_;
this.f_172462_ = (float)Mth.m_14136_(this.f_107212_ - vec3.m_7096_(), this.f_107214_ - vec3.m_7094_());
}
+ this.m_107264_(this.f_107212_, this.f_107213_, this.f_107214_); // FORGE: Update the particle's bounding box
double d1 = this.f_107212_ - vec3.m_7096_();
double d2 = this.f_107213_ - vec3.m_7098_();
double d3 = this.f_107214_ - vec3.m_7094_();
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/player/AbstractClientPlayer.java
+++ b/net/minecraft/client/player/AbstractClientPlayer.java
@@ -137,6 +_,6 @@
@@ -136,6 +_,6 @@
}
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/player/LocalPlayer.java
+++ b/net/minecraft/client/player/LocalPlayer.java
@@ -162,6 +_,7 @@
@@ -150,6 +_,7 @@
}
public boolean m_6469_(DamageSource p_108662_, float p_108663_) {
@@ -8,31 +8,15 @@
return false;
}
@@ -289,6 +_,8 @@
}
public void m_240287_(String p_240288_, @Nullable Component p_240289_) {
+ p_240288_ = net.minecraftforge.client.ForgeHooksClient.onClientSendMessage(p_240288_);
+ if (p_240288_.isEmpty()) return;
this.m_240966_(p_240288_, p_240289_);
}
@@ -333,6 +_,7 @@
}
private void m_241110_(String p_241331_, @Nullable Component p_241563_) {
+ if (net.minecraftforge.client.ClientCommandHandler.runCommand(p_241331_)) return;
ParseResults<SharedSuggestionProvider> parseresults = this.f_108617_.m_105146_().parse(p_241331_, this.f_108617_.m_105137_());
MessageSigner messagesigner = this.m_241001_();
LastSeenMessages.Update lastseenmessages$update = this.f_108617_.m_241918_();
@@ -547,7 +_,13 @@
@@ -462,7 +_,14 @@
}
public void m_5496_(SoundEvent p_108651_, float p_108652_, float p_108653_) {
- this.f_19853_.m_7785_(this.m_20185_(), this.m_20186_(), this.m_20189_(), p_108651_, this.m_5720_(), p_108652_, p_108653_, false);
+ net.minecraftforge.event.PlayLevelSoundEvent.AtEntity event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, p_108651_, this.m_5720_(), p_108652_, p_108653_);
+ net.minecraft.core.Holder<SoundEvent> holder = net.minecraft.core.registries.BuiltInRegistries.f_256894_.m_263177_(p_108651_);
+ net.minecraftforge.event.PlayLevelSoundEvent.AtEntity event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, holder, this.m_5720_(), p_108652_, p_108653_);
+ if (event.isCanceled() || event.getSound() == null) return;
+ p_108651_ = event.getSound();
+ p_108651_ = event.getSound().get();
+ SoundSource source = event.getSource();
+ p_108652_ = event.getNewVolume();
+ p_108653_ = event.getNewPitch();
@@ -40,7 +24,7 @@
}
public void m_6330_(SoundEvent p_108655_, SoundSource p_108656_, float p_108657_, float p_108658_) {
@@ -703,6 +_,7 @@
@@ -634,6 +_,7 @@
this.f_108601_ = !this.m_150110_().f_35935_ && !this.m_6069_() && this.m_20175_(Pose.CROUCHING) && (this.m_6144_() || !this.m_5803_() && !this.m_20175_(Pose.STANDING));
float f = Mth.m_14036_(0.3F + EnchantmentHelper.m_220302_(this), 0.0F, 1.0F);
this.f_108618_.m_214106_(this.m_108635_(), f);
@@ -48,16 +32,16 @@
this.f_108619_.m_91301_().m_120586_(this.f_108618_);
if (this.m_6117_() && !this.m_20159_()) {
this.f_108618_.f_108566_ *= 0.2F;
@@ -729,7 +_,7 @@
@@ -660,7 +_,7 @@
}
boolean flag4 = (float)this.m_36324_().m_38702_() > 6.0F || this.m_150110_().f_35936_;
- if ((this.f_19861_ || this.m_5842_()) && !flag1 && !flag2 && this.m_108733_() && !this.m_20142_() && flag4 && !this.m_6117_() && !this.m_21023_(MobEffects.f_19610_)) {
+ if ((this.f_19861_ || this.m_5842_() || this.canStartSwimming()) && !flag1 && !flag2 && this.m_108733_() && !this.m_20142_() && flag4 && !this.m_6117_() && !this.m_21023_(MobEffects.f_19610_)) {
boolean flag4 = this.m_255269_();
- if ((this.f_19861_ || this.m_5842_() || this.m_20159_() && this.m_20202_().m_20096_()) && !flag1 && !flag2 && this.m_108733_() && !this.m_20142_() && flag4 && !this.m_6117_() && !this.m_21023_(MobEffects.f_19610_)) {
+ if ((this.f_19861_ || this.m_5842_() || this.m_20159_() && this.m_20202_().m_20096_() || this.canStartSwimming()) && !flag1 && !flag2 && this.m_108733_() && !this.m_20142_() && flag4 && !this.m_6117_() && !this.m_21023_(MobEffects.f_19610_)) {
if (this.f_108583_ <= 0 && !this.f_108619_.f_91066_.f_92091_.m_90857_()) {
this.f_108583_ = 7;
} else {
@@ -737,15 +_,15 @@
@@ -668,15 +_,15 @@
}
}
@@ -76,7 +60,7 @@
this.m_6858_(false);
}
} else if (flag6) {
@@ -775,14 +_,15 @@
@@ -706,14 +_,15 @@
if (this.f_108618_.f_108572_ && !flag7 && !flag && !this.m_150110_().f_35935_ && !this.m_20159_() && !this.m_6147_()) {
ItemStack itemstack = this.m_6844_(EquipmentSlot.CHEST);
@@ -95,7 +79,7 @@
}
if (this.m_204029_(FluidTags.f_13131_)) {
@@ -893,6 +_,7 @@
@@ -824,6 +_,7 @@
public void m_6083_() {
super.m_6083_();
@@ -103,7 +87,7 @@
this.f_108611_ = false;
if (this.m_20202_() instanceof Boat) {
Boat boat = (Boat)this.m_20202_();
@@ -1106,6 +_,18 @@
@@ -1041,6 +_,18 @@
} else {
return super.m_7398_(p_108758_);
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/player/RemotePlayer.java
+++ b/net/minecraft/client/player/RemotePlayer.java
@@ -30,6 +_,7 @@
@@ -28,6 +_,7 @@
}
public boolean m_6469_(DamageSource p_108772_, float p_108773_) {
@@ -10,7 +10,7 @@
this.f_108932_ = p_108942_;
Resource resource = p_108941_.m_215593_(resourcelocation);
@@ -168,7 +_,8 @@
@@ -150,7 +_,8 @@
} else {
EffectProgram effectprogram;
if (program == null) {
@@ -18,5 +18,5 @@
+ ResourceLocation rl = ResourceLocation.m_135820_(p_172569_);
+ ResourceLocation resourcelocation = new ResourceLocation(rl.m_135827_(), "shaders/program/" + rl.m_135815_() + p_172568_.m_85569_());
Resource resource = p_172567_.m_215593_(resourcelocation);
InputStream inputstream = resource.m_215507_();
try (InputStream inputstream = resource.m_215507_()) {
@@ -6,9 +6,9 @@
+ Vector3f fogColor = net.minecraftforge.client.ForgeHooksClient.getFogColor(p_109019_, p_109020_, p_109021_, p_109022_, p_109023_, f_109010_, f_109011_, f_109012_);
+
+ f_109010_ = fogColor.m_122239_();
+ f_109011_ = fogColor.m_122260_();
+ f_109012_ = fogColor.m_122269_();
+ f_109010_ = fogColor.x();
+ f_109011_ = fogColor.y();
+ f_109012_ = fogColor.z();
+
RenderSystem.m_69424_(f_109010_, f_109011_, f_109012_, 0.0F);
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/renderer/GameRenderer.java
+++ b/net/minecraft/client/renderer/GameRenderer.java
@@ -290,6 +_,8 @@
@@ -299,6 +_,8 @@
this.m_109128_(new ResourceLocation("shaders/post/spider.json"));
} else if (p_109107_ instanceof EnderMan) {
this.m_109128_(new ResourceLocation("shaders/post/invert.json"));
@@ -9,15 +9,15 @@
}
}
@@ -549,6 +_,7 @@
list1.add(Pair.of(new ShaderInstance(p_172768_, "rendertype_crumbling", DefaultVertexFormat.f_85811_), (p_234230_) -> {
@@ -586,6 +_,7 @@
list1.add(Pair.of(new ShaderInstance(p_250719_, "rendertype_crumbling", DefaultVertexFormat.f_85811_), (p_234230_) -> {
f_172607_ = p_234230_;
}));
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.RegisterShadersEvent(p_172768_, list1));
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.RegisterShadersEvent(p_250719_, list1));
} catch (IOException ioexception) {
list1.forEach((p_172729_) -> {
p_172729_.getFirst().close();
@@ -630,19 +_,21 @@
@@ -667,19 +_,21 @@
boolean flag = false;
int i = 3;
double d1 = d0;
@@ -42,7 +42,7 @@
d1 = this.f_109059_.f_91077_.m_82450_().m_82557_(vec3);
}
@@ -657,7 +_,7 @@
@@ -694,7 +_,7 @@
Entity entity1 = entityhitresult.m_82443_();
Vec3 vec33 = entityhitresult.m_82450_();
double d2 = vec3.m_82557_(vec33);
@@ -51,7 +51,7 @@
this.f_109059_.f_91077_ = BlockHitResult.m_82426_(vec33, Direction.m_122366_(vec31.f_82479_, vec31.f_82480_, vec31.f_82481_), new BlockPos(vec33));
} else if (d2 < d1 || this.f_109059_.f_91077_ == null) {
this.f_109059_.f_91077_ = entityhitresult;
@@ -711,7 +_,7 @@
@@ -748,7 +_,7 @@
d0 *= Mth.m_14139_(this.f_109059_.f_91066_.m_231925_().m_231551_(), 1.0D, (double)0.85714287F);
}
@@ -60,44 +60,43 @@
}
}
@@ -848,11 +_,11 @@
@@ -883,11 +_,11 @@
Window window = this.f_109059_.m_91268_();
RenderSystem.m_69421_(256, Minecraft.f_91002_);
- Matrix4f matrix4f = Matrix4f.m_162203_(0.0F, (float)((double)window.m_85441_() / window.m_85449_()), 0.0F, (float)((double)window.m_85442_() / window.m_85449_()), 1000.0F, 3000.0F);
+ Matrix4f matrix4f = Matrix4f.m_162203_(0.0F, (float)((double)window.m_85441_() / window.m_85449_()), 0.0F, (float)((double)window.m_85442_() / window.m_85449_()), 1000.0F, net.minecraftforge.client.ForgeHooksClient.getGuiFarPlane());
RenderSystem.m_157425_(matrix4f);
- Matrix4f matrix4f = (new Matrix4f()).setOrtho(0.0F, (float)((double)window.m_85441_() / window.m_85449_()), (float)((double)window.m_85442_() / window.m_85449_()), 0.0F, 1000.0F, 3000.0F);
+ Matrix4f matrix4f = (new Matrix4f()).setOrtho(0.0F, (float)((double)window.m_85441_() / window.m_85449_()), (float)((double)window.m_85442_() / window.m_85449_()), 0.0F, 1000.0F, net.minecraftforge.client.ForgeHooksClient.getGuiFarPlane());
RenderSystem.m_252934_(matrix4f);
PoseStack posestack = RenderSystem.m_157191_();
posestack.m_166856_();
- posestack.m_85837_(0.0D, 0.0D, -2000.0D);
- posestack.m_252880_(0.0F, 0.0F, -2000.0F);
+ posestack.m_85837_(0.0D, 0.0D, 1000F-net.minecraftforge.client.ForgeHooksClient.getGuiFarPlane());
RenderSystem.m_157182_();
Lighting.m_84931_();
PoseStack posestack1 = new PoseStack();
@@ -888,7 +_,7 @@
@@ -923,7 +_,7 @@
}
} else if (this.f_109059_.f_91080_ != null) {
try {
- this.f_109059_.f_91080_.m_6305_(posestack1, i, j, this.f_109059_.m_91297_());
- this.f_109059_.f_91080_.m_257612_(posestack1, i, j, this.f_109059_.m_91297_());
+ net.minecraftforge.client.ForgeHooksClient.drawScreen(this.f_109059_.f_91080_, posestack1, i, j, this.f_109059_.m_91297_());
} catch (Throwable throwable1) {
CrashReport crashreport1 = CrashReport.m_127521_(throwable1, "Rendering screen");
CrashReportCategory crashreportcategory1 = crashreport1.m_127514_("Screen render details");
@@ -1047,6 +_,11 @@
Matrix4f matrix4f = posestack.m_85850_().m_85861_();
this.m_109111_(matrix4f);
@@ -1068,12 +_,19 @@
Matrix4f matrix4f = posestack.m_85850_().m_252922_();
this.m_252879_(matrix4f);
camera.m_90575_(this.f_109059_.f_91073_, (Entity)(this.f_109059_.m_91288_() == null ? this.f_109059_.f_91074_ : this.f_109059_.m_91288_()), !this.f_109059_.f_91066_.m_92176_().m_90612_(), this.f_109059_.f_91066_.m_92176_().m_90613_(), p_109090_);
+
+ net.minecraftforge.client.event.ViewportEvent.ComputeCameraAngles cameraSetup = net.minecraftforge.client.ForgeHooksClient.onCameraSetup(this, camera, p_109090_);
+ camera.setAnglesInternal(cameraSetup.getYaw(), cameraSetup.getPitch());
+ p_109092_.m_85845_(Vector3f.f_122227_.m_122240_(cameraSetup.getRoll()));
+ p_109092_.m_252781_(Axis.f_252403_.m_252977_(cameraSetup.getRoll()));
+
p_109092_.m_85845_(Vector3f.f_122223_.m_122240_(camera.m_90589_()));
p_109092_.m_85845_(Vector3f.f_122225_.m_122240_(camera.m_90590_() + 180.0F));
Matrix3f matrix3f = p_109092_.m_85850_().m_85864_().m_8183_();
@@ -1056,6 +_,8 @@
this.f_109059_.f_91060_.m_172961_(p_109092_, camera.m_90583_(), this.m_172716_(Math.max(d0, (double)this.f_109059_.f_91066_.m_231837_().m_231551_().intValue())));
p_109092_.m_252781_(Axis.f_252529_.m_252977_(camera.m_90589_()));
p_109092_.m_252781_(Axis.f_252436_.m_252977_(camera.m_90590_() + 180.0F));
Matrix3f matrix3f = (new Matrix3f(p_109092_.m_85850_().m_252943_())).invert();
RenderSystem.m_253212_(matrix3f);
this.f_109059_.f_91060_.m_253210_(p_109092_, camera.m_90583_(), this.m_253088_(Math.max(d0, (double)this.f_109059_.f_91066_.m_231837_().m_231551_().intValue())));
this.f_109059_.f_91060_.m_109599_(p_109092_, p_109090_, p_109091_, flag, camera, this, this.f_109074_, matrix4f);
+ this.f_109059_.m_91307_().m_6182_("forge_render_last");
+ net.minecraftforge.client.ForgeHooksClient.dispatchRenderLast(this.f_109059_.f_91060_, p_109092_, p_109090_, matrix4f, p_109091_);
@@ -8,15 +8,15 @@
private static final Map<Block, RenderType> f_109275_ = Util.m_137469_(Maps.newHashMap(), (p_109296_) -> {
RenderType rendertype = RenderType.m_110503_();
p_109296_.put(Blocks.f_50267_, rendertype);
@@ -296,6 +_,7 @@
@@ -298,6 +_,7 @@
p_109296_.put(Blocks.f_50628_, rendertype3);
p_109296_.put(Blocks.f_152498_, rendertype3);
p_109296_.put(Blocks.f_220862_, rendertype3);
});
+ @Deprecated
private static final Map<Fluid, RenderType> f_109276_ = Util.m_137469_(Maps.newHashMap(), (p_109290_) -> {
RenderType rendertype = RenderType.m_110466_();
p_109290_.put(Fluids.f_76192_, rendertype);
@@ -303,6 +_,8 @@
@@ -305,6 +_,8 @@
});
private static boolean f_109277_;
@@ -25,7 +25,7 @@
public static RenderType m_109282_(BlockState p_109283_) {
Block block = p_109283_.m_60734_();
if (block instanceof LeavesBlock) {
@@ -313,6 +_,8 @@
@@ -315,6 +_,8 @@
}
}
@@ -34,7 +34,7 @@
public static RenderType m_109293_(BlockState p_109294_) {
Block block = p_109294_.m_60734_();
if (block instanceof LeavesBlock) {
@@ -327,6 +_,8 @@
@@ -329,6 +_,8 @@
}
}
@@ -43,7 +43,7 @@
public static RenderType m_109284_(BlockState p_109285_, boolean p_109286_) {
RenderType rendertype = m_109282_(p_109285_);
if (rendertype == RenderType.m_110466_()) {
@@ -340,6 +_,8 @@
@@ -342,6 +_,8 @@
}
}
@@ -52,7 +52,7 @@
public static RenderType m_109279_(ItemStack p_109280_, boolean p_109281_) {
Item item = p_109280_.m_41720_();
if (item instanceof BlockItem) {
@@ -351,8 +_,73 @@
@@ -353,8 +_,73 @@
}
public static RenderType m_109287_(FluidState p_109288_) {
@@ -109,7 +109,7 @@
+ BLOCK_RENDER_TYPES.put(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(block), layers);
+ }
+
+ public static void setRenderLayer(Fluid fluid, RenderType type) {
+ public static synchronized void setRenderLayer(Fluid fluid, RenderType type) {
+ com.google.common.base.Preconditions.checkArgument(type.getChunkLayerId() >= 0, "The argument must be a valid chunk render type returned by RenderType#chunkBufferLayers().");
+ checkClientLoading();
+ FLUID_RENDER_TYPES.put(net.minecraftforge.registries.ForgeRegistries.FLUIDS.getDelegateOrThrow(fluid), type);
@@ -25,23 +25,23 @@
+ FogRenderer.m_234172_(p_109604_, FogRenderer.FogMode.FOG_SKY, f, flag2, p_109601_);
profilerfiller.m_6182_("sky");
RenderSystem.m_157427_(GameRenderer::m_172808_);
this.m_202423_(p_109600_, p_109607_, p_109601_, p_109604_, flag2, () -> {
this.m_202423_(p_109600_, p_254120_, p_109601_, p_109604_, flag2, () -> {
FogRenderer.m_234172_(p_109604_, FogRenderer.FogMode.FOG_SKY, f, flag2, p_109601_);
});
+ net.minecraftforge.client.ForgeHooksClient.dispatchRenderStage(net.minecraftforge.client.event.RenderLevelStageEvent.Stage.AFTER_SKY, this, p_109600_, p_109607_, this.f_109477_, p_109604_, frustum);
+ net.minecraftforge.client.ForgeHooksClient.dispatchRenderStage(net.minecraftforge.client.event.RenderLevelStageEvent.Stage.AFTER_SKY, this, p_109600_, p_254120_, this.f_109477_, p_109604_, frustum);
profilerfiller.m_6182_("fog");
FogRenderer.m_234172_(p_109604_, FogRenderer.FogMode.FOG_TERRAIN, Math.max(f, 32.0F), flag2, p_109601_);
profilerfiller.m_6182_("terrain_setup");
@@ -1154,7 +_,9 @@
this.m_194370_(p_109604_);
profilerfiller.m_6182_("terrain");
this.m_172993_(RenderType.m_110451_(), p_109600_, d0, d1, d2, p_109607_);
this.m_172993_(RenderType.m_110451_(), p_109600_, d0, d1, d2, p_254120_);
+ this.f_109461_.m_91304_().m_119428_(TextureAtlas.f_118259_).setBlurMipmap(false, this.f_109461_.f_91066_.m_232119_().m_231551_() > 0); // FORGE: fix flickering leaves when mods mess up the blurMipmap settings
this.m_172993_(RenderType.m_110457_(), p_109600_, d0, d1, d2, p_109607_);
this.m_172993_(RenderType.m_110457_(), p_109600_, d0, d1, d2, p_254120_);
+ this.f_109461_.m_91304_().m_119428_(TextureAtlas.f_118259_).restoreLastBlurMipmap();
this.m_172993_(RenderType.m_110463_(), p_109600_, d0, d1, d2, p_109607_);
this.m_172993_(RenderType.m_110463_(), p_109600_, d0, d1, d2, p_254120_);
if (this.f_109465_.m_104583_().m_108885_()) {
Lighting.m_84925_(p_109600_.m_85850_().m_85861_());
Lighting.m_252995_(p_109600_.m_85850_().m_252922_());
@@ -1186,7 +_,7 @@
for(Entity entity : this.f_109465_.m_104735_()) {
if (this.f_109463_.m_114397_(entity, frustum, d0, d1, d2) || entity.m_20367_(this.f_109461_.f_91074_)) {
@@ -93,17 +93,17 @@
this.f_172946_.m_112267_(blockentity, p_109601_, p_109600_, multibuffersource$buffersource);
p_109600_.m_85849_();
}
@@ -1290,7 +_,8 @@
@@ -1291,7 +_,8 @@
p_109600_.m_85837_((double)blockpos2.m_123341_() - d0, (double)blockpos2.m_123342_() - d1, (double)blockpos2.m_123343_() - d2);
PoseStack.Pose posestack$pose = p_109600_.m_85850_();
VertexConsumer vertexconsumer1 = new SheetedDecalTextureGenerator(this.f_109464_.m_110108_().m_6299_(ModelBakery.f_119229_.get(k1)), posestack$pose.m_85861_(), posestack$pose.m_85864_());
VertexConsumer vertexconsumer1 = new SheetedDecalTextureGenerator(this.f_109464_.m_110108_().m_6299_(ModelBakery.f_119229_.get(k1)), posestack$pose.m_252922_(), posestack$pose.m_252943_(), 1.0F);
- this.f_109461_.m_91289_().m_110918_(this.f_109465_.m_8055_(blockpos2), blockpos2, this.f_109465_, p_109600_, vertexconsumer1);
+ net.minecraftforge.client.model.data.ModelData modelData = f_109465_.getModelDataManager().getAt(blockpos2);
+ this.f_109461_.m_91289_().renderBreakingTexture(this.f_109465_.m_8055_(blockpos2), blockpos2, this.f_109465_, p_109600_, vertexconsumer1, modelData == null ? net.minecraftforge.client.model.data.ModelData.EMPTY : modelData);
p_109600_.m_85849_();
}
}
@@ -1302,10 +_,13 @@
@@ -1303,10 +_,13 @@
profilerfiller.m_6182_("outline");
BlockPos blockpos1 = ((BlockHitResult)hitresult).m_82425_();
BlockState blockstate = this.f_109465_.m_8055_(blockpos1);
@@ -117,77 +117,77 @@
}
PoseStack posestack = RenderSystem.m_157191_();
@@ -1340,7 +_,8 @@
@@ -1341,7 +_,8 @@
this.f_109415_.m_83945_(this.f_109461_.m_91385_());
RenderStateShard.f_110126_.m_110185_();
profilerfiller.m_6182_("particles");
- this.f_109461_.f_91061_.m_107336_(p_109600_, multibuffersource$buffersource, p_109606_, p_109604_, p_109601_);
+ this.f_109461_.f_91061_.render(p_109600_, multibuffersource$buffersource, p_109606_, p_109604_, p_109601_, frustum);
+ net.minecraftforge.client.ForgeHooksClient.dispatchRenderStage(net.minecraftforge.client.event.RenderLevelStageEvent.Stage.AFTER_PARTICLES, this, p_109600_, p_109607_, this.f_109477_, p_109604_, frustum);
+ net.minecraftforge.client.ForgeHooksClient.dispatchRenderStage(net.minecraftforge.client.event.RenderLevelStageEvent.Stage.AFTER_PARTICLES, this, p_109600_, p_254120_, this.f_109477_, p_109604_, frustum);
RenderStateShard.f_110126_.m_110188_();
} else {
profilerfiller.m_6182_("translucent");
@@ -1354,7 +_,8 @@
@@ -1355,7 +_,8 @@
profilerfiller.m_6182_("string");
this.m_172993_(RenderType.m_110503_(), p_109600_, d0, d1, d2, p_109607_);
this.m_172993_(RenderType.m_110503_(), p_109600_, d0, d1, d2, p_254120_);
profilerfiller.m_6182_("particles");
- this.f_109461_.f_91061_.m_107336_(p_109600_, multibuffersource$buffersource, p_109606_, p_109604_, p_109601_);
+ this.f_109461_.f_91061_.render(p_109600_, multibuffersource$buffersource, p_109606_, p_109604_, p_109601_, frustum);
+ net.minecraftforge.client.ForgeHooksClient.dispatchRenderStage(net.minecraftforge.client.event.RenderLevelStageEvent.Stage.AFTER_PARTICLES, this, p_109600_, p_109607_, this.f_109477_, p_109604_, frustum);
+ net.minecraftforge.client.ForgeHooksClient.dispatchRenderStage(net.minecraftforge.client.event.RenderLevelStageEvent.Stage.AFTER_PARTICLES, this, p_109600_, p_254120_, this.f_109477_, p_109604_, frustum);
}
posestack.m_85836_();
@@ -1378,6 +_,7 @@
@@ -1379,6 +_,7 @@
RenderStateShard.f_110127_.m_110185_();
profilerfiller.m_6182_("weather");
this.m_109703_(p_109606_, p_109601_, d0, d1, d2);
+ net.minecraftforge.client.ForgeHooksClient.dispatchRenderStage(net.minecraftforge.client.event.RenderLevelStageEvent.Stage.AFTER_WEATHER, this, p_109600_, p_109607_, this.f_109477_, p_109604_, frustum);
+ net.minecraftforge.client.ForgeHooksClient.dispatchRenderStage(net.minecraftforge.client.event.RenderLevelStageEvent.Stage.AFTER_WEATHER, this, p_109600_, p_254120_, this.f_109477_, p_109604_, frustum);
this.m_173012_(p_109604_);
RenderStateShard.f_110127_.m_110188_();
this.f_109418_.m_110023_(p_109601_);
@@ -1386,6 +_,7 @@
@@ -1387,6 +_,7 @@
RenderSystem.m_69458_(false);
profilerfiller.m_6182_("weather");
this.m_109703_(p_109606_, p_109601_, d0, d1, d2);
+ net.minecraftforge.client.ForgeHooksClient.dispatchRenderStage(net.minecraftforge.client.event.RenderLevelStageEvent.Stage.AFTER_WEATHER, this, p_109600_, p_109607_, this.f_109477_, p_109604_, frustum);
+ net.minecraftforge.client.ForgeHooksClient.dispatchRenderStage(net.minecraftforge.client.event.RenderLevelStageEvent.Stage.AFTER_WEATHER, this, p_109600_, p_254120_, this.f_109477_, p_109604_, frustum);
this.m_173012_(p_109604_);
RenderSystem.m_69458_(true);
}
@@ -1520,6 +_,7 @@
@@ -1521,6 +_,7 @@
shaderinstance.m_173362_();
VertexBuffer.m_85931_();
this.f_109461_.m_91307_().m_7238_();
+ net.minecraftforge.client.ForgeHooksClient.dispatchRenderStage(p_172994_, this, p_172995_, p_172999_, this.f_109477_, this.f_109461_.f_91063_.m_109153_(), this.f_109442_ != null ? this.f_109442_ : this.f_172938_);
+ net.minecraftforge.client.ForgeHooksClient.dispatchRenderStage(p_172994_, this, p_172995_, p_254039_, this.f_109477_, this.f_109461_.f_91063_.m_109153_(), this.f_109442_ != null ? this.f_109442_ : this.f_172938_);
p_172994_.m_110188_();
}
@@ -1781,6 +_,8 @@
@@ -1782,6 +_,8 @@
}
public void m_202423_(PoseStack p_202424_, Matrix4f p_202425_, float p_202426_, Camera p_202427_, boolean p_202428_, Runnable p_202429_) {
+ if (f_109465_.m_104583_().renderSky(f_109465_, f_109477_, p_202426_, p_202424_, p_202427_, p_202425_, p_202428_, p_202429_))
public void m_202423_(PoseStack p_202424_, Matrix4f p_254034_, float p_202426_, Camera p_202427_, boolean p_202428_, Runnable p_202429_) {
+ if (f_109465_.m_104583_().renderSky(f_109465_, f_109477_, p_202426_, p_202424_, p_202427_, p_254034_, p_202428_, p_202429_))
+ return;
p_202429_.run();
if (!p_202428_) {
FogType fogtype = p_202427_.m_167685_();
@@ -1913,6 +_,8 @@
@@ -1914,6 +_,8 @@
}
public void m_172954_(PoseStack p_172955_, Matrix4f p_172956_, float p_172957_, double p_172958_, double p_172959_, double p_172960_) {
+ if (f_109465_.m_104583_().renderClouds(f_109465_, f_109477_, p_172957_, p_172955_, p_172958_, p_172959_, p_172960_, p_172956_))
public void m_253054_(PoseStack p_254145_, Matrix4f p_254537_, float p_254364_, double p_253843_, double p_253663_, double p_253795_) {
+ if (f_109465_.m_104583_().renderClouds(f_109465_, f_109477_, p_254364_, p_254145_, p_253843_, p_253663_, p_253795_, p_254537_))
+ return;
float f = this.f_109465_.m_104583_().m_108871_();
if (!Float.isNaN(f)) {
RenderSystem.m_69464_();
@@ -2103,7 +_,7 @@
}
} else {
@@ -2100,7 +_,7 @@
boolean flag = false;
if (this.f_109461_.f_91066_.m_232080_().m_231551_() == PrioritizeChunkUpdates.NEARBY) {
BlockPos blockpos1 = chunkrenderdispatcher$renderchunk.m_112839_().m_7918_(8, 8, 8);
- flag = blockpos1.m_123331_(blockpos) < 768.0D || chunkrenderdispatcher$renderchunk.m_112842_();
+ flag = !net.minecraftforge.common.ForgeConfig.CLIENT.alwaysSetupTerrainOffThread.get() && (blockpos1.m_123331_(blockpos) < 768.0D || chunkrenderdispatcher$renderchunk.m_112842_()); // the target is the else block below, so invert the forge addition to get there early
} else if (this.f_109461_.f_91066_.m_232080_().m_231551_() == PrioritizeChunkUpdates.PLAYER_AFFECTED) {
flag = chunkrenderdispatcher$renderchunk.m_112842_();
}
if (flag) {
@@ -2400,7 +_,12 @@
this.f_109469_.m_110859_(p_109502_, p_109503_, p_109504_, p_109505_);
}
@@ -210,7 +210,7 @@
if (recorditem != null) {
this.f_109461_.f_91065_.m_93055_(recorditem.m_43050_());
}
@@ -2560,7 +_,7 @@
@@ -2548,7 +_,7 @@
break;
case 1010:
if (Item.m_41445_(p_234307_) instanceof RecordItem) {
@@ -219,16 +219,16 @@
} else {
this.m_109514_((SoundEvent)null, p_234306_);
}
@@ -2730,7 +_,7 @@
@@ -2700,7 +_,7 @@
case 2001:
BlockState blockstate = Block.m_49803_(p_234307_);
if (!blockstate.m_60795_()) {
- SoundType soundtype = blockstate.m_60827_();
+ SoundType soundtype = blockstate.getSoundType(this.f_109465_, p_234306_, null);
this.f_109465_.m_104677_(p_234306_, soundtype.m_56775_(), SoundSource.BLOCKS, (soundtype.m_56773_() + 1.0F) / 2.0F, soundtype.m_56774_() * 0.8F, false);
this.f_109465_.m_245747_(p_234306_, soundtype.m_56775_(), SoundSource.BLOCKS, (soundtype.m_56773_() + 1.0F) / 2.0F, soundtype.m_56774_() * 0.8F, false);
}
@@ -2945,7 +_,7 @@
@@ -2915,7 +_,7 @@
} else {
int i = p_109538_.m_45517_(LightLayer.SKY, p_109540_);
int j = p_109538_.m_45517_(LightLayer.BLOCK, p_109540_);
@@ -1,13 +1,13 @@
--- a/net/minecraft/client/renderer/LightTexture.java
+++ b/net/minecraft/client/renderer/LightTexture.java
@@ -138,6 +_,8 @@
@@ -136,6 +_,8 @@
}
}
+ clientlevel.m_104583_().adjustLightmapColors(clientlevel, p_109882_, f, f7, f8, j, i, vector3f1);
+
if (f5 > 0.0F) {
float f13 = Math.max(vector3f1.m_122239_(), Math.max(vector3f1.m_122260_(), vector3f1.m_122269_()));
float f13 = Math.max(vector3f1.x(), Math.max(vector3f1.y(), vector3f1.z()));
if (f13 < 1.0F) {
@@ -193,7 +_,7 @@
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/renderer/PostChain.java
+++ b/net/minecraft/client/renderer/PostChain.java
@@ -173,7 +_,8 @@
@@ -157,7 +_,8 @@
throw new ChainedJsonException("Render target '" + s4 + "' can't be used as depth buffer");
}
@@ -10,7 +10,7 @@
this.f_110007_.m_213713_(resourcelocation).orElseThrow(() -> {
return new ChainedJsonException("Render target or texture '" + s4 + "' does not exist");
});
@@ -276,6 +_,7 @@
@@ -260,6 +_,7 @@
public void m_110038_(String p_110039_, int p_110040_, int p_110041_) {
RenderTarget rendertarget = new TextureTarget(p_110040_, p_110041_, true, Minecraft.f_91002_);
rendertarget.m_83931_(0.0F, 0.0F, 0.0F, 0.0F);
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/renderer/ShaderInstance.java
+++ b/net/minecraft/client/renderer/ShaderInstance.java
@@ -95,10 +_,14 @@
@@ -96,10 +_,14 @@
@Nullable
public final Uniform f_173320_;
@@ -15,9 +15,9 @@
- ResourceLocation resourcelocation = new ResourceLocation("shaders/core/" + p_173337_ + ".json");
+ ResourceLocation resourcelocation = new ResourceLocation(shaderLocation.m_135827_(), "shaders/core/" + shaderLocation.m_135815_() + ".json");
try {
Reader reader = p_173336_.m_215597_(resourcelocation);
@@ -222,8 +_,10 @@
try (Reader reader = p_173336_.m_215597_(resourcelocation)) {
JsonObject jsonobject = GsonHelper.m_13859_(reader);
@@ -205,8 +_,10 @@
Program program1 = p_173342_.m_85570_().get(p_173343_);
Program program;
if (program1 == null) {
@@ -27,6 +27,31 @@
+ String s = "shaders/core/" + loc.m_135815_() + p_173342_.m_85569_();
+ ResourceLocation resourcelocation = new ResourceLocation(loc.m_135827_(), s);
+ Resource resource = p_173341_.m_215593_(resourcelocation);
InputStream inputstream = resource.m_215507_();
try {
try (InputStream inputstream = resource.m_215507_()) {
final String s1 = FileUtil.m_179922_(s);
@@ -214,11 +_,11 @@
private final Set<String> f_173369_ = Sets.newHashSet();
public String m_142138_(boolean p_173374_, String p_173375_) {
- p_173375_ = FileUtil.m_179924_((p_173374_ ? s1 : "shaders/include/") + p_173375_);
- if (!this.f_173369_.add(p_173375_)) {
+ // FORGE: use the mod's namespace to look up resources if specified
+ ResourceLocation resourcelocation = net.minecraftforge.client.ForgeHooksClient.getShaderImportLocation(s1, p_173374_, p_173375_);
+ if (!this.f_173369_.add(resourcelocation.toString())) {
return null;
} else {
- ResourceLocation resourcelocation = new ResourceLocation(p_173375_);
try {
String s2;
@@ -228,7 +_,8 @@
return s2;
} catch (IOException ioexception) {
- ShaderInstance.f_173323_.error("Could not open GLSL import {}: {}", p_173375_, ioexception.getMessage());
+ // FORGE: specify the namespace of the failed import in case of duplicates from multiple mods
+ ShaderInstance.f_173323_.error("Could not open GLSL import {}: {}", resourcelocation, ioexception.getMessage());
return "#error " + ioexception.getMessage();
}
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/renderer/Sheets.java
+++ b/net/minecraft/client/renderer/Sheets.java
@@ -129,7 +_,8 @@
@@ -135,11 +_,13 @@
}
private static Material m_173385_(WoodType p_173386_) {
@@ -9,8 +9,14 @@
+ return new Material(f_110739_, new ResourceLocation(location.m_135827_(), "entity/signs/" + location.m_135815_()));
}
private static Material m_245275_(WoodType p_251735_) {
- return new Material(f_110739_, new ResourceLocation("entity/signs/hanging/" + p_251735_.m_61846_()));
+ ResourceLocation location = new ResourceLocation(p_251735_.m_61846_());
+ return new Material(f_110739_, new ResourceLocation(location.m_135827_(), "entity/signs/hanging/" + location.m_135815_()));
}
public static Material m_173381_(WoodType p_173382_) {
@@ -176,5 +_,12 @@
@@ -190,5 +_,12 @@
default:
return p_110773_;
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/renderer/block/BlockModelShaper.java
+++ b/net/minecraft/client/renderer/block/BlockModelShaper.java
@@ -23,8 +_,15 @@
@@ -21,8 +_,15 @@
this.f_110878_ = p_110880_;
}
@@ -9,7 +9,7 @@
this.f_110901_ = new LiquidBlockRenderer();
}
@@ -45,19 +_,27 @@
@@ -45,19 +_,30 @@
return this.f_110899_;
}
@@ -31,11 +31,14 @@
+ renderBatched(p_234356_, p_234357_, p_234358_, p_234359_, p_234360_, p_234361_, p_234362_, net.minecraftforge.client.model.data.ModelData.EMPTY, null);
+ }
+ public void renderBatched(BlockState p_234356_, BlockPos p_234357_, BlockAndTintGetter p_234358_, PoseStack p_234359_, VertexConsumer p_234360_, boolean p_234361_, RandomSource p_234362_, net.minecraftforge.client.model.data.ModelData modelData, net.minecraft.client.renderer.RenderType renderType) {
+ renderBatched(p_234356_, p_234357_, p_234358_, p_234359_, p_234360_, p_234361_, p_234362_, modelData, renderType, true);
+ }
+ public void renderBatched(BlockState p_234356_, BlockPos p_234357_, BlockAndTintGetter p_234358_, PoseStack p_234359_, VertexConsumer p_234360_, boolean p_234361_, RandomSource p_234362_, net.minecraftforge.client.model.data.ModelData modelData, net.minecraft.client.renderer.RenderType renderType, boolean queryModelSpecificData) { // TODO 1.20: Move to the signature above
try {
RenderShape rendershape = p_234356_.m_60799_();
if (rendershape == RenderShape.MODEL) {
- this.f_110900_.m_234379_(p_234358_, this.m_110910_(p_234356_), p_234356_, p_234357_, p_234359_, p_234360_, p_234361_, p_234362_, p_234356_.m_60726_(p_234357_), OverlayTexture.f_118083_);
+ this.f_110900_.tesselateBlock(p_234358_, this.m_110910_(p_234356_), p_234356_, p_234357_, p_234359_, p_234360_, p_234361_, p_234362_, p_234356_.m_60726_(p_234357_), OverlayTexture.f_118083_, modelData, renderType);
+ this.f_110900_.tesselateBlock(p_234358_, this.m_110910_(p_234356_), p_234356_, p_234357_, p_234359_, p_234360_, p_234361_, p_234362_, p_234356_.m_60726_(p_234357_), OverlayTexture.f_118083_, modelData, renderType, queryModelSpecificData); // TODO 1.20: Remove last argument
}
} catch (Throwable throwable) {
@@ -12,48 +12,46 @@
float f = (float)(i >> 16 & 255) / 255.0F;
float f1 = (float)(i >> 8 & 255) / 255.0F;
float f2 = (float)(i & 255) / 255.0F;
@@ -180,15 +_,16 @@
float f30 = f4 * f;
float f31 = f4 * f1;
float f32 = f4 * f2;
- this.m_110984_(p_234372_, d1 + 0.0D, d2 + (double)f8, d0 + 0.0D, f30, f31, f32, f18, f22, j);
- this.m_110984_(p_234372_, d1 + 0.0D, d2 + (double)f10, d0 + 1.0D, f30, f31, f32, f19, f23, j);
- this.m_110984_(p_234372_, d1 + 1.0D, d2 + (double)f9, d0 + 1.0D, f30, f31, f32, f20, f24, j);
- this.m_110984_(p_234372_, d1 + 1.0D, d2 + (double)f7, d0 + 0.0D, f30, f31, f32, f21, f25, j);
+
+ this.vertex(p_234372_, d1 + 0.0D, d2 + (double)f8, d0 + 0.0D, f30, f31, f32, alpha, f18, f22, j);
+ this.vertex(p_234372_, d1 + 0.0D, d2 + (double)f10, d0 + 1.0D, f30, f31, f32, alpha, f19, f23, j);
+ this.vertex(p_234372_, d1 + 1.0D, d2 + (double)f9, d0 + 1.0D, f30, f31, f32, alpha, f20, f24, j);
+ this.vertex(p_234372_, d1 + 1.0D, d2 + (double)f7, d0 + 0.0D, f30, f31, f32, alpha, f21, f25, j);
@@ -178,15 +_,15 @@
float f52 = f4 * f;
float f30 = f4 * f1;
float f31 = f4 * f2;
- this.m_110984_(p_234372_, d1 + 0.0D, d2 + (double)f8, d0 + 0.0D, f52, f30, f31, f18, f22, l);
- this.m_110984_(p_234372_, d1 + 0.0D, d2 + (double)f10, d0 + 1.0D, f52, f30, f31, f19, f23, l);
- this.m_110984_(p_234372_, d1 + 1.0D, d2 + (double)f9, d0 + 1.0D, f52, f30, f31, f20, f24, l);
- this.m_110984_(p_234372_, d1 + 1.0D, d2 + (double)f7, d0 + 0.0D, f52, f30, f31, f21, f25, l);
+ this.vertex(p_234372_, d1 + 0.0D, d2 + (double)f8, d0 + 0.0D, f52, f30, f31, alpha, f18, f22, l);
+ this.vertex(p_234372_, d1 + 0.0D, d2 + (double)f10, d0 + 1.0D, f52, f30, f31, alpha, f19, f23, l);
+ this.vertex(p_234372_, d1 + 1.0D, d2 + (double)f9, d0 + 1.0D, f52, f30, f31, alpha, f20, f24, l);
+ this.vertex(p_234372_, d1 + 1.0D, d2 + (double)f7, d0 + 0.0D, f52, f30, f31, alpha, f21, f25, l);
if (p_234374_.m_76171_(p_234370_, p_234371_.m_7494_())) {
- this.m_110984_(p_234372_, d1 + 0.0D, d2 + (double)f8, d0 + 0.0D, f30, f31, f32, f18, f22, j);
- this.m_110984_(p_234372_, d1 + 1.0D, d2 + (double)f7, d0 + 0.0D, f30, f31, f32, f21, f25, j);
- this.m_110984_(p_234372_, d1 + 1.0D, d2 + (double)f9, d0 + 1.0D, f30, f31, f32, f20, f24, j);
- this.m_110984_(p_234372_, d1 + 0.0D, d2 + (double)f10, d0 + 1.0D, f30, f31, f32, f19, f23, j);
+ this.vertex(p_234372_, d1 + 0.0D, d2 + (double)f8, d0 + 0.0D, f30, f31, f32, alpha, f18, f22, j);
+ this.vertex(p_234372_, d1 + 1.0D, d2 + (double)f7, d0 + 0.0D, f30, f31, f32, alpha, f21, f25, j);
+ this.vertex(p_234372_, d1 + 1.0D, d2 + (double)f9, d0 + 1.0D, f30, f31, f32, alpha, f20, f24, j);
+ this.vertex(p_234372_, d1 + 0.0D, d2 + (double)f10, d0 + 1.0D, f30, f31, f32, alpha, f19, f23, j);
- this.m_110984_(p_234372_, d1 + 0.0D, d2 + (double)f8, d0 + 0.0D, f52, f30, f31, f18, f22, l);
- this.m_110984_(p_234372_, d1 + 1.0D, d2 + (double)f7, d0 + 0.0D, f52, f30, f31, f21, f25, l);
- this.m_110984_(p_234372_, d1 + 1.0D, d2 + (double)f9, d0 + 1.0D, f52, f30, f31, f20, f24, l);
- this.m_110984_(p_234372_, d1 + 0.0D, d2 + (double)f10, d0 + 1.0D, f52, f30, f31, f19, f23, l);
+ this.vertex(p_234372_, d1 + 0.0D, d2 + (double)f8, d0 + 0.0D, f52, f30, f31, alpha, f18, f22, l);
+ this.vertex(p_234372_, d1 + 1.0D, d2 + (double)f7, d0 + 0.0D, f52, f30, f31, alpha, f21, f25, l);
+ this.vertex(p_234372_, d1 + 1.0D, d2 + (double)f9, d0 + 1.0D, f52, f30, f31, alpha, f20, f24, l);
+ this.vertex(p_234372_, d1 + 0.0D, d2 + (double)f10, d0 + 1.0D, f52, f30, f31, alpha, f19, f23, l);
}
}
@@ -201,10 +_,11 @@
@@ -199,10 +_,10 @@
float f46 = f3 * f;
float f47 = f3 * f1;
float f48 = f3 * f2;
- this.m_110984_(p_234372_, d1, d2 + (double)f17, d0 + 1.0D, f46, f47, f48, f40, f43, l);
- this.m_110984_(p_234372_, d1, d2 + (double)f17, d0, f46, f47, f48, f40, f42, l);
- this.m_110984_(p_234372_, d1 + 1.0D, d2 + (double)f17, d0, f46, f47, f48, f41, f42, l);
- this.m_110984_(p_234372_, d1 + 1.0D, d2 + (double)f17, d0 + 1.0D, f46, f47, f48, f41, f43, l);
+
+ this.vertex(p_234372_, d1, d2 + (double)f17, d0 + 1.0D, f46, f47, f48, alpha, f40, f43, l);
+ this.vertex(p_234372_, d1, d2 + (double)f17, d0, f46, f47, f48, alpha, f40, f42, l);
+ this.vertex(p_234372_, d1 + 1.0D, d2 + (double)f17, d0, f46, f47, f48, alpha, f41, f42, l);
+ this.vertex(p_234372_, d1 + 1.0D, d2 + (double)f17, d0 + 1.0D, f46, f47, f48, alpha, f41, f43, l);
- this.m_110984_(p_234372_, d1, d2 + (double)f17, d0 + 1.0D, f46, f47, f48, f40, f43, k);
- this.m_110984_(p_234372_, d1, d2 + (double)f17, d0, f46, f47, f48, f40, f42, k);
- this.m_110984_(p_234372_, d1 + 1.0D, d2 + (double)f17, d0, f46, f47, f48, f41, f42, k);
- this.m_110984_(p_234372_, d1 + 1.0D, d2 + (double)f17, d0 + 1.0D, f46, f47, f48, f41, f43, k);
+ this.vertex(p_234372_, d1, d2 + (double)f17, d0 + 1.0D, f46, f47, f48, alpha, f40, f43, k);
+ this.vertex(p_234372_, d1, d2 + (double)f17, d0, f46, f47, f48, alpha, f40, f42, k);
+ this.vertex(p_234372_, d1 + 1.0D, d2 + (double)f17, d0, f46, f47, f48, alpha, f41, f42, k);
+ this.vertex(p_234372_, d1 + 1.0D, d2 + (double)f17, d0 + 1.0D, f46, f47, f48, alpha, f41, f43, k);
}
int k = this.m_110945_(p_234370_, p_234371_);
@@ -258,10 +_,9 @@
int j = this.m_110945_(p_234370_, p_234371_);
@@ -256,10 +_,9 @@
if (flag7 && !m_203179_(p_234370_, p_234371_, direction, Math.max(f44, f45), p_234370_.m_8055_(p_234371_.m_121945_(direction)))) {
BlockPos blockpos = p_234371_.m_121945_(direction);
TextureAtlasSprite textureatlassprite2 = atextureatlassprite[1];
@@ -67,39 +65,38 @@
}
}
@@ -274,15 +_,16 @@
@@ -272,15 +_,15 @@
float f37 = f4 * f36 * f;
float f38 = f4 * f36 * f1;
float f39 = f4 * f36 * f2;
- this.m_110984_(p_234372_, d3, d2 + (double)f44, d4, f37, f38, f39, f54, f33, k);
- this.m_110984_(p_234372_, d5, d2 + (double)f45, d6, f37, f38, f39, f55, f34, k);
- this.m_110984_(p_234372_, d5, d2 + (double)f17, d6, f37, f38, f39, f55, f35, k);
- this.m_110984_(p_234372_, d3, d2 + (double)f17, d4, f37, f38, f39, f54, f35, k);
+
+ this.vertex(p_234372_, d3, d2 + (double)f44, d4, f37, f38, f39, alpha, f54, f33, k);
+ this.vertex(p_234372_, d5, d2 + (double)f45, d6, f37, f38, f39, alpha, f55, f34, k);
+ this.vertex(p_234372_, d5, d2 + (double)f17, d6, f37, f38, f39, alpha, f55, f35, k);
+ this.vertex(p_234372_, d3, d2 + (double)f17, d4, f37, f38, f39, alpha, f54, f35, k);
- this.m_110984_(p_234372_, d3, d2 + (double)f44, d4, f37, f38, f39, f53, f33, j);
- this.m_110984_(p_234372_, d5, d2 + (double)f45, d6, f37, f38, f39, f32, f34, j);
- this.m_110984_(p_234372_, d5, d2 + (double)f17, d6, f37, f38, f39, f32, f35, j);
- this.m_110984_(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, alpha, f53, f33, j);
+ this.vertex(p_234372_, d5, d2 + (double)f45, d6, f37, f38, f39, alpha, f32, f34, j);
+ this.vertex(p_234372_, d5, d2 + (double)f17, d6, f37, f38, f39, alpha, f32, f35, j);
+ this.vertex(p_234372_, d3, d2 + (double)f17, d4, f37, f38, f39, alpha, f53, f35, j);
if (textureatlassprite2 != this.f_110942_) {
- this.m_110984_(p_234372_, d3, d2 + (double)f17, d4, f37, f38, f39, f54, f35, k);
- this.m_110984_(p_234372_, d5, d2 + (double)f17, d6, f37, f38, f39, f55, f35, k);
- this.m_110984_(p_234372_, d5, d2 + (double)f45, d6, f37, f38, f39, f55, f34, k);
- this.m_110984_(p_234372_, d3, d2 + (double)f44, d4, f37, f38, f39, f54, f33, k);
+ this.vertex(p_234372_, d3, d2 + (double)f17, d4, f37, f38, f39, alpha, f54, f35, k);
+ this.vertex(p_234372_, d5, d2 + (double)f17, d6, f37, f38, f39, alpha, f55, f35, k);
+ this.vertex(p_234372_, d5, d2 + (double)f45, d6, f37, f38, f39, alpha, f55, f34, k);
+ this.vertex(p_234372_, d3, d2 + (double)f44, d4, f37, f38, f39, alpha, f54, f33, k);
- this.m_110984_(p_234372_, d3, d2 + (double)f17, d4, f37, f38, f39, f53, f35, j);
- this.m_110984_(p_234372_, d5, d2 + (double)f17, d6, f37, f38, f39, f32, f35, j);
- this.m_110984_(p_234372_, d5, d2 + (double)f45, d6, f37, f38, f39, f32, f34, j);
- this.m_110984_(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, alpha, f53, f35, j);
+ this.vertex(p_234372_, d5, d2 + (double)f17, d6, f37, f38, f39, alpha, f32, f35, j);
+ this.vertex(p_234372_, d5, d2 + (double)f45, d6, f37, f38, f39, alpha, f32, f34, j);
+ this.vertex(p_234372_, d3, d2 + (double)f44, d4, f37, f38, f39, alpha, f53, f33, j);
}
}
}
@@ -336,8 +_,8 @@
@@ -334,8 +_,8 @@
}
}
- private void m_110984_(VertexConsumer p_110985_, double p_110986_, double p_110987_, double p_110988_, float p_110989_, float p_110990_, float p_110991_, float p_110992_, float p_110993_, int p_110994_) {
- p_110985_.m_5483_(p_110986_, p_110987_, p_110988_).m_85950_(p_110989_, p_110990_, p_110991_, 1.0F).m_7421_(p_110992_, p_110993_).m_85969_(p_110994_).m_5601_(0.0F, 1.0F, 0.0F).m_5752_();
+ private void vertex(VertexConsumer p_110985_, double p_110986_, double p_110987_, double p_110988_, float p_110989_, float p_110990_, float p_110991_, float alpha, float p_110992_, float p_110993_, int p_110994_) {
+ p_110985_.m_5483_(p_110986_, p_110987_, p_110988_).m_85950_(p_110989_, p_110990_, p_110991_, alpha).m_7421_(p_110992_, p_110993_).m_85969_(p_110994_).m_5601_(0.0F, 1.0F, 0.0F).m_5752_();
+ p_110985_.m_5483_(p_110986_, p_110987_, p_110988_).m_85950_(p_110989_, p_110990_, p_110991_, alpha).m_7421_(p_110992_, p_110993_).m_85969_(p_110994_).m_5601_(0.0F, 1.0F, 0.0F).m_5752_();
}
private int m_110945_(BlockAndTintGetter p_110946_, BlockPos p_110947_) {
Loaded 100 of 850 files, more files were not shown because too many files have changed in this diff. Show more