Compare commits

..
111 Commits
Author SHA1 Message Date
LexManos 664a2c06ad 1.19.4 RB 2 2023-09-21 11:52:10 -07:00
Paint_Ninjaandmalte0811 e85295a837 Fix Level leak in debug HUD (#9700)
Co-authored-by: malte0811 <[email protected]>
2023-09-02 17:02:03 -07:00
Paint_Ninjaanddhyces 21582ef641 Keep order of sources in PackRepository (#9703)
Co-authored-by: dhyces <[email protected]>
2023-09-02 16:21:21 -07:00
Paint_Ninja 020ec3d51b Fix DelegatingPackResources searching resource path twice (#9698) 2023-08-30 14:10:38 -07:00
Jonathan Colmenares 774b79e609 Fix parameter names in IForgeDimensionSpecialEffects.adjustLightmapColors to better describe what they are. (#9657) 2023-07-17 09:45:29 -07:00
Jonathan Colmenares ee6022b006 Add mods button to pause menu (#9654) 2023-07-17 08:41:11 -07:00
brandon3055 37efd2b8ae Fixed FluidUtil#tryFillContainer returning invalid result when simulating #9358 2023-07-15 10:52:26 -07:00
Random832 cf3d42ef38 Fix conflicting keybindings not having the correct click count set. #9360 2023-07-15 10:44:29 -07:00
RealMangoRage 03a505a3f2 Fixed AdvancementsScreen.java to render next/previous page buttons now. (#9650) 2023-07-14 19:22:33 -07:00
ChampionAsh5357 bdc856edf5 Properly Handle Fluid Updates while in a Boat Fix #9256 (#9428) 2023-07-14 19:06:07 -07:00
Silver_David 6eebea0896 New hook in IClientBlockExtensions to handle enabling tinting on breaking particles. #9446 2023-07-14 16:08:51 -07:00
Technici4n 9218e08955 Add EmptyEnergyStorage (#9487) 2023-07-14 11:34:12 -07:00
Paint_Ninja 7006fe4f29 Support IPv6 address compression for logged IPs 2023-07-14 11:30:57 -07:00
Paint_Ninja 301e7252b0 Add option to advertise dedicated servers to LAN. (#9502) 2023-07-14 07:07:36 -07:00
ChampionAsh5357 2b5852072c Add particle description data provider (#9510) 2023-07-13 19:35:07 -07:00
bconlon 0b38373a45 AlterGroundEvent for modifying block placement performed by AlterGroundDecorator (#9636) 2023-07-13 17:30:45 -07:00
Paint_Ninja 07e538f3dd Improve logging for server connections (#9622) 2023-07-11 11:04:45 -07:00
cech12 b39e300c1b Fix placing fluids into waterlogged blocks with FluidUtil::tryPlaceFluid. To behave more like vanilla MC-127110 (#9519) 2023-07-11 11:04:26 -07:00
LexManos 50db51a366 Add proper duplicate mod error message that includes the mod id(s) and mod files. (#9474) 2023-06-20 14:18:14 -07:00
LexManos df80acc49d Make 1.20.x the main TC branch. 2023-06-20 14:07:42 -07:00
LexManos 658e614dc1 1.19.4 Recommended Build 2023-06-07 12:08:15 -07:00
Apex 9abfcbc90b Add method to GatherDataEvent to obtain collection of all input paths. (#9499) 2023-05-29 13:47:21 -07:00
Dennis C 6ee20899bf Log error when Sheets is class-loaded before registration is completed (#9475) 2023-05-29 13:47:04 -07:00
Dennis C 42115d37d6 [1.19.x] Re-implement RenderTooltipEvent.Color (#9497)
* Reimplement RenderTooltipEvent.Color

* Formatting, comments, EXC

* Deprecate instead of replacing
2023-05-16 12:24:27 +02:00
Joseph B 8abe9b6b0c Add API for registering custom world preset editors (#9436) 2023-05-14 15:53:34 -05:00
embeddedt fc91dfd1d1 Remove unneeded extra reload of datapacks on world creation screen (#9454) 2023-05-14 15:52:57 -05:00
SizableShrimp 8cd6f2d237 Bump ASM to 9.5 2023-05-14 15:50:07 -05:00
SizableShrimp f1702495ef Fix crash when running server from root directory
Fixes #9498
2023-05-14 15:26:24 -05:00
Dennis C 2ab2ced589 Fix root transform matrix format, allow using all four root transform formats (#9496) 2023-05-12 11:20:01 -07:00
Apex c8f9e59fef Add missing AT lines to allow registering custom game rule boolean/integer types (#9489) 2023-05-10 09:27:10 -07:00
Brennan WardandBrennan Ward 9a25527a54 [1.19.x] Fix SaplingGrowTreeEvent#setFeature being ignored in FungusBlock (#9485)
Co-authored-by: Brennan Ward <[email protected]>
2023-05-05 23:09:13 -05:00
SizableShrimp ad6d11671e Restore AccessibilityOnboardingScreen
Fixes #9488
2023-05-05 23:07:49 -05:00
Brennan Ward 3c93cd414d Update documentation on FinalizeSpawn (#9467) 2023-05-05 10:26:41 -07:00
DBotThePony 2c243626f6 Fix fluids without sound event causing exception in tryFillContainer and tryEmptyContainer (#9445) 2023-05-05 10:26:28 -07:00
Technici4n ae05036bb3 Make FakePlayerFactory respect the given ServerLevel (#9479) 2023-05-05 10:03:55 -07:00
Dennis C 3de22ffba3 Collect and log exceptions occurring in DeferredWorkQueue tasks (#9449) 2023-05-04 16:43:34 -07:00
matyrobbrt e1bf07dece Fix NamespacedWrapper#wrapAsHolder (#9450) 2023-05-04 16:42:02 -07:00
RealMangoRage 0ae63b0b07 Fixes ChatScreen calling .setScreen (#9443)
Fix test compile failures also.
2023-04-30 22:57:52 +01:00
matyrobbrt d4f211b815 Determine the Forge version the PR was built against when running PR compat checks (#9374) 2023-04-24 10:59:56 -07:00
SizableShrimp 393b28d7bb Add buildscript test to error on deprecated members that should of been removed. (#9460) 2023-04-24 10:59:37 -07:00
sciwhiz12 47c807c0e3 Remove erroneous brace patch in Inventory (#9462)
Fixes #9459
2023-04-23 13:24:20 +01:00
Dennis C b398f52a7f [1.19.4] Move root transform builder to ModelBuilder to allow use in ItemModelBuilder (#9456) 2023-04-20 09:27:30 +02:00
SizableShrimp f2aeeeb1fe Fix forge grindstone hooks allowing stacks of non-stackable items (#9457) 2023-04-20 00:19:35 -07:00
matyrobbrt dcef406df8 [1.19.4] Fix FMLOnly (#9415) 2023-04-18 16:46:04 +01:00
Dennis C 01846c729a Fix ItemLayerModel erroneously adding particle texture to layer texture list (#9441) 2023-04-07 08:16:17 +02:00
LexManos e6aaaff3f3 Temporary fix for Canceling ProjectileImpactEvents of Piercing ammo.
Event needs to be re-worked to have finer control. #9370
2023-04-05 11:16:39 -07:00
Brennan Ward d4836bc769 Fix dummy air blocks not being marked as air (#9440) 2023-04-03 15:04:34 -07:00
matyrobbrt b5655b0ddc Add support for splitting the login packet (#9367)
It contains full copies of data registries and can easily surpass vanilla's limits
2023-03-30 15:59:01 -07:00
Brennan Ward d75d333e13 Remove Attack Range and Reach Distance and add Block Reach and Entity Reach (#9361) 2023-03-29 18:53:41 -07:00
ChampionAsh5357 f5e16aa353 Add default bucket sounds for milk (#9432) 2023-03-29 18:48:29 -07:00
LexManos 4e5eecac12 Deprecate Item.onUsingTick, as vanilla provides the same function in Item.onUseTick now. Closes #9342 2023-03-29 18:46:00 -07:00
Brennan Ward a111073181 Fix ScreenEvent.Init.[Pre/Post] not working correctly (#9431) 2023-03-29 18:18:38 -07:00
LexManos a05f555ab8 Allow FenceGateBlock to be used without a WoodType. Closes #9392 2023-03-29 17:59:51 -07:00
LexManos df3db236e5 Deprecate duplicate tool tags that vanilla added in 1.19.4
We will maintain a seperate 'tools' tag until Mojang adds all relevent tool tags.
Closes #9393
2023-03-29 17:59:50 -07:00
LexManos 71b115c8fe Fix BlockEvent.Break not using ItemStack enchantment hooks. 2023-03-29 17:59:49 -07:00
LexManos 3e1b01af2c Move Block.onCatchFire to above block removal to allow usage of BlockEntity data. Closes #9400 2023-03-29 17:59:48 -07:00
Brennan Ward 1ab0685d04 Fix FinalizeSpawn not blocking spawns during worldgen (#9420) 2023-03-29 16:10:59 -07:00
LexManos 5c44992d1c Fixed issue with MutableHashedLinkedMap when removing multiple sequential entries in the middle of the map.
Added Unit tests for MutableHashLinkedMap
Added support for removing using the iterator
Added concurrent modification detection to the iterator
Added default constructor with basic hashing strategy.

Closes #9426
2023-03-29 15:49:49 -07:00
TelepathicGrunt d448ffd539 Loosen access for BucketItem's canBlockContainFluid (#9421) 2023-03-28 13:34:10 -07:00
ChampionAsh5357 9f895a79f2 Update and Regenerate Datapacks (#9419)
Add generation for pack.mcmeta
2023-03-28 13:33:59 -07:00
Paint_Ninja 6e1de81ff5 Restore ability to change message in ClientChatEvent (#9377) 2023-03-27 14:35:05 -07:00
sciwhiz12 b493a63fb6 Remove duplicate line in FoodData patch (#9424)
The line was accidentally duplicated in the 1.19.4 update and patching
process.

Fixes #9422
2023-03-27 12:51:53 -07:00
Joseph B ae65f5a255 Rename RegisterParticleProviderEvent's register methods to describe what kind of particle providers they register (deprecating old methods to avoid breaking) and minor docs tweaks (#9388) 2023-03-25 19:57:39 -07:00
noeppi_noeppi bb49b9e6dc Update pack versions (#9414) 2023-03-24 13:17:22 -07:00
Brennan Ward 2815e69407 [1.19.4] Revamp and fix spawn events (#9133) 2023-03-23 18:29:06 +00:00
Exopandora b33efc0727 [1.19.4] Replace blitOffset parameter with PoseStack in IItemDecorator (#9409)
* Replace blitOffset with PoseStack in IItemDecorator

* Circumvent breaking changes

* Fix blitOffset type
2023-03-22 11:11:01 +01:00
Dennis C 434c1ec4f8 Fix JSON model root transforms (#9410) 2023-03-22 11:09:41 +01:00
Dennis C c58d922324 Fix tossed items not being able to be picked up by other players. Closes #9412 (#9404) 2023-03-21 19:15:04 -07:00
Dennis C 331374dc7a Fix infinite BE render bounds failing frustum intersection test. Closes #9321 (#9407) 2023-03-21 12:16:49 -07:00
matyrobbrt c18eb23259 Make ForgeSlider use the new vanilla texture (#9406) 2023-03-20 14:16:35 -07:00
J.T. McQuigg d0e2242043 Add BlockSetType#register to accesstransformer.cfg (#9386) 2023-03-20 14:16:18 -07:00
Dennis C 684d36201f Add option to completely hide a crash-callable depending on a runtime value (#9372) 2023-03-20 14:15:59 -07:00
Jason 7b8ca60d32 Add isNewChunk to ChunkEvent.Load (#9369) 2023-03-20 14:15:33 -07:00
sciwhiz12 576ff81856 Remove DistExecutor calls in PistonEventTest (#9348) 2023-03-20 14:14:21 -07:00
sciwhiz12 73e68c9322 Fix hardcoded precipitation in ClimateSettingsBuilder (#9402)
This effectively caused all biomes to have precipitation, such as
minecraft:desert.

Fixes #9397
2023-03-20 08:56:10 +01:00
sciwhiz12 3cd758647d Fix incorrect variable used for swimming check (#9403)
Because of the incorrect variable, the check to stop sprinting (and stop
swimming) never fired correctly.

1.19.3's `flag5` variable was renamed to `flag7` in 1.19.4; however,
this was not caught during patching because of the fuzzy patcher.

Fixes #9399
2023-03-20 08:44:34 +01:00
sciwhiz12 14bc8d6611 Fix incorrect boolean used for glint effect (#9401)
The `flag1` variable is ultimately controlled by whether the armor slot
being rendered is for the leggings, which explains this bug where the
leggings always had the enchantment glint but not any other armor piece.

Fixes #9394
2023-03-20 08:02:18 +01:00
Redstone_Dubstep d552ce5eac Fixed ModMismatchDisconnectedScreen displaying missing mods wrongly (#9398) 2023-03-19 15:51:03 -07:00
Dennis C f03adc840e Fix misaligned text render type patch (#9391) 2023-03-16 14:44:20 -07:00
LexManos 31e73355c3 Remove thread filter from processing clientside custom payloads. Closes @9390 2023-03-16 11:51:46 -07:00
LexManos 88368dfa1c Fix LivingEntity patch which caused crash while entities got hurt. Closes #9389 2023-03-16 11:50:11 -07:00
matyrobbrt 7e6c8351c3 Fix wrong parameters in Screen#renderTooltipInternal patch (#9387) 2023-03-15 13:05:46 -07:00
LexManos fb20e4fa90 Fix misaligned patch in LevelRenderer. Closes #9385 2023-03-15 13:04:16 -07:00
Jonathan Coates 94c5699a03 Remove our fix for MC-121048 as it has been fixed by Vanilla (#9381) 2023-03-15 11:42:02 -07:00
LexManos 58626d1a22 Fix advancements not loading, bug seems to be fixed by vanilla now. Closes #9384 2023-03-15 11:41:12 -07:00
LexManos 631e72f99d Fixed patch verifier for cases where patches lowered access levels. Closes #9383 2023-03-15 11:39:42 -07:00
LexManos 3fffc18729 Fix crouching while sprinting stopping the player when step height is modified. Closes #9376 2023-03-14 23:56:29 -07:00
44c689f171 Forge 1.19.4
Properly move `ServerStatusPing` to codec
Reimplement custom display contexts

Co-authored-by: Matyrobbrt <[email protected]>
Co-authored-by: coehlrich <[email protected]>
Signed-off-by: SizableShrimp <[email protected]>
2023-03-14 17:22:27 -05:00
coehlrich 1f44339d6e Fix experimental world warning screen appearing everytime (#9375) 2023-03-09 08:26:32 -08:00
KnightMiner 001372bef2 Fix continuing to use items after dropping or when a shield breaks (MC-231097, MC-168573) (#9344) 2023-03-08 12:21:04 -08:00
KnightMiner 8f72c143a1 Add onStopUsing hook to IForgeItem (#9343) 2023-03-03 11:14:51 -08:00
Joseph B 3c75e1269d Document RegisterParticleProvidersEvent's APIs (#9346) 2023-02-24 13:18:07 -08:00
CreativeMD 121120aee1 Fix incorrect ListTag.getLongArray result (MC-260378) (#9351) 2023-02-24 13:16:32 -08:00
Su5eD 62ce55d8d7 Fix missing patch that left TagBuilder#replace unused (#9354) 2023-02-24 10:49:37 -08:00
Adneths 183d43f5f8 Add 2 new RenderLevelStageEvent.Stage for After Entities and After Block Entities (#9259) 2023-02-18 15:43:10 +01:00
ferriarnus 79dfdb0ace Cleanup StemBlock Patch (#9337) 2023-02-06 14:05:21 -08:00
Dennis C bb4a0b7dd6 Cleanup ItemProperties patch (#9332) 2023-02-06 14:04:04 -08:00
Dennis C 4cddc62be7 Make IForgeIntrinsicHolderTagAppender methods properly chainable (#9331) 2023-02-06 14:03:51 -08:00
ChampionAsh5357 914b2fe984 Fix in custom fluids not respecting max height correctly. (#9319) 2023-02-06 14:03:38 -08:00
cech12 308d4fa68e Fix inconsistent vaporization in BucketItem & FluidType (#9269) 2023-02-06 13:30:49 -08:00
cpw 50f325c8fe Fix reloading event firing during server shutdown and add explicit unloading event instead (#9016) 2023-02-06 13:30:16 -08:00
Joseph B 57fd0ecb2e Homogenize and/or holdersets when serializing to prevent serializing to NBT from crashing (#9048) Fixes #9043 2023-02-06 11:48:44 -08:00
matyrobbrt 94af5cc43a [1.19.x] Fix ForgeSlider not respecting custom height (#9237) 2023-02-05 18:58:08 +01:00
Mysterious_Dev 3c19a0309e Fix stepsound for blocks in the inside_step_sound_blocks tag. (#9318) 2023-01-25 13:19:54 -08:00
Minecraftschurli 0eb9d94bf3 Fix missing hanging sign material for modded wood type (#9303) 2023-01-23 13:34:22 -08:00
Jonathan Colmenares 4d57a1bec6 Fire TickEvent.LevelTickEvent on ClientLevel tick (#9299) 2023-01-23 11:47:00 -08:00
coehlrich 59ab01a559 Add ClientChatReceivedEvent for system messages (#9284) 2023-01-10 13:45:04 -08:00
matyrobbrt 5946356f8e PR Action update (#9274) 2023-01-08 21:24:00 +00:00
Minecraftschurli f0f7b18528 fix HangingSignEditScreen crash when using custom wood types using modid (#9294) 2023-01-08 21:21:23 +00:00
LexManos 5311b0bc90 Bump SecureJarHandler version, to help identify invalid mods. 2023-01-06 13:01:59 -08:00
Brennan Ward 43580f5804 [1.19.3] Hotfix missing null check in createUnbakedItemElements (#9285) 2023-01-06 19:42:56 +01:00
691 changed files with 9171 additions and 3972 deletions

No files matched your search

+9 -12
View File
@@ -1,16 +1,13 @@
name: 'Pull Request Review actions'
name: 'PR Review'
on: pull_request_review
permissions:
contents: read
issues: write
pull-requests: write
discussions: write
jobs:
labels:
uses: MinecraftForge/SharedActions/.github/workflows/pr_review_actions.yml@main
secrets:
GH_APP_KEY: ${{ secrets.GH_APP_KEY }}
GH_APP_NAME: ${{ secrets.GH_APP_NAME }}
upload_payload:
name: Upload payload
runs-on: ubuntu-latest
steps:
- uses: actions/upload-artifact@v3 # Payload artifact is consumed in Actionable
with:
name: payload
path: ${{ github.event_path }}
@@ -0,0 +1,13 @@
name: 'PR Review Comment'
on: pull_request_review_comment
jobs:
upload_payload:
name: Upload payload
runs-on: ubuntu-latest
steps:
- uses: actions/upload-artifact@v3 # Payload artifact is consumed in Actionable
with:
name: payload
path: ${{ github.event_path }}
@@ -0,0 +1,20 @@
name: 'Pull Request Review Comment actions'
on:
workflow_run:
workflows: [PR Review Comment]
types:
- completed
permissions:
contents: read
issues: write
pull-requests: write
discussions: write
jobs:
labels:
uses: MinecraftForge/SharedActions/.github/workflows/pr_review_comment_actions.yml@main
secrets:
GH_APP_KEY: ${{ secrets.GH_APP_KEY }}
GH_APP_NAME: ${{ secrets.GH_APP_NAME }}
@@ -0,0 +1,20 @@
name: 'Pull Request Review actions'
on:
workflow_run:
workflows: [PR Review]
types:
- completed
permissions:
contents: read
issues: write
pull-requests: write
discussions: write
jobs:
labels:
uses: MinecraftForge/SharedActions/.github/workflows/pr_review_actions.yml@main
secrets:
GH_APP_KEY: ${{ secrets.GH_APP_KEY }}
GH_APP_NAME: ${{ secrets.GH_APP_NAME }}
+3 -1
View File
@@ -1,6 +1,8 @@
name: 'Pull Request actions'
on: pull_request
on:
pull_request_target:
types: [assigned, unassigned, labeled, unlabeled, opened, edited, closed, reopened, synchronize, converted_to_draft, ready_for_review, locked, unlocked, review_requested, review_request_removed, auto_merge_enabled, auto_merge_disabled]
permissions:
contents: read
+1
View File
@@ -34,6 +34,7 @@
/repo/
src/generated/resources/.cache/
src/generated_test/resources/.cache/
src/generated_mdk/resources/.cache/
#Patch rejects
/patches-/
+1 -1
View File
@@ -38,7 +38,7 @@ project {
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.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_main_branch", "1.20.x", label = "Git Main Branch", description = "The git main or default branch to use in VCS operations.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
text("git_branch_spec", """
+:refs/heads/(main*)
+:refs/heads/(master*)
+65 -10
View File
@@ -19,6 +19,7 @@ import net.minecraftforge.gradle.common.tasks.SignJar
import net.minecraftforge.gradle.userdev.tasks.RenameJar
import org.apache.tools.ant.filters.ReplaceTokens
import org.gradle.plugins.ide.eclipse.model.SourceFolder
import org.objectweb.asm.Opcodes
plugins {
id 'org.cadixdev.licenser' version '0.6.1'
@@ -26,8 +27,8 @@ plugins {
id 'net.minecraftforge.gradleutils' version '2.+'
id 'eclipse'
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
id 'net.minecraftforge.gradle.patcher' version '[5.1.77,5.2.0)' apply false
id 'net.minecraftforge.gradle.mcp' version '[5.1.77,5.2.0)' apply false
}
Util.init() //Init all our extension methods!
@@ -42,18 +43,18 @@ ext {
]
}
MAPPING_CHANNEL = 'official'
MAPPING_VERSION = '1.19.3'
MC_VERSION = '1.19.3'
MAPPING_VERSION = '1.19.4'
MC_VERSION = '1.19.4'
MC_NEXT_VERSION = '1.20'
MCP_VERSION = '20221207.122022'
MCP_VERSION = '20230314.122934'
SPI_VERSION = '6.0.0'
ACCESSTRANSFORMERS_VERSION = '8.0.4'
COREMODS_VERSION = '5.0.1'
EVENTBUS_VERSION = '6.0.3'
MODLAUNCHER_VERSION = '10.0.8'
SECUREJARHANDLER_VERSION = '2.1.4'
SECUREJARHANDLER_VERSION = '2.1.6'
BOOTSTRAPLAUNCHER_VERSION = '1.1.2'
ASM_VERSION = '9.3'
ASM_VERSION = '9.5'
INSTALLER_VERSION = '2.1.+'
MIXIN_VERSION = '0.8.5'
TERMINALCONSOLEAPPENDER_VERSION = '1.2.0'
@@ -883,6 +884,10 @@ project(':forge') {
apply plugin: 'net.minecraftforge.gradle.patcher'
apply plugin: 'org.cadixdev.licenser'
applyPatches {
level 'WARNING'
}
sourceSets {
main {
java {
@@ -1077,11 +1082,38 @@ project(':forge') {
'--mod', 'data_pack_registries_test',
'--mod', 'biome_modifiers_test',
'--mod', 'structure_modifiers_test',
'--mod', 'custom_preset_editor_test',
'--output', rootProject.file('src/generated_test/resources/'),
'--existing', sourceSets.main.resources.srcDirs[0],
'--existing', sourceSets.test.resources.srcDirs[0]
}
}
forge_mdk_data {
parent runs.forge_data
taskName 'forge_mdk_data'
environment 'MOD_CLASSES', 'dummy' // Needed to work around FG limitation, FG will replace this!
ideaModule "${rootProject.name}.${project.name}.test"
mods {
tests { sources sourceSets.test }
}
afterEvaluate {
// Clear forge's main datagen args
args.removeAll {
forgeDataArgs.contains(it instanceof File ? (it as File).absolutePath : it.toString())
}
args '--flat', '--all', '--validate',
'--mod', 'mdk_datagen',
'--output', rootProject.file('src/generated_mdk/resources/'),
'--existing', sourceSets.main.resources.srcDirs[0],
'--existing', sourceSets.test.resources.srcDirs[0]
}
}
}
}
@@ -1174,12 +1206,31 @@ project(':forge') {
}
}
task findFinalizeSpawnTargets(type: BytecodePredicateFinder, dependsOn: ['createJoinedSRG']) {
jar = createJoinedSRG.output
output = rootProject.file('src/main/resources/coremods/finalize_spawn_targets.json')
predicate = {
parent, node, insn ->
'net/minecraft/world/level/BaseSpawner' != parent.name // Ignore this class as we special case it.
&& insn.getOpcode() == Opcodes.INVOKEVIRTUAL
&& insn.name.equals('m_6518_')
&& insn.desc.equals('(Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/MobSpawnType;Lnet/minecraft/world/entity/SpawnGroupData;Lnet/minecraft/nbt/CompoundTag;)Lnet/minecraft/world/entity/SpawnGroupData;')
}
}
tasks.register('validateDeprecations', ValidateDeprecations) {
input = tasks.jar.archiveFile
mcVersion = MC_VERSION
}
tasks.jar.finalizedBy 'validateDeprecations'
tasks.register('checkAll') {
dependsOn 'checkLicenses'
group = 'checks'
}
tasks.register('checkAllAndFix') {
dependsOn 'findFieldInstanceChecks', 'checkLicenses'
dependsOn 'findFinalizeSpawnTargets', 'findFieldInstanceChecks', 'checkLicenses'
group = 'checks'
}
@@ -1218,7 +1269,7 @@ project(':forge') {
}
def baseForgeVersionProperty = project.objects.property(String)
baseForgeVersionProperty.set(project.provider { getLatestForgeVersion(MC_VERSION) }.map { MC_VERSION + '-' + it })
baseForgeVersionProperty.set(project.provider { TeamcityRequests.attemptFindBase(rootDir) ?: getLatestForgeVersion(MC_VERSION) })
baseForgeVersionProperty.finalizeValueOnRead()
def jarCompatibilityTaskSetup = { task ->
task.group = 'jar compatibility'
@@ -1584,6 +1635,10 @@ project(':forge') {
rename 'gitignore\\.txt', '.gitignore'
rename 'gitattributes\\.txt', '.gitattributes'
}
from(rootProject.file('src/generated_mdk/resources/')) {
into('src/main/resources/')
exclude '**/.cache/'
}
}
license {
@@ -1735,4 +1790,4 @@ if (System.env.TEAMCITY_VERSION) {
println "##teamcity[setParameter name='env.PUBLISHED_JAVA_FML_ARTIFACT_VERSION' value='${project(':fmlonly').version}']"
}
}
}
}
+4 -3
View File
@@ -4,9 +4,10 @@ repositories {
}
dependencies {
implementation 'org.ow2.asm:asm:9.3'
implementation 'org.ow2.asm:asm-tree:9.3'
implementation 'net.minecraftforge:srgutils:0.4.+'
implementation 'org.ow2.asm:asm:9.5'
implementation 'org.ow2.asm:asm-tree:9.5'
implementation 'net.minecraftforge:srgutils:0.5.+'
implementation 'commons-io:commons-io:2.8.0'
implementation 'com.google.code.gson:gson:2.10'
implementation 'org.eclipse.jgit:org.eclipse.jgit:6.5.0.202303070854-r'
}
@@ -6,15 +6,10 @@ import org.gradle.api.file.RegularFileProperty
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.TaskAction
import org.objectweb.asm.ClassReader
import org.objectweb.asm.Opcodes
import org.objectweb.asm.tree.ClassNode
import org.objectweb.asm.tree.FieldNode
import org.objectweb.asm.tree.MethodNode
import java.util.zip.ZipEntry
import java.util.zip.ZipInputStream
abstract class BytecodeFinder extends DefaultTask {
@InputFile abstract RegularFileProperty getJar()
@OutputFile abstract RegularFileProperty getOutput()
@@ -33,18 +28,7 @@ abstract class BytecodeFinder extends DefaultTask {
pre()
jar.get().asFile.withInputStream { i ->
new ZipInputStream(i).withCloseable { zin ->
ZipEntry zein
while ((zein = zin.nextEntry) != null) {
if (zein.name.endsWith('.class')) {
def node = new ClassNode(Opcodes.ASM9)
new ClassReader(zin).accept(node, 0)
process(node)
}
}
}
}
Util.processClassNodes(jar.get().asFile, this::process)
post()
outputFile.text = new JsonBuilder(getData()).toPrettyString()
@@ -0,0 +1,32 @@
package net.minecraftforge.forge.tasks
import groovy.transform.CompileStatic
import org.gradle.api.provider.Property
import org.gradle.api.tasks.Internal
import org.objectweb.asm.tree.ClassNode
import org.objectweb.asm.tree.MethodNode
@CompileStatic
abstract class BytecodePredicateFinder extends BytecodeFinder {
@Internal
abstract Property<Closure<Boolean>> getPredicate()
private final Set<String> matches = new HashSet()
@Override
protected process(ClassNode parent, MethodNode node) {
for (final current : node.instructions) {
if (predicate.get().call(parent, node, current)) {
matches.add(parent.name)
return
}
}
}
@Internal
@Override
protected Object getData() {
return matches.toSorted(Comparator.naturalOrder()) ?: {throw new RuntimeException('Failed to find any targets, please ensure that method names and descriptors are correct.')}()
}
}
@@ -6,7 +6,7 @@ import org.gradle.api.provider.SetProperty
abstract class InstallerJar extends Zip {
@Input @Optional abstract SetProperty<String> getPackedDependencies()
InstallerJar() {
archiveClassifier.set('installer')
archiveExtension.set('jar') // Needs to be Zip task to not override Manifest, so set extension
@@ -15,7 +15,7 @@ abstract class InstallerJar extends Zip {
def installerJson = project.tasks.installerJson
def launcherJson = project.tasks.launcherJson
def downloadInstaller = project.tasks.downloadInstaller
dependsOn(installerJson, launcherJson, downloadInstaller)
from(installerJson, launcherJson)
@@ -24,13 +24,13 @@ abstract class InstallerJar extends Zip {
from(project.zipTree(downloadInstaller.output)) {
duplicatesStrategy = 'exclude'
}
if (!System.env.MAVEN_USER) {
if (!System.env.TEAMCITY_VERSION) {
dependsOn(project.universalJar)
from(project.universalJar) {
into '/maven/' + project.group.replace('.', '/') + '/' + project.universalJar.archiveBaseName.get() + '/' + project.version + '/'
}
packedDependencies.get().forEach {
def jarTask = project.rootProject.getTasks().findByPath(it)
dependsOn(jarTask)
@@ -0,0 +1,74 @@
package net.minecraftforge.forge.tasks
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import groovy.transform.CompileStatic
import org.eclipse.jgit.api.Git
import javax.annotation.Nullable
import java.util.stream.Collectors
@CompileStatic
class TeamcityRequests {
public static final Gson GSON = new Gson()
@Nullable
static <T> T jsonRequest(TypeToken<T> clazz, String url) throws Exception {
final HttpURLConnection conn = (HttpURLConnection) URI.create(url).toURL().openConnection()
conn.setRequestProperty('Accept', 'application/json')
conn.setReadTimeout(5 * 1000)
conn.setConnectTimeout(5 * 1000)
conn.connect()
if (conn.responseCode !== 200) {
return null
}
try (final InputStream is = conn.getInputStream()) {
GSON.fromJson(new InputStreamReader(is), clazz.getType())
}
}
@Nullable
static Map<String, Build> buildsByCommit() throws IOException {
final Map<String, Build> builds = [:]
jsonRequest(new TypeToken<Builds>() {}, "https://teamcity.minecraftforge.net/guestAuth/app/rest/builds?fields=build:(revisions,number)&locator=buildType:(id:MinecraftForge_MinecraftForge_MinecraftForge_MinecraftForge__Build),count:300,status:SUCCESS")
?.build?.forEach {
it.revisions.revision.each { rev -> builds[rev.version] = it }
}
return builds
}
@Nullable
static String attemptFindBase(File gitPath) {
try (final git = Git.open(gitPath)) {
final Map<String, Build> buildByCommit = buildsByCommit()
for (final commit in git.log().setMaxCount(100).call()) {
// Find the first commit which was built on CI
final build = buildByCommit[commit.id.name]
if (build) {
return build.number
}
}
} catch (Exception ignored) {}
return null
}
static final class Builds {
public List<Build> build
}
static final class Build {
public String number
public Revisions revisions
}
static final class Revisions {
public int count
public List<Revision> revision
}
static final class Revision {
public String version
}
}
@@ -2,13 +2,20 @@ package net.minecraftforge.forge.tasks
import groovy.json.JsonBuilder
import groovy.json.JsonSlurper
import org.objectweb.asm.ClassReader
import org.objectweb.asm.Opcodes
import org.objectweb.asm.tree.ClassNode
import java.io.File
import java.security.MessageDigest
import java.text.SimpleDateFormat
import java.util.Date
import java.util.zip.ZipEntry
import java.util.zip.ZipInputStream
public class Util {
static final ASM_LEVEL = Opcodes.ASM9
static void init() {
File.metaClass.sha1 = { ->
MessageDigest md = MessageDigest.getInstance('SHA-1')
@@ -143,8 +150,24 @@ public class Util {
}
}
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"]
static String getLatestForgeVersion(mcVersion) {
final json = new JsonSlurper().parseText(new URL('https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json').getText('UTF-8'))
final ver = json.promos["$mcVersion-latest"]
ver === null ? null : (mcVersion + '-' + ver)
}
static void processClassNodes(File file, Closure process) {
file.withInputStream { i ->
new ZipInputStream(i).withCloseable { zin ->
ZipEntry zein
while ((zein = zin.nextEntry) != null) {
if (zein.name.endsWith('.class')) {
def node = new ClassNode(ASM_LEVEL)
new ClassReader(zin).accept(node, 0)
process(node)
}
}
}
}
}
}
@@ -0,0 +1,92 @@
/*
* Copyright (c) Forge Development LLC and contributors
* SPDX-License-Identifier: LGPL-2.1-only
*/
package net.minecraftforge.forge.tasks
import net.minecraftforge.srgutils.MinecraftVersion
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.InputFile
import org.gradle.api.tasks.TaskAction
import org.objectweb.asm.tree.AnnotationNode
import org.objectweb.asm.tree.ClassNode
abstract class ValidateDeprecations extends DefaultTask {
@InputFile
abstract RegularFileProperty getInput()
@Input
abstract Property<String> getMcVersion()
ValidateDeprecations() {
this.onlyIf { !System.env.TEAMCITY_VERSION }
}
@TaskAction
protected void exec() {
def mcVer = MinecraftVersion.from(mcVersion.get())
def errors = []
Util.processClassNodes(input.get().asFile) {
processNode(mcVer, errors, it)
}
if (!errors.isEmpty()) {
errors.forEach {
this.logger.error("Deprecated ${it[0]} is marked for removal in ${it[1]} but is not yet removed")
}
throw new IllegalStateException("Found deprecated members marked for removal but not yet removed in ${mcVer}; see log for details")
}
}
protected processNode(MinecraftVersion mcVer, List<String> errors, ClassNode node) {
node.visibleAnnotations?.each { annotation ->
ValidateDeprecations.processAnnotations(annotation, mcVer, errors) {
"class ${node.name}"
}
}
node.fields?.each { field ->
field.visibleAnnotations?.each { annotation ->
ValidateDeprecations.processAnnotations(annotation, mcVer, errors) {
"field ${node.name}#${field.name}"
}
}
}
node.methods?.each { method ->
method.visibleAnnotations?.each { annotation ->
ValidateDeprecations.processAnnotations(annotation, mcVer, errors) {
"method ${node.name}#${method.name}${method.desc}"
}
}
}
}
private static void processAnnotations(AnnotationNode annotation, MinecraftVersion mcVer, List<String> errors, Closure context) {
def values = annotation.values
if (values === null)
return
int forRemoval = values.indexOf('forRemoval')
int since = values.indexOf('since')
if (annotation.desc == 'Ljava/lang/Deprecated;' && forRemoval !== -1 && since !== -1 && values.size() >= 4 && values[forRemoval + 1] === true) {
def oldVersion = MinecraftVersion.from(values[since + 1])
def split = ValidateDeprecations.splitDots(oldVersion.toString())
if (split.length < 2)
return
def removeVersion = MinecraftVersion.from("${split[0]}.${split[1] + 1}")
if (removeVersion <= mcVer)
errors.add([context(), removeVersion])
}
}
private static int[] splitDots(String version) {
String[] pts = version.split('\\.')
int[] values = new int[pts.length]
for (int x = 0; x < pts.length; x++)
values[x] = Integer.parseInt(pts[x])
return values
}
}
@@ -1,5 +1,6 @@
package net.minecraftforge.forge.tasks.checks
import net.minecraftforge.forge.tasks.Util
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.tasks.InputFile
@@ -7,7 +8,6 @@ import org.gradle.api.tasks.InputFiles
import org.objectweb.asm.ClassReader
import org.objectweb.asm.ClassVisitor
import org.objectweb.asm.MethodVisitor
import org.objectweb.asm.Opcodes
import org.objectweb.asm.Type
import java.util.zip.ZipEntry
@@ -67,7 +67,7 @@ abstract class CheckExcs extends CheckTask {
private void collectKnown(Collection<String> known) {
binary.get().asFile.withInputStream { i ->
new ZipInputStream(i).withCloseable { zin ->
final visitor = new ClassVisitor(Opcodes.ASM9) {
final visitor = new ClassVisitor(Util.ASM_LEVEL) {
private String cls
@Override
void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
@@ -35,6 +35,11 @@ abstract class CheckPatches extends CheckTask {
}
}
}
def accessChange(previous, current) {
//return ACCESS_MAP[previous] < ACCESS_MAP[current]
return previous != current
}
void verifyPatch(Path patch, Reporter reporter, boolean fix, String patchPath, boolean hasS2SArtifact) {
final oldFixedErrors = reporter.fixed.size()
@@ -87,7 +92,7 @@ abstract class CheckPatches extends CheckTask {
pMatcher.group(6) == cMatcher.group(6) && // = ...
pMatcher.group(5) == cMatcher.group(5) && // field name
pMatcher.group(3) == cMatcher.group(3) && // static
(ACCESS_MAP[pMatcher.group(2)] < ACCESS_MAP[cMatcher.group(2)] || pMatcher.group(4) != cMatcher.group(4))) {
(accessChange(pMatcher.group(2), cMatcher.group(2)) || pMatcher.group(4) != cMatcher.group(4))) {
reporter.report("Patch contains access changes or final removal at line ${i + 1}, file: $patchPath", false)
}
@@ -98,7 +103,7 @@ abstract class CheckPatches extends CheckTask {
pMatcher.group(6) == cMatcher.group(6) && // params
pMatcher.group(5) == cMatcher.group(5) && // <T> void name
pMatcher.group(3) == cMatcher.group(3) && // static
(ACCESS_MAP[pMatcher.group(2)] < ACCESS_MAP[cMatcher.group(2)] || pMatcher.group(4) != cMatcher.group(4))) {
(accessChange(pMatcher.group(2), cMatcher.group(2)) || pMatcher.group(4) != cMatcher.group(4))) {
reporter.report("Patch contains access changes or final removal at line ${i + 1}, file: $patchPath", false)
}
@@ -109,7 +114,7 @@ abstract class CheckPatches extends CheckTask {
pMatcher.group(6) == cMatcher.group(6) && // ClassName<> extends ...
pMatcher.group(5) == cMatcher.group(5) && // class | interface
pMatcher.group(3) == cMatcher.group(3) && // static
(ACCESS_MAP[pMatcher.group(2)] < ACCESS_MAP[cMatcher.group(2)] || pMatcher.group(4) != cMatcher.group(4))) {
(accessChange(pMatcher.group(2), cMatcher.group(2)) || pMatcher.group(4) != cMatcher.group(4))) {
reporter.report("Patch contains access changes or final removal at line ${i + 1}, file: $patchPath", false)
}
}
+3 -1
View File
@@ -7,7 +7,7 @@ Contributing to Forge
3) Follow the code style of the class you're working in (braces on newlines & spaces instead of tabs in Forge classes, inline brackets in patches, etc).
For more information, refer to [the wiki](https://github.com/MinecraftForge/MinecraftForge/wiki/If-you-want-to-contribute-to-Forge)
For more information, refer to [the wiki][Wiki].
Contributor License Agreement
@@ -16,3 +16,5 @@ Contributor License Agreement
- You assign copyright ownership of your contributions to the patches codebase (everything under patches) to Forge, where it will be licensed under the LGPLv2.1 license.
"Forge" is Forge Development LLC, a legally incorporated entity in Oregon, USA.
[Wiki]: https://github.com/MinecraftForge/MinecraftForge/wiki/If-you-want-to-contribute-to-Forge
+29 -18
View File
@@ -2,16 +2,17 @@
MinecraftForge
=============
[![Stable Release](https://img.shields.io/badge/dynamic/json?url=https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json&label=Stable&prefix=1.19.3-&query=$.promos["1.19.3-recommended"]&color=brightgreen&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBjbGFzcz0ic3ZnLWlubGluZS0tZmEgZmEtc3RhciBmYS13LTE4IiBhcmlhLWhpZGRlbj0idHJ1ZSIgZGF0YS1pY29uPSJzdGFyIiBkYXRhLXByZWZpeD0iZmFzIiBmb2N1c2FibGU9ImZhbHNlIiByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCA1NzYgNTEyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNMjU5LjMgMTcuOEwxOTQgMTUwLjIgNDcuOSAxNzEuNWMtMjYuMiAzLjgtMzYuNyAzNi4xLTE3LjcgNTQuNmwxMDUuNyAxMDMtMjUgMTQ1LjVjLTQuNSAyNi4zIDIzLjIgNDYgNDYuNCAzMy43TDI4OCA0MzkuNmwxMzAuNyA2OC43YzIzLjIgMTIuMiA1MC45LTcuNCA0Ni40LTMzLjdsLTI1LTE0NS41IDEwNS43LTEwM2MxOS0xOC41IDguNS01MC44LTE3LjctNTQuNkwzODIgMTUwLjIgMzE2LjcgMTcuOGMtMTEuNy0yMy42LTQ1LjYtMjMuOS01Ny40IDB6IiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K)](https://files.minecraftforge.net)
[![Latest Release](https://img.shields.io/badge/dynamic/json?url=https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json&label=Latest&prefix=1.19.3-&query=$.promos["1.19.3-latest"]&color=blue&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBjbGFzcz0ic3ZnLWlubGluZS0tZmEgZmEtYnVnIGZhLXctMTYiIGFyaWEtaGlkZGVuPSJ0cnVlIiBkYXRhLWljb249ImJ1ZyIgZGF0YS1wcmVmaXg9ImZhcyIgZm9jdXNhYmxlPSJmYWxzZSIgcm9sZT0iaW1nIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTUxMS45ODggMjg4LjljLS40NzggMTcuNDMtMTUuMjE3IDMxLjEtMzIuNjUzIDMxLjFINDI0djE2YzAgMjEuODY0LTQuODgyIDQyLjU4NC0xMy42IDYxLjE0NWw2MC4yMjggNjAuMjI4YzEyLjQ5NiAxMi40OTcgMTIuNDk2IDMyLjc1OCAwIDQ1LjI1NS0xMi40OTggMTIuNDk3LTMyLjc1OSAxMi40OTYtNDUuMjU2IDBsLTU0LjczNi01NC43MzZDMzQ1Ljg4NiA0NjcuOTY1IDMxNC4zNTEgNDgwIDI4MCA0ODBWMjM2YzAtNi42MjctNS4zNzMtMTItMTItMTJoLTI0Yy02LjYyNyAwLTEyIDUuMzczLTEyIDEydjI0NGMtMzQuMzUxIDAtNjUuODg2LTEyLjAzNS05MC42MzYtMzIuMTA4bC01NC43MzYgNTQuNzM2Yy0xMi40OTggMTIuNDk3LTMyLjc1OSAxMi40OTYtNDUuMjU2IDAtMTIuNDk2LTEyLjQ5Ny0xMi40OTYtMzIuNzU4IDAtNDUuMjU1bDYwLjIyOC02MC4yMjhDOTIuODgyIDM3OC41ODQgODggMzU3Ljg2NCA4OCAzMzZ2LTE2SDMyLjY2NkMxNS4yMyAzMjAgLjQ5MSAzMDYuMzMuMDEzIDI4OC45LS40ODQgMjcwLjgxNiAxNC4wMjggMjU2IDMyIDI1Nmg1NnYtNTguNzQ1bC00Ni42MjgtNDYuNjI4Yy0xMi40OTYtMTIuNDk3LTEyLjQ5Ni0zMi43NTggMC00NS4yNTUgMTIuNDk4LTEyLjQ5NyAzMi43NTgtMTIuNDk3IDQ1LjI1NiAwTDE0MS4yNTUgMTYwaDIyOS40ODlsNTQuNjI3LTU0LjYyN2MxMi40OTgtMTIuNDk3IDMyLjc1OC0xMi40OTcgNDUuMjU2IDAgMTIuNDk2IDEyLjQ5NyAxMi40OTYgMzIuNzU4IDAgNDUuMjU1TDQyNCAxOTcuMjU1VjI1Nmg1NmMxNy45NzIgMCAzMi40ODQgMTQuODE2IDMxLjk4OCAzMi45ek0yNTcgMGMtNjEuODU2IDAtMTEyIDUwLjE0NC0xMTIgMTEyaDIyNEMzNjkgNTAuMTQ0IDMxOC44NTYgMCAyNTcgMHoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo=
)](https://files.minecraftforge.net) [![Discord](https://img.shields.io/discord/313125603924639766.svg?color=%237289da&label=Discord&logo=discord&logoColor=%237289da)](https://discord.gg/UvedJ9m) [![Support](https://img.shields.io/badge/Patreon-Support-orange.svg?logo=Patreon)](https://www.patreon.com/LexManos)
[![Stable Release](https://img.shields.io/badge/dynamic/json?url=https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json&label=Stable&prefix=1.19.4-&query=$.promos["1.19.4-recommended"]&color=brightgreen&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBjbGFzcz0ic3ZnLWlubGluZS0tZmEgZmEtc3RhciBmYS13LTE4IiBhcmlhLWhpZGRlbj0idHJ1ZSIgZGF0YS1pY29uPSJzdGFyIiBkYXRhLXByZWZpeD0iZmFzIiBmb2N1c2FibGU9ImZhbHNlIiByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCA1NzYgNTEyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNMjU5LjMgMTcuOEwxOTQgMTUwLjIgNDcuOSAxNzEuNWMtMjYuMiAzLjgtMzYuNyAzNi4xLTE3LjcgNTQuNmwxMDUuNyAxMDMtMjUgMTQ1LjVjLTQuNSAyNi4zIDIzLjIgNDYgNDYuNCAzMy43TDI4OCA0MzkuNmwxMzAuNyA2OC43YzIzLjIgMTIuMiA1MC45LTcuNCA0Ni40LTMzLjdsLTI1LTE0NS41IDEwNS43LTEwM2MxOS0xOC41IDguNS01MC44LTE3LjctNTQuNkwzODIgMTUwLjIgMzE2LjcgMTcuOGMtMTEuNy0yMy42LTQ1LjYtMjMuOS01Ny40IDB6IiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K)][Download]
[![Latest Release](https://img.shields.io/badge/dynamic/json?url=https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json&label=Latest&prefix=1.19.4-&query=$.promos["1.19.4-latest"]&color=blue&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBjbGFzcz0ic3ZnLWlubGluZS0tZmEgZmEtYnVnIGZhLXctMTYiIGFyaWEtaGlkZGVuPSJ0cnVlIiBkYXRhLWljb249ImJ1ZyIgZGF0YS1wcmVmaXg9ImZhcyIgZm9jdXNhYmxlPSJmYWxzZSIgcm9sZT0iaW1nIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTUxMS45ODggMjg4LjljLS40NzggMTcuNDMtMTUuMjE3IDMxLjEtMzIuNjUzIDMxLjFINDI0djE2YzAgMjEuODY0LTQuODgyIDQyLjU4NC0xMy42IDYxLjE0NWw2MC4yMjggNjAuMjI4YzEyLjQ5NiAxMi40OTcgMTIuNDk2IDMyLjc1OCAwIDQ1LjI1NS0xMi40OTggMTIuNDk3LTMyLjc1OSAxMi40OTYtNDUuMjU2IDBsLTU0LjczNi01NC43MzZDMzQ1Ljg4NiA0NjcuOTY1IDMxNC4zNTEgNDgwIDI4MCA0ODBWMjM2YzAtNi42MjctNS4zNzMtMTItMTItMTJoLTI0Yy02LjYyNyAwLTEyIDUuMzczLTEyIDEydjI0NGMtMzQuMzUxIDAtNjUuODg2LTEyLjAzNS05MC42MzYtMzIuMTA4bC01NC43MzYgNTQuNzM2Yy0xMi40OTggMTIuNDk3LTMyLjc1OSAxMi40OTYtNDUuMjU2IDAtMTIuNDk2LTEyLjQ5Ny0xMi40OTYtMzIuNzU4IDAtNDUuMjU1bDYwLjIyOC02MC4yMjhDOTIuODgyIDM3OC41ODQgODggMzU3Ljg2NCA4OCAzMzZ2LTE2SDMyLjY2NkMxNS4yMyAzMjAgLjQ5MSAzMDYuMzMuMDEzIDI4OC45LS40ODQgMjcwLjgxNiAxNC4wMjggMjU2IDMyIDI1Nmg1NnYtNTguNzQ1bC00Ni42MjgtNDYuNjI4Yy0xMi40OTYtMTIuNDk3LTEyLjQ5Ni0zMi43NTggMC00NS4yNTUgMTIuNDk4LTEyLjQ5NyAzMi43NTgtMTIuNDk3IDQ1LjI1NiAwTDE0MS4yNTUgMTYwaDIyOS40ODlsNTQuNjI3LTU0LjYyN2MxMi40OTgtMTIuNDk3IDMyLjc1OC0xMi40OTcgNDUuMjU2IDAgMTIuNDk2IDEyLjQ5NyAxMi40OTYgMzIuNzU4IDAgNDUuMjU1TDQyNCAxOTcuMjU1VjI1Nmg1NmMxNy45NzIgMCAzMi40ODQgMTQuODE2IDMxLjk4OCAzMi45ek0yNTcgMGMtNjEuODU2IDAtMTEyIDUwLjE0NC0xMTIgMTEyaDIyNEMzNjkgNTAuMTQ0IDMxOC44NTYgMCAyNTcgMHoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo=
)][Download] [![Discord](https://img.shields.io/discord/313125603924639766.svg?color=%237289da&label=Discord&logo=discord&logoColor=%237289da)][Discord] [![Support](https://img.shields.io/badge/Patreon-Support-orange.svg?logo=Patreon)][Patreon]
Forge is a free, open-source modding API all of your favourite mods use!
| Version | Support |
|---------| ------------- |
| 1.19.x | Active |
| 1.18.x | LTS |
| 1.20.x | Active |
| 1.19.4 | Legacy |
| 1.19.2 | Legacy |
* [Download]
* [Forum]
@@ -20,7 +21,7 @@ Forge is a free, open-source modding API all of your favourite mods use!
# Installing Forge
Go to [the Forge website](https://files.minecraftforge.net)
Go to [the Forge website][Download]
and select the Minecraft version you wish to get Forge for from the list.
You can download the installer for the *Recommended Build* or the
@@ -29,38 +30,48 @@ You can download the installer for the *Recommended Build* or the
into your vanilla launcher environment, where you can then create a new
profile using that version and play the game!
For support and questions, visit [the Support Forum](https://www.minecraftforge.net/forum/forum/18-support-bug-reports/) or [the Forge Discord server](https://discord.gg/forge).
[Here is a short video from Rorax showing how to install and setup Forge.](https://www.youtube.com/watch?v=lB3ArN_-3Oc)
For support and questions, visit [the Support Forum][Support-Forum] or [the Forge Discord server][Discord].
# Creating Mods
[See the "Getting Started" section in the Forge Documentation](https://mcforge.readthedocs.io/en/latest/gettingstarted/).
[See the "Getting Started" section in the Forge Documentation][Getting-Started].
# Contribute to Forge
If you wish to actually inspect Forge, submit PRs or otherwise work
with Forge itself, you're in the right place!
[See the guide to setting up a Forge workspace](http://mcforge.readthedocs.io/en/latest/forgedev/).
[See the guide to setting up a Forge workspace][ForgeDev].
### Pull requests
[See the "Making Changes and Pull Requests" section in the Forge documentation](https://mcforge.readthedocs.io/en/latest/forgedev/#making-changes-and-pull-requests).
[See the "Making Changes and Pull Requests" section in the Forge documentation][Pull-Requests].
Please read the contributing guidelines found [here](CONTRIBUTING.md) before making a pull request.
Please read the contributing guidelines found [here][Contributing] before making a pull request.
### Contributor License Agreement
We require all contributors to acknowledge the [Forge Contributor License Agreement](https://cla-assistant.io/MinecraftForge/MinecraftForge).
We require all contributors to acknowledge the [Forge Contributor License Agreement][CLA].
Please ensure you have a valid email address associated with your GitHub account to do this. If you have previously
signed it, you should be OK.
#### Donate
*Forge is a large project with many collaborators working on it around the clock. Forge is and will always remain free
to use and modify. However, it costs money to run such a large project as this, so please consider
[becoming a patron](https://www.patreon.com/LexManos).*
[becoming a patron][Patreon].*
[Contributing]: ./CONTRIBUTING.md
[CLA]: https://cla-assistant.io/MinecraftForge/MinecraftForge
[Download]: https://files.minecraftforge.net/
[Forum]: https://www.minecraftforge.net/forum/
[Discord]: https://discord.gg/UvedJ9m
[Documentation]: https://mcforge.readthedocs.io
[Forum]: https://forums.minecraftforge.net/
[Support-Forum]: https://forums.minecraftforge.net/forum/18-support-bug-reports/
[Discord]: https://discord.minecraftforge.net/
[Documentation]: https://docs.minecraftforge.net/
[Getting-Started]: https://docs.minecraftforge.net/en/latest/gettingstarted/
[ForgeDev]: https://docs.minecraftforge.net/en/latest/forgedev/
[Pull-Requests]: https://docs.minecraftforge.net/en/latest/forgedev/#making-changes-and-pull-requests
[Patreon]: https://www.patreon.com/LexManos
+15 -8
View File
@@ -1,7 +1,7 @@
Getting Support Surrounding Forge
=================================
**If you do not want to read the following wall of text, no matter its relevance for helping get your issue resolved quickly, please refer to the [Forge Forums](http://www.minecraftforge.net/forum/forum/18-support-bug-reports/) for support.**
**If you do not want to read the following wall of text, no matter its relevance for helping get your issue resolved quickly, please refer to the [Forge Forums][Bug-Reports] for support.**
Before reporting an issue on this repository's bug tracker, please carefully read this document. There are various resources that are more likely to be able to help you with certain kinds of issues. This document provides instructions on how to determine which place best to report to.
@@ -44,7 +44,7 @@ You can generally tell pretty quickly what caused the error at the head of your
1. If you can find the name of a mod in the trace, that mod most likely is the culprit.
- Be aware that you may find multiple mods as participants of a crash. In that case, you can either report to both or try to reason (using the names in the stacktrace) about which mod is at fault.
2. If you can only find Forge (usually starting with `net.minecraftforge`) alongside Vanilla (usually starting with `net.minecraft`) references, chances are that you have found a bug in Forge. In this case, use one of the various [support channels](#forge-support) listed below.
- The occurence of a single call to Forge somewhere in the stacktrace *does not* warrant a report to Forge if there are mods present in the crash report.
- The occurrence of a single call to Forge somewhere in the stacktrace *does not* warrant a report to Forge if there are mods present in the crash report.
3. If there's no mention of Forge or a mod, but any Vanilla class, you might have found a Vanilla bug. You should probably still report it via the Forge channels first, however, due the nature of modded environments and the rarity of Vanilla crash bugs.
4. Always check whether there's a mention of coremods at the beginning of a crash report. If there is and you can't find any clear culprit, consider reporting to these coremods first, since they are free to change any of the code executed in your environment.
@@ -74,10 +74,10 @@ Please note that this list has to be considered incomplete as there is a large n
If you're certain you've found an issue that is directly caused by Forge, you have the following three platforms available for dealing with it, with decreasing relevance for end-users:
1. **Forge Forums:** There's a dedicated [Support & Bug Report](http://www.minecraftforge.net/forum/forum/18-support-bug-reports/) section on the Forge forums, which is led by team of moderators and volunteers who will try to deal with your reports as quickly as possible. *As a player you should probably report here first.*
- For modders, there also is a separate [Modder Support](http://www.minecraftforge.net/forum/forum/70-modder-support/) section where you can ask all your development-related questions. *You should prefer this section for coding help.*
2. **Forge Discord Server:** You can find a lot of help on the official [Discord Server](https://discord.gg/forge), especially smaller issues that you quickly need help with. *Be aware that the channel is more suited towards development questions, so while you may get support there as a player, you should almost always prefer the forums.*
3. **Forge Issue Tracker:** If you're absolutely certain that you've found an issue in the Forge codebase (e.g. you're a modder yourself and have analyzed the stacktrace and relevant code), don't refrain from reporting it on this repository's [issue tracker](https://github.com/MinecraftForge/MinecraftForge/issues). *Please do not use the issues as a means of getting coding help. For developers, the IRC and the [official documentation](https://mcforge.readthedocs.io) are the best sources of information.*
1. **Forge Forums:** There's a dedicated [Support & Bug Report][Bug-Reports] section on the Forge forums, which is led by team of moderators and volunteers who will try to deal with your reports as quickly as possible. *As a player you should probably report here first.*
- For modders, there also is a separate [Modder Support][Modder-Support] section where you can ask all your development-related questions. *You should prefer this section for coding help.*
2. **Forge Discord Server:** You can find a lot of help on the official [Discord Server][Discord], especially smaller issues that you quickly need help with. *Be aware that the channel is more suited towards development questions, so while you may get support there as a player, you should almost always prefer the forums.*
3. **Forge Issue Tracker:** If you're absolutely certain that you've found an issue in the Forge codebase (e.g. you're a modder yourself and have analyzed the stacktrace and relevant code), don't refrain from reporting it on this repository's [issue tracker](https://github.com/MinecraftForge/MinecraftForge/issues). *Please do not use the issues as a means of getting coding help. For developers, the IRC and the [official documentation][Documentation] are the best sources of information.*
### Mod Support
@@ -99,7 +99,7 @@ Now that you've identified the source of your issue and decided on the correct s
### Preventing Duplicates and Unnecessary Reports
Use the target issue tracker's search functionality to look for issues which have descriptions similar to yours, but make sure to also search for already closed issues. If you can find one, verify it is in fact the same (or a very similar issue) and simply comment on it if you have anything else to contribute to the discussion, such as other steps to reproduce it. *Do not create duplicates of an existing issue, since it only puts extra effort on maintainers to recognize and close/mark them.*
Additionally, always check the *latest* changelogs of Forge and participating mods to find out if the bug was already noticed and fixed by the developer. Often the maintainer may only support newer versions of the game, so also check the changelogs for versions of Minecraft you don't actually actively play. If the issue was adressed already, *do not report it*, even if the fix only exists for a newer version of the game, since the developer probably had a good reason to do so. If your issue only exists with versions of a mod that are for very old versions of the game, also refrain from reporting them, considering most modders only support the two latest versions of Minecraft, if at all.
Additionally, always check the *latest* changelogs of Forge and participating mods to find out if the bug was already noticed and fixed by the developer. Often the maintainer may only support newer versions of the game, so also check the changelogs for versions of Minecraft you don't actually actively play. If the issue was addressed already, *do not report it*, even if the fix only exists for a newer version of the game, since the developer probably had a good reason to do so. If your issue only exists with versions of a mod that are for very old versions of the game, also refrain from reporting them, considering most modders only support the two latest versions of Minecraft, if at all.
### Required Information
If you're certain that your issue went unnoticed up until now, you can get to actually writing up the report. Below you can find a list of the *required* information any bug report should contain:
@@ -144,4 +144,11 @@ After you have written your bug report, it is time to *wait*. Please be *patient
Every project has a different way of dealing with issues, so don't wonder if there's no comment on it, but somebody "labels" it with certain markers. This helps developers to more easily keep track of bugs and priorities. When any further input from you is required, you will be asked specifically. Do not bug anyone through other channels about resolving your issue.
Once your issue is closed, you will know whether it was valid or turned out to be irreproducible. If you included all of the data from above in your report, chances are that the latter won't be the case.
Once your issue is closed, you will know whether it was valid or turned out to be unreproducible. If you included all of the data from above in your report, chances are that the latter won't be the case.
[Bug-Reports]: https://forums.minecraftforge.net/forum/18-support-bug-reports/
[Modder-Support]: https://forums.minecraftforge.net/forum/70-modder-support/
[Discord]: https://discord.minecraftforge.net/
[Documentation]: https://docs.minecraftforge.net/
@@ -5,33 +5,93 @@
package net.minecraftforge.fml;
import com.mojang.logging.LogUtils;
import org.slf4j.Logger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.function.BooleanSupplier;
import java.util.function.Supplier;
public class CrashReportCallables {
public class CrashReportCallables
{
private static final Logger LOGGER = LogUtils.getLogger();
private static final List<ISystemReportExtender> crashCallables = Collections.synchronizedList(new ArrayList<>());
/**
* Register a custom {@link ISystemReportExtender}
*/
public static void registerCrashCallable(ISystemReportExtender callable)
{
crashCallables.add(callable);
}
public static void registerCrashCallable(String headerName, Supplier<String> reportGenerator) {
registerCrashCallable(new ISystemReportExtender() {
/**
* Register a {@link ISystemReportExtender system report extender} with the given header name and content
* generator, which will always be appended to the system report
* @param headerName The name of the system report entry
* @param reportGenerator The report generator to be called when a crash report is built
*/
public static void registerCrashCallable(String headerName, Supplier<String> reportGenerator)
{
registerCrashCallable(new ISystemReportExtender()
{
@Override
public String getLabel() {
public String getLabel()
{
return headerName;
}
@Override
public String get() {
public String get()
{
return reportGenerator.get();
}
});
}
public static List<ISystemReportExtender> allCrashCallables() {
/**
* Register a {@link ISystemReportExtender system report extender} with the given header name and content
* generator, which will only be appended to the system report when the given {@link BooleanSupplier} returns true
* @param headerName The name of the system report entry
* @param reportGenerator The report generator to be called when a crash report is built
* @param active The supplier of the flag to be checked when a crash report is built
*/
public static void registerCrashCallable(String headerName, Supplier<String> reportGenerator, BooleanSupplier active)
{
registerCrashCallable(new ISystemReportExtender()
{
@Override
public String getLabel()
{
return headerName;
}
@Override
public String get()
{
return reportGenerator.get();
}
@Override
public boolean isActive()
{
try
{
return active.getAsBoolean();
}
catch (Throwable t)
{
LOGGER.warn("CrashCallable '{}' threw an exception while checking the active flag, disabling", headerName, t);
return false;
}
}
});
}
public static List<ISystemReportExtender> allCrashCallables()
{
return List.copyOf(crashCallables);
}
}
@@ -11,9 +11,11 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.ConcurrentLinkedDeque;
import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.function.Supplier;
import com.google.common.base.Stopwatch;
@@ -53,17 +55,29 @@ public class DeferredWorkQueue
public void runTasks() {
if (tasks.isEmpty()) return;
LOGGER.debug(LOADING, "Dispatching synchronous work for work queue {}: {} jobs", modLoadingStage, tasks.size());
RuntimeException aggregate = new RuntimeException();
Stopwatch timer = Stopwatch.createStarted();
tasks.forEach(t->makeRunnable(t, Runnable::run));
tasks.forEach(t -> makeRunnable(t, Runnable::run, aggregate));
timer.stop();
LOGGER.debug(LOADING, "Synchronous work queue completed in {}", timer);
if (aggregate.getSuppressed().length > 0) {
LOGGER.fatal(
LOADING,
"Synchronous work queue completed exceptionally in {}, see suppressed exceptions for details:",
timer,
aggregate
);
//TODO 1.20: throw aggregate exception
} else {
LOGGER.debug(LOADING, "Synchronous work queue completed in {}", timer);
}
}
private static void makeRunnable(TaskInfo ti, Executor executor) {
private static void makeRunnable(TaskInfo ti, Executor executor, RuntimeException aggregate) {
executor.execute(() -> {
Stopwatch timer = Stopwatch.createStarted();
ModLoadingContext.get().setActiveContainer(ti.owner);
try {
ti.future.exceptionally(t -> captureException(ti.owner.getModId(), aggregate, t));
ti.task.run();
} finally {
ModLoadingContext.get().setActiveContainer(null);
@@ -75,13 +89,38 @@ public class DeferredWorkQueue
});
}
private static <T> T captureException(String modId, RuntimeException aggregate, Throwable throwable) {
if (throwable instanceof CompletionException ce) {
throwable = ce.getCause();
}
aggregate.addSuppressed(throwable);
LOGGER.error("Mod '{}' encountered an error in a deferred task:", modId, throwable);
return null;
}
public CompletableFuture<Void> enqueueWork(final ModContainer modInfo, final Runnable work) {
return CompletableFuture.runAsync(work, r->tasks.add(new TaskInfo(modInfo, r)));
return enqueueWork(modInfo, taskInfo -> CompletableFuture.runAsync(work, r -> taskInfo.task = r));
}
public <T> CompletableFuture<T> enqueueWork(final ModContainer modInfo, final Supplier<T> work) {
return CompletableFuture.supplyAsync(work, r->tasks.add(new TaskInfo(modInfo, r)));
return enqueueWork(modInfo, taskInfo -> CompletableFuture.supplyAsync(work, r -> taskInfo.task = r));
}
record TaskInfo(ModContainer owner, Runnable task) {}
private <T> CompletableFuture<T> enqueueWork(final ModContainer modInfo, Function<TaskInfo, CompletableFuture<T>> futureGen) {
TaskInfo taskInfo = new TaskInfo(modInfo);
CompletableFuture<T> future = futureGen.apply(taskInfo);
taskInfo.future = future;
tasks.add(taskInfo);
return future;
}
private static class TaskInfo {
private final ModContainer owner;
private Runnable task;
private CompletableFuture<?> future;
private TaskInfo(ModContainer owner) {
this.owner = owner;
}
}
}
@@ -10,4 +10,9 @@ import java.util.function.Supplier;
public interface ISystemReportExtender extends Supplier<String>
{
String getLabel();
default boolean isActive()
{
return true;
}
}
@@ -82,6 +82,7 @@ public class ModLoader
private boolean loadingStateValid;
@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
private final Optional<Consumer<String>> statusConsumer = StartupMessageManager.modLoaderConsumer();
private final Set<IModLoadingState> completedStates = new HashSet<>();
private ModList modList;
private ModLoader()
@@ -200,6 +201,7 @@ public class ModLoader
statusConsumer.ifPresent(c->c.accept(state.message().apply(this.modList)));
state.inlineRunnable().ifPresent(a->a.accept(this.modList));
state.buildTransition(syncExecutor, parallelExecutor).ifPresent(t->waitForTransition(state, syncExecutor, ticker, t));
completedStates.add(state);
}
private void dispatchAndHandleError(IModLoadingState state, ModWorkManager.DrivenExecutor syncExecutor, Executor parallelExecutor, final Runnable ticker, Function<Executor, CompletableFuture<Void>> preSyncTask, Function<Executor, CompletableFuture<Void>> postSyncTask) {
@@ -210,6 +212,7 @@ public class ModLoader
statusConsumer.ifPresent(c->c.accept(state.message().apply(this.modList)));
state.inlineRunnable().ifPresent(a->a.accept(this.modList));
state.buildTransition(syncExecutor, parallelExecutor, preSyncTask, postSyncTask).ifPresent(t->waitForTransition(state, syncExecutor, ticker, t));
completedStates.add(state);
}
private void waitForTransition(final IModLoadingState state, final ModWorkManager.DrivenExecutor syncExecutor, final Runnable ticker, final CompletableFuture<Void> transition) {
@@ -296,6 +299,11 @@ public class ModLoader
return get().loadingStateValid;
}
public boolean hasCompletedState(final String stateName) {
IModLoadingState state = stateManager.findState(stateName);
return completedStates.contains(state);
}
public <T extends Event & IModBusEvent> void runEventGenerator(Function<ModContainer, T> generator) {
if (!loadingStateValid) {
LOGGER.error("Cowardly refusing to send event generator to a broken mod state");
@@ -319,6 +327,9 @@ public class ModLoader
ModList.get().forEachModInOrder(mc -> mc.acceptEvent(e));
return e;
}
public <T extends Event & IModBusEvent> void postEventWrapContainerInModOrder(T event) {
postEventWithWrapInModOrder(event, (mc, e) -> ModLoadingContext.get().setActiveContainer(mc), (mc, e) -> ModLoadingContext.get().setActiveContainer(null));
}
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());
@@ -39,4 +39,13 @@ public class ModStateManager {
nodes.forEach(n->graph.putEdge(lookup.getOrDefault(n.previous(), dummy), n));
return TopologicalSort.topologicalSort(graph, Comparator.comparingInt(nodes::indexOf)).stream().filter(st->st!=dummy).toList();
}
public IModLoadingState findState(final String stateName) {
return stateMap.values()
.stream()
.flatMap(Collection::stream)
.filter(mls -> mls.name().equals(stateName))
.findFirst()
.orElseThrow(() -> new IllegalArgumentException("Unknown IModLoadingState: " + stateName));
}
}
@@ -66,8 +66,12 @@ public class ConfigTracker {
private void closeConfig(final ModConfig config, final Path configBasePath) {
if (config.getConfigData() != null) {
LOGGER.trace(CONFIG, "Closing config file type {} at {} for {}", config.getType(), config.getFileName(), config.getModId());
config.save();
// stop the filewatcher before we save the file and close it, so reload doesn't fire
config.getHandler().unload(configBasePath, config);
var unloading = IConfigEvent.unloading(config);
if (unloading != null)
config.fireEvent(unloading);
config.save();
config.setConfigData(null);
}
}
@@ -10,8 +10,11 @@ import net.minecraftforge.fml.Bindings;
import java.util.function.Function;
import org.jetbrains.annotations.Nullable;
public interface IConfigEvent {
record ConfigConfig(Function<ModConfig, IConfigEvent> loading, Function<ModConfig, IConfigEvent> reloading) {}
record ConfigConfig(Function<ModConfig, IConfigEvent> loading, Function<ModConfig, IConfigEvent> reloading, @Nullable Function<ModConfig, IConfigEvent> unloading) {}
ConfigConfig CONFIGCONFIG = Bindings.getConfigConfiguration().get();
static IConfigEvent reloading(ModConfig modConfig) {
@@ -20,6 +23,9 @@ public interface IConfigEvent {
static IConfigEvent loading(ModConfig modConfig) {
return CONFIGCONFIG.loading().apply(modConfig);
}
@Nullable static IConfigEvent unloading(ModConfig modConfig) {
return CONFIGCONFIG.unloading() == null ? null : CONFIGCONFIG.unloading().apply(modConfig);
}
ModConfig getConfig();
@SuppressWarnings("unchecked")
@@ -69,7 +69,7 @@ public class FMLConfig
LOGGER.trace(CORE, "Version check is {}", FMLConfig.runVersionCheck());
LOGGER.trace(CORE, "Default config paths at {}", FMLConfig.defaultConfigPath());
}
FMLPaths.getOrCreateGameRelativePath(Paths.get(FMLConfig.defaultConfigPath()), "default config directory");
FMLPaths.getOrCreateGameRelativePath(Paths.get(FMLConfig.defaultConfigPath()));
}
public static boolean splashScreenEnabled() {
@@ -9,6 +9,8 @@ import com.mojang.logging.LogUtils;
import cpw.mods.modlauncher.api.IEnvironment;
import org.slf4j.Logger;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
@@ -57,9 +59,13 @@ public enum FMLPaths
for (FMLPaths path : FMLPaths.values())
{
path.absolutePath = rootPath.resolve(path.relativePath).toAbsolutePath().normalize();
if (path.isDirectory)
if (path.isDirectory && !Files.isDirectory(path.absolutePath))
{
FileUtils.getOrCreateDirectory(path.absolutePath, path.name());
try {
Files.createDirectories(path.absolutePath);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
if (LOGGER.isDebugEnabled(CORE))
{
@@ -68,8 +74,26 @@ public enum FMLPaths
}
}
/**
* @deprecated Use {@link #getOrCreateGameRelativePath(Path)} instead.
*/
@Deprecated(forRemoval = true, since = "1.19.4")
public static Path getOrCreateGameRelativePath(Path path, String name) {
return FileUtils.getOrCreateDirectory(FMLPaths.GAMEDIR.get().resolve(path), name);
return getOrCreateGameRelativePath(path);
}
public static Path getOrCreateGameRelativePath(Path path) {
Path gameFolderPath = FMLPaths.GAMEDIR.get().resolve(path);
if (!Files.isDirectory(gameFolderPath)) {
try {
Files.createDirectories(gameFolderPath);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return gameFolderPath;
}
public Path relative() {
@@ -10,37 +10,27 @@ import org.slf4j.Logger;
import java.io.File;
import java.io.IOException;
import java.nio.file.FileAlreadyExistsException;
import java.nio.file.Files;
import java.nio.file.Path;
import static net.minecraftforge.fml.loading.LogMarkers.CORE;
public class FileUtils
{
private static final Logger LOGGER = LogUtils.getLogger();
/**
* @deprecated Use normal Java NIO methods instead
*/
@Deprecated(forRemoval = true, since = "1.19.4")
public static Path getOrCreateDirectory(Path dirPath, String dirLabel) {
if (!Files.isDirectory(dirPath.getParent())) {
getOrCreateDirectory(dirPath.getParent(), "parent of "+dirLabel);
}
if (!Files.isDirectory(dirPath))
{
LOGGER.debug(CORE, "Making {} directory : {}", dirLabel, dirPath);
try {
Files.createDirectory(dirPath);
Files.createDirectories(dirPath);
} catch (IOException e) {
if (e instanceof FileAlreadyExistsException) {
LOGGER.error(CORE, "Failed to create {} directory - there is a file in the way", dirLabel);
} else {
LOGGER.error(CORE, "Problem with creating {} directory (Permissions?)", dirLabel, e);
}
throw new RuntimeException("Problem creating directory", e);
}
LOGGER.debug(CORE, "Created {} directory : {}", dirLabel, dirPath);
} else {
LOGGER.debug(CORE, "Found existing {} directory : {}", dirLabel, dirPath);
}
return dirPath;
}
@@ -54,7 +44,7 @@ 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()));
@@ -11,11 +11,17 @@ import net.minecraftforge.forgespi.language.IModInfo;
import org.apache.maven.artifact.versioning.ArtifactVersion;
import org.slf4j.Logger;
import java.util.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import static java.util.stream.Collectors.*;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.joining;
import static net.minecraftforge.fml.loading.LogMarkers.LOADING;
public class UniqueModListBuilder
{
@@ -66,28 +72,35 @@ public class UniqueModListBuilder
// Its theoretically possible that some mod has somehow moved an id to a secondary place, thus causing a dupe.
// We can't handle this
final List<IModInfo> dupedMods = modIds.values().stream()
final List<String> dupedModErrors = modIds.values().stream()
.filter(modInfos -> modInfos.size() > 1)
.map(modInfos -> modInfos.get(0))
.toList();
.map(mods -> String.format("\tMod ID: '%s' from mod files: %s",
mods.get(0).getModId(),
mods.stream()
.map(modInfo -> modInfo.getOwningFile().getFile().getFileName()).collect(joining(", "))
)).toList();
if (!dupedMods.isEmpty()) {
final List<EarlyLoadingException.ExceptionData> duplicateModErrors = dupedMods.stream()
.map(dm -> new EarlyLoadingException.ExceptionData("fml.modloading.dupedmod", dm, Objects.toString(dm)))
.toList();
throw new EarlyLoadingException("Duplicate mods found", null, duplicateModErrors);
if (!dupedModErrors.isEmpty()) {
LOGGER.error(LOADING, "Found duplicate mods:\n{}", dupedModErrors.stream().collect(joining("\n")));
throw new EarlyLoadingException("Duplicate mods found", null, dupedModErrors.stream()
.map(s -> new EarlyLoadingException.ExceptionData(s))
.toList());
}
final List<ModFile> dupedLibs = versionedLibIds.values().stream()
.filter(modFiles -> modFiles.size() > 1)
.map(modFiles -> modFiles.get(0))
.toList();
if (!dupedLibs.isEmpty()) {
final List<EarlyLoadingException.ExceptionData> duplicateLibErrors = dupedLibs.stream()
.map(dm -> new EarlyLoadingException.ExceptionData("fml.modloading.dupedlib.versioned", dm, Objects.toString(dm)))
.toList();
throw new EarlyLoadingException("Duplicate plugins or libraries found", null, duplicateLibErrors);
final List<String> dupedLibErrors = versionedLibIds.values().stream()
.filter(modFiles -> modFiles.size() > 1)
.map(mods -> String.format("\tLibrary: '%s' from files: %s",
getModId(mods.get(0)),
mods.stream()
.map(modFile -> modFile.getFileName()).collect(joining(", "))
)).toList();
if (!dupedLibErrors.isEmpty()) {
LOGGER.error(LOADING, "Found duplicate plugins or libraries:\n{}", dupedLibErrors.stream().collect(joining("\n")));
throw new EarlyLoadingException("Duplicate plugins or libraries found", null, dupedLibErrors.stream()
.map(s -> new EarlyLoadingException.ExceptionData(s))
.toList());
}
// Collect unique mod files by module name. This will be used for deduping purposes
@@ -42,6 +42,6 @@ public class FMLOnlyBindings implements IBindingsProvider {
@Override
public Supplier<IConfigEvent.ConfigConfig> getConfigConfiguration() {
return ()->new IConfigEvent.ConfigConfig(ModConfigEvent.Loading::new, ModConfigEvent.Reloading::new);
return ()->new IConfigEvent.ConfigConfig(ModConfigEvent.Loading::new, ModConfigEvent.Reloading::new, ModConfigEvent.Unloading::new);
}
}
@@ -52,7 +52,7 @@ public class ClientModLoader
}
}
}
public static void begin(final Minecraft minecraft, final PackRepository defaultResourcePacks, final ReloadableResourceManager mcResourceManager, ClientPackSource metadataSerializer)
public static void begin(final Minecraft minecraft, final PackRepository defaultResourcePacks, final ReloadableResourceManager mcResourceManager)
{
// force log4j to shutdown logging in a shutdown hook. This is because we disable default shutdown hook so the server properly logs it's shutdown
Runtime.getRuntime().addShutdownHook(new Thread(LogManager::shutdown));
@@ -0,0 +1,56 @@
/*
* Minecraft Forge - Forge Development LLC
* SPDX-License-Identifier: LGPL-2.1-only
*/
package net.minecraftforge.fmlonlyserver;
import joptsimple.OptionParser;
import net.minecraftforge.fml.LoadingFailedException;
import net.minecraftforge.fml.ModLoader;
import net.minecraftforge.fml.ModLoadingWarning;
import net.minecraftforge.fml.ModWorkManager;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.File;
import java.util.List;
import static net.minecraftforge.fml.Logging.LOADING;
public class ServerModLoader
{
private static final Logger LOGGER = LogManager.getLogger();
private static boolean hasErrors = false;
public static void addOptions(OptionParser parser)
{
// We consume this argument as we use it in the launcher and the client side.
parser.accepts("gameDir").withRequiredArg().ofType(File.class).defaultsTo(new File("."));
}
public static void load()
{
try
{
ModLoader.get().gatherAndInitializeMods(ModWorkManager.syncExecutor(), ModWorkManager.parallelExecutor(), () -> {});
ModLoader.get().loadMods(ModWorkManager.syncExecutor(), ModWorkManager.parallelExecutor(), () -> {});
ModLoader.get().finishMods(ModWorkManager.syncExecutor(), ModWorkManager.parallelExecutor(), () -> {});
} catch (LoadingFailedException error)
{
ServerModLoader.hasErrors = true;
throw error;
}
List<ModLoadingWarning> warnings = ModLoader.get().getWarnings();
if (!warnings.isEmpty())
{
LOGGER.warn(LOADING, "Mods loaded with {} warnings", warnings.size());
warnings.forEach(warning -> LOGGER.warn(LOADING, warning.formatToString()));
}
}
public static boolean hasErrors()
{
return ServerModLoader.hasErrors;
}
}
@@ -1,3 +1,4 @@
{
"load_fml_client": "coremods/load_fml_client.js"
"load_fml_client": "coremods/load_fml_client.js",
"load_fml_server": "coremods/load_fml_server.js"
}
@@ -15,16 +15,13 @@ function initializeCoreMod() {
var meth = ASMAPI.getMethodNode();
var resourcePackRepository = ASMAPI.mapField("f_91038_")
var resourceManager = ASMAPI.mapField("f_91036_")
var clientPackSource = ASMAPI.mapField("f_91037_")
meth.visitVarInsn(Opcodes.ALOAD, 0);
meth.visitVarInsn(Opcodes.ALOAD, 0);
meth.visitFieldInsn(Opcodes.GETFIELD, "net/minecraft/client/Minecraft", resourcePackRepository, "Lnet/minecraft/server/packs/repository/PackRepository;");
meth.visitVarInsn(Opcodes.ALOAD, 0);
meth.visitFieldInsn(Opcodes.GETFIELD, "net/minecraft/client/Minecraft", resourceManager, "Lnet/minecraft/server/packs/resources/ReloadableResourceManager;");
meth.visitVarInsn(Opcodes.ALOAD, 0);
meth.visitFieldInsn(Opcodes.GETFIELD, "net/minecraft/client/Minecraft", clientPackSource, "Lnet/minecraft/client/resources/ClientPackSource;");
meth.visitMethodInsn(Opcodes.INVOKESTATIC, "net/minecraftforge/fmlonlyclient/ClientModLoader", "begin", "(Lnet/minecraft/client/Minecraft;Lnet/minecraft/server/packs/repository/PackRepository;Lnet/minecraft/server/packs/resources/ReloadableResourceManager;Lnet/minecraft/client/resources/ClientPackSource;)V", false)
meth.visitMethodInsn(Opcodes.INVOKESTATIC, "net/minecraftforge/fmlonlyclient/ClientModLoader", "begin", "(Lnet/minecraft/client/Minecraft;Lnet/minecraft/server/packs/repository/PackRepository;Lnet/minecraft/server/packs/resources/ReloadableResourceManager;)V", false)
for (var i=0; i<methodNode.instructions.size(); i++) {
var ain = methodNode.instructions.get(i);
if (ain.getOpcode() == Opcodes.PUTFIELD && ain.name.equals(resourceManager)) {
@@ -0,0 +1,35 @@
var ASMAPI = Java.type('net.minecraftforge.coremod.api.ASMAPI')
var Opcodes = Java.type('org.objectweb.asm.Opcodes')
function initializeCoreMod() {
return {
'minecraft': {
'target': {
'type': 'METHOD',
'class': 'net.minecraft.server.Main',
'methodName': 'main',
'methodDesc': '([Ljava/lang/String;)V'
},
'transformer': function(methodNode) {
var meth = ASMAPI.getMethodNode();
meth.visitMethodInsn(Opcodes.INVOKESTATIC, 'net/minecraftforge/fmlonlyserver/ServerModLoader', 'load', '()V', false)
var methOptions = ASMAPI.getMethodNode();
methOptions.visitIntInsn(Opcodes.ALOAD, 1);
methOptions.visitMethodInsn(Opcodes.INVOKESTATIC, 'net/minecraftforge/fmlonlyserver/ServerModLoader', 'addOptions', '(Ljoptsimple/OptionParser;)V', false)
for (var i=0; i<methodNode.instructions.size(); i++) {
var ain = methodNode.instructions.get(i);
if (ain.getOpcode() == Opcodes.INVOKESPECIAL && ain.owner == 'joptsimple/OptionParser' && ain.name == '<init>' && ain.desc == '()V') {
// Inject after the STORE
methodNode.instructions.insert(methodNode.instructions.get(i + 1), methOptions.instructions);
} else if (ain.getOpcode() == Opcodes.INVOKESTATIC && ain.owner == 'net/minecraft/Util' && ain.name == ASMAPI.mapMethod('m_137584_') /* startTimerHackThread */ && ain.desc == '()V') {
methodNode.instructions.insert(ain, meth.instructions);
break; // By this point we've already reached the first injection point so break
}
}
return methodNode;
}
},
}
}
-8
View File
@@ -1,8 +0,0 @@
{
"pack": {
"description": "examplemod resources",
"pack_format": 12,
"forge:resource_pack_format": 12,
"forge:data_pack_format": 10
}
}
@@ -1,7 +1,7 @@
--- a/com/mojang/blaze3d/platform/GlStateManager.java
+++ b/com/mojang/blaze3d/platform/GlStateManager.java
@@ -510,9 +_,16 @@
f_84077_[f_84076_].f_84800_ = false;
@@ -500,9 +_,16 @@
}
+ /* Stores the last values sent into glMultiTexCoord2f */
@@ -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;
@@ -263,6 +_,7 @@
@@ -260,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,15 +1,15 @@
--- a/com/mojang/math/Transformation.java
+++ b/com/mojang/math/Transformation.java
@@ -12,7 +_,7 @@
@@ -14,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
@@ -139,6 +_,19 @@
public static final Codec<Transformation> f_268453_ = RecordCodecBuilder.create((p_269604_) -> {
return p_269604_.group(ExtraCodecs.f_252432_.fieldOf("translation").forGetter((p_269599_) -> {
@@ -163,6 +_,19 @@
public int hashCode() {
return Objects.hash(this.f_121078_);
}
@@ -0,0 +1,15 @@
--- a/com/mojang/realmsclient/gui/screens/RealmsNotificationsScreen.java
+++ b/com/mojang/realmsclient/gui/screens/RealmsNotificationsScreen.java
@@ -47,9 +_,9 @@
}
};
private final RealmsNotificationsScreen.DataFetcherConfiguration f_273849_ = new RealmsNotificationsScreen.DataFetcherConfiguration() {
- public DataFetcher.Subscription m_274316_(RealmsDataFetcher p_275731_) {
- DataFetcher.Subscription datafetcher$subscription = p_275731_.f_238549_.m_239139_();
- RealmsNotificationsScreen.this.m_274585_(p_275731_, datafetcher$subscription);
+ public DataFetcher.Subscription m_274316_(RealmsDataFetcher p_275318_) {
+ DataFetcher.Subscription datafetcher$subscription = p_275318_.f_238549_.m_239139_();
+ RealmsNotificationsScreen.this.m_274585_(p_275318_, datafetcher$subscription);
return datafetcher$subscription;
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/SharedConstants.java
+++ b/net/minecraft/SharedConstants.java
@@ -214,6 +_,7 @@
@@ -205,6 +_,7 @@
}
static {
@@ -9,12 +9,12 @@
+ @SuppressWarnings("unused") private static java.util.function.LongSupplier INNER_CLASS_SHIFT1 = new java.util.function.LongSupplier() { public long getAsLong() { return 0; } };
+ @SuppressWarnings("unused") private static java.util.function.LongSupplier INNER_CLASS_SHIFT2 = new java.util.function.LongSupplier() { public long getAsLong() { return 0; } };
+
public static ExecutorService m_183988_() {
return f_137443_;
public static ExecutorService m_183991_() {
return f_137444_;
}
@@ -242,7 +_,7 @@
@@ -238,7 +_,7 @@
try {
type = DataFixers.m_14512_().getSchema(DataFixUtils.makeKey(SharedConstants.m_183709_().getWorldVersion())).getChoiceType(p_137552_, p_137553_);
type = DataFixers.m_14512_().getSchema(DataFixUtils.makeKey(SharedConstants.m_183709_().m_183476_().m_193006_())).getChoiceType(p_137552_, p_137553_);
} catch (IllegalArgumentException illegalargumentexception) {
- f_137446_.error("No data fixer registered for {}", (Object)p_137553_);
+ f_137446_.debug("No data fixer registered for {}", (Object)p_137553_);
@@ -1,6 +1,6 @@
--- a/net/minecraft/advancements/Advancement.java
+++ b/net/minecraft/advancements/Advancement.java
@@ -127,7 +_,7 @@
@@ -144,7 +_,7 @@
return this.f_138305_;
}
@@ -9,7 +9,7 @@
@Nullable
private ResourceLocation f_138332_;
@Nullable
@@ -308,7 +_,14 @@
@@ -325,7 +_,14 @@
return "Task Advancement{parentId=" + this.f_138332_ + ", display=" + this.f_138334_ + ", rewards=" + this.f_138335_ + ", criteria=" + this.f_138336_ + ", requirements=" + Arrays.deepToString(this.f_138337_) + "}";
}
@@ -1,10 +0,0 @@
--- a/net/minecraft/advancements/AdvancementList.java
+++ b/net/minecraft/advancements/AdvancementList.java
@@ -90,6 +_,7 @@
}
}
+ net.minecraftforge.common.AdvancementLoadFix.buildSortedTrees(this.f_139327_);
f_139325_.info("Loaded {} advancements", (int)this.f_139326_.size());
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/ClientRecipeBook.java
+++ b/net/minecraft/client/ClientRecipeBook.java
@@ -51,7 +_,7 @@
@@ -54,7 +_,7 @@
for(Recipe<?> recipe : p_90643_) {
if (!recipe.m_5598_() && !recipe.m_142505_()) {
RecipeBookCategories recipebookcategories = m_90646_(recipe);
@@ -9,7 +9,7 @@
if (s.isEmpty()) {
map.computeIfAbsent(recipebookcategories, (p_90645_) -> {
return Lists.newArrayList();
@@ -138,6 +_,8 @@
@@ -141,6 +_,8 @@
} else if (recipetype == RecipeType.f_44113_) {
return RecipeBookCategories.SMITHING;
} else {
@@ -12,6 +12,15 @@
private static final Set<String> f_90811_ = Sets.newHashSet();
public static final String f_167805_ = "key.categories.movement";
public static final String f_167806_ = "key.categories.misc";
@@ -41,7 +_,7 @@
private int f_90818_;
public static void m_90835_(InputConstants.Key p_90836_) {
- KeyMapping keymapping = f_90810_.get(p_90836_);
+ for (KeyMapping keymapping : f_90810_.getAll(p_90836_))
if (keymapping != null) {
++keymapping.f_90818_;
}
@@ -49,7 +_,7 @@
}
@@ -1,9 +1,9 @@
--- a/net/minecraft/client/KeyboardHandler.java
+++ b/net/minecraft/client/KeyboardHandler.java
@@ -298,7 +_,9 @@
@@ -328,7 +_,9 @@
}
}
Screen screen = this.f_90867_.f_91080_;
- if (p_90897_ == 1 && (!(this.f_90867_.f_91080_ instanceof KeyBindsScreen) || ((KeyBindsScreen)screen).f_193976_ <= Util.m_137550_() - 20L)) {
+
+ if ((!(this.f_90867_.f_91080_ instanceof KeyBindsScreen) || ((KeyBindsScreen)screen).f_193976_ <= Util.m_137550_() - 20L)) {
@@ -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_());
@@ -316,6 +_,8 @@
@@ -346,6 +_,8 @@
});
return;
}
@@ -20,7 +20,7 @@
}
if (this.f_90867_.m_240477_().m_93316_()) {
@@ -338,11 +_,15 @@
@@ -368,11 +_,15 @@
Screen.m_96579_(() -> {
if (p_90897_ != 1 && p_90897_ != 2) {
if (p_90897_ == 0) {
@@ -38,7 +38,7 @@
}
}, "keyPressed event handler", screen.getClass().getCanonicalName());
@@ -395,22 +_,26 @@
@@ -425,22 +_,26 @@
}
}
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/Minecraft.java
+++ b/net/minecraft/client/Minecraft.java
@@ -245,7 +_,7 @@
@@ -247,7 +_,7 @@
import org.slf4j.Logger;
@OnlyIn(Dist.CLIENT)
@@ -9,7 +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;
@@ -410,7 +_,6 @@
@@ -412,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_());
@@ -17,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_;
@@ -459,7 +_,7 @@
@@ -462,7 +_,7 @@
this.f_90990_.m_85380_(this.f_91066_.m_232035_().m_231551_());
this.f_91067_ = new MouseHandler(this);
@@ -26,7 +26,7 @@
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);
@@ -467,6 +_,7 @@
@@ -470,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);
@@ -34,7 +34,7 @@
this.f_91038_.m_10506_();
this.f_91066_.m_92145_(this.f_91038_);
this.f_91039_ = new LanguageManager(this.f_91066_.f_92075_);
@@ -511,10 +_,13 @@
@@ -514,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_.m_247116_());
this.f_91060_ = new LevelRenderer(this, this.f_90994_, this.f_167845_, this.f_90993_);
@@ -49,7 +49,7 @@
this.f_91036_.m_7217_(this.f_91061_);
this.f_91053_ = new PaintingTextureManager(this.f_90987_);
this.f_91036_.m_7217_(this.f_91053_);
@@ -523,7 +_,9 @@
@@ -526,7 +_,9 @@
this.f_91047_ = new GpuWarnlistManager();
this.f_91036_.m_7217_(this.f_91047_);
this.f_91036_.m_7217_(this.f_205120_);
@@ -60,29 +60,15 @@
this.f_91064_ = new DebugRenderer(this);
this.f_238717_ = new RealmsDataFetcher(RealmsClient.m_239151_(this));
RenderSystem.m_69900_(this::m_91113_);
@@ -542,6 +_,21 @@
@@ -545,6 +_,7 @@
TinyFileDialogs.tinyfd_messageBox("Minecraft", stringbuilder.toString(), "ok", "error", false);
}
+ net.minecraftforge.gametest.ForgeGameTestHooks.registerGametests();
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.RegisterClientReloadListenersEvent(this.f_91036_));
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.EntityRenderersEvent.RegisterLayerDefinitions());
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.EntityRenderersEvent.RegisterRenderers());
+ net.minecraftforge.client.textures.TextureAtlasSpriteLoaderManager.init();
+ net.minecraftforge.client.gui.ClientTooltipComponentManager.init();
+ net.minecraftforge.client.EntitySpectatorShaderManager.init();
+ net.minecraftforge.client.ForgeHooksClient.onRegisterKeyMappings(f_91066_);
+ net.minecraftforge.client.RecipeBookManager.init();
+ net.minecraftforge.client.gui.overlay.GuiOverlayManager.init();
+ net.minecraftforge.client.DimensionSpecialEffectsManager.init();
+ net.minecraftforge.client.NamedRenderTypeManager.init();
+ net.minecraftforge.client.ColorResolverManager.init();
+ net.minecraftforge.client.ItemDecoratorHandler.init();
+
+ net.minecraftforge.client.ForgeHooksClient.initClientHooks(this, this.f_91036_);
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_();
@@ -565,24 +_,24 @@
@@ -568,26 +_,26 @@
}
this.f_167847_.m_168556_();
@@ -99,6 +85,8 @@
+
+ this.m_91152_(new TitleScreen(true));
+ }, this.m_239210_()));
+ } else if (this.f_91066_.f_263744_) {
+ this.m_91152_(new AccessibilityOnboardingScreen(this.f_91066_));
+ } else {
+ this.m_91152_(new TitleScreen(true));
+ }
@@ -117,13 +105,15 @@
-
- this.m_91152_(new TitleScreen(true));
- }, this.m_239210_()));
- } else if (this.f_91066_.f_263744_) {
- this.m_91152_(new AccessibilityOnboardingScreen(this.f_91066_));
- } else {
- this.m_91152_(new TitleScreen(true));
- }
}
@@ -634,6 +_,8 @@
@@ -639,6 +_,8 @@
private UserApiService m_193585_(YggdrasilAuthenticationService p_193586_, GameConfig p_193587_) {
try {
@@ -132,7 +122,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);
@@ -646,7 +_,7 @@
@@ -651,7 +_,7 @@
}
private void m_91239_(Throwable p_91240_) {
@@ -141,7 +131,7 @@
this.m_91241_(p_91240_, (Component)null);
} else {
Util.m_137559_(p_91240_);
@@ -723,7 +_,10 @@
@@ -743,7 +_,10 @@
}
public void m_91271_() {
@@ -153,7 +143,7 @@
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 @@
@@ -754,7 +_,8 @@
return Stream.of(BuiltInRegistries.f_257033_.m_7981_(p_91317_.m_41720_()));
}, p_231451_);
});
@@ -163,7 +153,7 @@
return new IdSearchTree<>((p_231353_) -> {
return p_231353_.m_204131_().map(TagKey::f_203868_);
}, p_231430_);
@@ -754,9 +_,12 @@
@@ -774,9 +_,12 @@
});
}, p_231389_);
});
@@ -179,7 +169,7 @@
});
}
@@ -808,13 +_,13 @@
@@ -828,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_());
@@ -196,7 +186,7 @@
}
}
@@ -932,10 +_,6 @@
@@ -959,10 +_,6 @@
f_90982_.error("setScreen called from non-game thread");
}
@@ -207,7 +197,7 @@
if (p_91153_ == null && this.f_91073_ == null) {
p_91153_ = new TitleScreen();
} else if (p_91153_ == null && this.f_91074_.m_21224_()) {
@@ -946,6 +_,19 @@
@@ -973,6 +_,19 @@
}
}
@@ -225,9 +215,9 @@
+ }
+
this.f_91080_ = p_91153_;
BufferUploader.m_166835_();
if (p_91153_ != null) {
@@ -1091,11 +_,14 @@
if (this.f_91080_ != null) {
this.f_91080_.m_274333_();
@@ -1118,9 +_,12 @@
RenderSystem.m_69481_();
this.f_91026_.m_7238_();
if (!this.f_91079_) {
@@ -235,14 +225,12 @@
+ net.minecraftforge.event.ForgeEventFactory.onRenderTickStart(this.realPartialTick);
this.f_91026_.m_6182_("gameRenderer");
this.f_91063_.m_109093_(this.f_91012_ ? this.f_91013_ : this.f_90991_.f_92518_, i, p_91384_);
this.f_91026_.m_6182_("toasts");
this.f_91003_.m_94920_(new PoseStack());
this.f_91026_.m_7238_();
+ net.minecraftforge.event.ForgeEventFactory.onRenderTickEnd(this.realPartialTick);
}
if (this.f_91056_ != null) {
@@ -1223,10 +_,12 @@
@@ -1243,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_());
@@ -255,7 +243,7 @@
this.f_91063_.m_109097_(this.f_90990_.m_85441_(), this.f_90990_.m_85442_());
this.f_91067_.m_91599_();
}
@@ -1499,6 +_,7 @@
@@ -1520,6 +_,7 @@
}
public void m_91395_() {
@@ -263,7 +251,7 @@
this.f_91019_ = false;
}
@@ -1528,10 +_,18 @@
@@ -1549,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_();
@@ -285,21 +273,16 @@
this.f_91074_.m_6674_(InteractionHand.MAIN_HAND);
}
}
@@ -1560,14 +_,20 @@
@@ -1581,6 +_,8 @@
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) {
switch (this.f_91077_.m_6662_()) {
case ENTITY:
this.f_91072_.m_105223_(this.f_91074_, ((EntityHitResult)this.f_91077_).m_82443_());
break;
@@ -1588,7 +_,7 @@
case BLOCK:
BlockHitResult blockhitresult = (BlockHitResult)this.f_91077_;
BlockPos blockpos = blockhitresult.m_82425_();
@@ -308,7 +291,7 @@
this.f_91072_.m_105269_(blockpos, blockhitresult.m_82434_());
if (this.f_91073_.m_8055_(blockpos).m_60795_()) {
flag = true;
@@ -1580,8 +_,10 @@
@@ -1601,8 +_,10 @@
}
this.f_91074_.m_36334_();
@@ -319,7 +302,7 @@
this.f_91074_.m_6674_(InteractionHand.MAIN_HAND);
return flag;
}
@@ -1597,6 +_,11 @@
@@ -1618,6 +_,11 @@
}
for(InteractionHand interactionhand : InteractionHand.values()) {
@@ -331,14 +314,7 @@
ItemStack itemstack = this.f_91074_.m_21120_(interactionhand);
if (!itemstack.m_246617_(this.f_91073_.m_246046_())) {
return;
@@ -1611,13 +_,14 @@
return;
}
+ 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);
@@ -1638,7 +_,7 @@
}
if (interactionresult.m_19077_()) {
@@ -347,7 +323,7 @@
this.f_91074_.m_6674_(interactionhand);
}
@@ -1629,7 +_,7 @@
@@ -1650,7 +_,7 @@
int i = itemstack.m_41613_();
InteractionResult interactionresult1 = this.f_91072_.m_233732_(this.f_91074_, interactionhand, blockhitresult);
if (interactionresult1.m_19077_()) {
@@ -356,7 +332,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);
@@ -1645,6 +_,9 @@
@@ -1666,6 +_,9 @@
}
}
@@ -366,7 +342,7 @@
if (!itemstack.m_41619_()) {
InteractionResult interactionresult2 = this.f_91072_.m_233721_(this.f_91074_, interactionhand);
if (interactionresult2.m_19077_()) {
@@ -1671,6 +_,8 @@
@@ -1692,6 +_,8 @@
--this.f_91011_;
}
@@ -375,7 +351,23 @@
this.f_91026_.m_6180_("gui");
this.f_240378_.m_240688_();
this.f_91065_.m_193832_(this.f_91012_);
@@ -1800,6 +_,8 @@
@@ -1787,6 +_,7 @@
this.f_91005_.m_120596_();
+ net.minecraftforge.event.ForgeEventFactory.onPreLevelTick(this.f_91073_, () -> true);
try {
this.f_91073_.m_104726_(() -> {
return true;
@@ -1802,6 +_,7 @@
throw new ReportedException(crashreport);
}
+ net.minecraftforge.event.ForgeEventFactory.onPostLevelTick(this.f_91073_, () -> true);
}
this.f_91026_.m_6182_("animateTick");
@@ -1821,6 +_,8 @@
this.f_91026_.m_6182_("keyboard");
this.f_91068_.m_90931_();
this.f_91026_.m_7238_();
@@ -384,7 +376,7 @@
}
private boolean m_91278_() {
@@ -1996,6 +_,7 @@
@@ -2017,6 +_,7 @@
}
public void m_91156_(ClientLevel p_91157_) {
@@ -392,7 +384,7 @@
ProgressScreen progressscreen = new ProgressScreen(true);
progressscreen.m_6309_(Component.m_237115_("connect.joining"));
this.m_91362_(progressscreen);
@@ -2029,10 +_,12 @@
@@ -2050,10 +_,12 @@
IntegratedServer integratedserver = this.f_91007_;
this.f_91007_ = null;
this.f_91063_.m_109150_();
@@ -405,15 +397,15 @@
if (integratedserver != null) {
this.f_91026_.m_6180_("waitForServer");
@@ -2046,6 +_,7 @@
@@ -2067,6 +_,7 @@
this.f_243981_.m_246151_();
this.f_91065_.m_93089_();
this.f_91010_ = false;
+ net.minecraftforge.client.ForgeHooksClient.handleClientLevelClosing(f_91073_);
this.f_91004_.m_90740_();
}
@@ -2153,6 +_,7 @@
this.f_91073_ = null;
@@ -2173,6 +_,7 @@
private void m_91280_() {
if (this.f_91077_ != null && this.f_91077_.m_6662_() != HitResult.Type.MISS) {
@@ -421,7 +413,7 @@
boolean flag = this.f_91074_.m_150110_().f_35937_;
BlockEntity blockentity = null;
HitResult.Type hitresult$type = this.f_91077_.m_6662_();
@@ -2165,10 +_,7 @@
@@ -2185,10 +_,7 @@
}
Block block = blockstate.m_60734_();
@@ -433,7 +425,7 @@
if (flag && Screen.m_96637_() && blockstate.m_155947_()) {
blockentity = this.f_91073_.m_7702_(blockpos);
@@ -2179,7 +_,7 @@
@@ -2199,7 +_,7 @@
}
Entity entity = ((EntityHitResult)this.f_91077_).m_82443_();
@@ -442,7 +434,7 @@
if (itemstack == null) {
return;
}
@@ -2721,6 +_,19 @@
@@ -2737,6 +_,19 @@
public void m_91312_(int p_91313_) {
this.f_91051_.m_119410_(p_91313_);
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/MouseHandler.java
+++ b/net/minecraft/client/MouseHandler.java
@@ -69,6 +_,7 @@
@@ -73,6 +_,7 @@
this.f_91510_ = -1;
}
@@ -8,7 +8,7 @@
boolean[] aboolean = new boolean[]{false};
if (this.f_91503_.m_91265_() == null) {
if (this.f_91503_.f_91080_ == null) {
@@ -82,11 +_,19 @@
@@ -86,11 +_,19 @@
if (flag) {
screen.m_169415_();
Screen.m_96579_(() -> {
@@ -30,7 +30,7 @@
}, "mouseReleased event handler", screen.getClass().getCanonicalName());
}
}
@@ -110,19 +_,26 @@
@@ -114,19 +_,26 @@
}
}
}
@@ -60,7 +60,7 @@
} else if (this.f_91503_.f_91074_ != null) {
if (this.f_91518_ != 0.0D && Math.signum(d0) != Math.signum(this.f_91518_)) {
this.f_91518_ = 0.0D;
@@ -135,6 +_,7 @@
@@ -139,6 +_,7 @@
}
this.f_91518_ -= (double)i;
@@ -68,7 +68,7 @@
if (this.f_91503_.f_91074_.m_5833_()) {
if (this.f_91503_.f_91065_.m_93085_().m_94768_()) {
this.f_91503_.f_91065_.m_93085_().m_205380_(-i);
@@ -203,7 +_,9 @@
@@ -207,7 +_,9 @@
double d2 = (p_91563_ - this.f_91507_) * (double)this.f_91503_.m_91268_().m_85445_() / (double)this.f_91503_.m_91268_().m_85443_();
double d3 = (p_91564_ - this.f_91508_) * (double)this.f_91503_.m_91268_().m_85446_() / (double)this.f_91503_.m_91268_().m_85444_();
Screen.m_96579_(() -> {
@@ -79,7 +79,7 @@
}, "mouseDragged event handler", screen.getClass().getCanonicalName());
}
@@ -286,6 +_,14 @@
@@ -290,6 +_,14 @@
public double m_91594_() {
return this.f_91508_;
@@ -1,16 +1,16 @@
--- a/net/minecraft/client/Options.java
+++ b/net/minecraft/client/Options.java
@@ -507,7 +_,8 @@
@@ -544,7 +_,8 @@
}, new OptionInstance.LazyEnum<>(() -> {
return Stream.concat(Stream.of(""), Minecraft.m_91087_().m_91106_().m_194525_().stream()).toList();
}, (p_232011_) -> {
- return Minecraft.m_91087_().m_91396_() && p_232011_ != "" && !Minecraft.m_91087_().m_91106_().m_194525_().contains(p_232011_) ? Optional.empty() : Optional.of(p_232011_);
+ // FORGE: fix incorrect string comparison - PR #8767
+ return Minecraft.m_91087_().m_91396_() && (p_232011_ == null || !p_232011_.isEmpty()) && !Minecraft.m_91087_().m_91106_().m_194525_().contains(p_232011_) ? Optional.empty() : Optional.of(p_232011_);
}, Codec.STRING), "", (p_231994_) -> {
}, Codec.STRING), "", (p_275584_) -> {
SoundManager soundmanager = Minecraft.m_91087_().m_91106_();
soundmanager.m_194526_();
@@ -788,6 +_,7 @@
@@ -868,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_();
@@ -904,11 +_,20 @@
p_168428_.m_213982_("panoramaScrollSpeed", this.f_244402_);
@@ -989,11 +_,20 @@
p_168428_.m_213982_("telemetryOptInExtra", this.f_260461_);
this.f_263744_ = p_168428_.m_142682_("onboardAccessibility", this.f_263744_);
+ processOptionsForge(p_168428_);
+ }
@@ -41,7 +41,7 @@
}
}
@@ -927,6 +_,9 @@
@@ -1012,6 +_,9 @@
}
public void m_92140_() {
@@ -51,7 +51,7 @@
try {
if (!this.f_92110_.exists()) {
return;
@@ -955,7 +_,8 @@
@@ -1040,7 +_,8 @@
}
}
@@ -61,7 +61,7 @@
@Nullable
private String m_168458_(String p_168459_) {
return compoundtag1.m_128441_(p_168459_) ? compoundtag1.m_128461_(p_168459_) : null;
@@ -1118,6 +_,7 @@
@@ -1203,6 +_,7 @@
}
public void m_92172_() {
@@ -69,7 +69,7 @@
if (this.f_92060_.f_91074_ != null) {
int i = 0;
@@ -1182,6 +_,23 @@
@@ -1267,6 +_,23 @@
}
p_92146_.m_10509_(set);
@@ -10,7 +10,7 @@
private final Map<Block, Set<Property<?>>> f_92572_ = Maps.newHashMap();
public static BlockColors m_92574_() {
@@ -73,11 +_,12 @@
@@ -80,11 +_,12 @@
blockcolors.m_92589_((p_92596_, p_92597_, p_92598_, p_92599_) -> {
return p_92597_ != null && p_92598_ != null ? 2129968 : 7455580;
}, Blocks.f_50196_);
@@ -24,7 +24,7 @@
if (blockcolor != null) {
return blockcolor.m_92566_(p_92583_, (BlockAndTintGetter)null, (BlockPos)null, 0);
} else {
@@ -87,13 +_,15 @@
@@ -94,13 +_,15 @@
}
public int m_92577_(BlockState p_92578_, @Nullable BlockAndTintGetter p_92579_, @Nullable BlockPos p_92580_, int p_92581_) {
@@ -0,0 +1,20 @@
--- a/net/minecraft/client/gui/Font.java
+++ b/net/minecraft/client/gui/Font.java
@@ -33,7 +_,7 @@
import org.joml.Vector3f;
@OnlyIn(Dist.CLIENT)
-public class Font {
+public class Font implements net.minecraftforge.client.extensions.IForgeFont {
private static final float f_168643_ = 0.01F;
private static final Vector3f f_92712_ = new Vector3f(0.0F, 0.0F, 0.03F);
public static final int f_193827_ = 8;
@@ -260,6 +_,8 @@
public StringSplitter m_92865_() {
return this.f_92714_;
}
+
+ @Override public Font self() { return this; }
@OnlyIn(Dist.CLIENT)
public static enum DisplayMode {
@@ -1,14 +1,6 @@
--- a/net/minecraft/client/gui/Gui.java
+++ b/net/minecraft/client/gui/Gui.java
@@ -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_();
+ flag &= this.f_92986_.f_91074_.canHit(this.f_92986_.f_91076_, 0);
}
int j = this.f_92978_ / 2 - 7 + 16;
@@ -444,6 +_,10 @@
@@ -428,6 +_,10 @@
for(MobEffectInstance mobeffectinstance : Ordering.natural().reverse().sortedCopy(collection)) {
MobEffect mobeffect = mobeffectinstance.m_19544_();
@@ -19,15 +11,15 @@
if (mobeffectinstance.m_19575_()) {
int i = this.f_92977_;
int j = 1;
@@ -472,6 +_,7 @@
@@ -456,6 +_,7 @@
}
}
+ if (renderer.renderGuiIcon(mobeffectinstance, this, p_93029_, i, j, this.m_93252_(), f)) continue;
+ if (renderer.renderGuiIcon(mobeffectinstance, this, p_93029_, i, j, 0, f)) continue;
TextureAtlasSprite textureatlassprite = mobeffecttexturemanager.m_118732_(mobeffect);
int l = i;
int i1 = j;
@@ -603,12 +_,13 @@
float f1 = f;
@@ -583,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,9 +35,9 @@
int j = (this.f_92977_ - i) / 2;
int k = this.f_92978_ - 59;
if (!this.f_92986_.f_91072_.m_105205_()) {
@@ -624,7 +_,13 @@
RenderSystem.m_69478_();
RenderSystem.m_69453_();
@@ -602,7 +_,13 @@
if (l > 0) {
m_93172_(p_93070_, j - 2, k - 2, j + i + 2, k + 9 + 2, this.f_92986_.f_91066_.m_92143_(0));
- this.m_93082_().m_92763_(p_93070_, mutablecomponent, (float)j, (float)k, 16777215 + (l << 24));
+ Font font = net.minecraftforge.client.extensions.common.IClientItemExtensions.of(f_92994_).getFont(f_92994_, net.minecraftforge.client.extensions.common.IClientItemExtensions.FontContext.SELECTED_ITEM_NAME);
@@ -55,10 +47,10 @@
+ j = (this.f_92977_ - font.m_92852_(highlightTip)) / 2;
+ font.m_92763_(p_93070_, highlightTip, (float)j, (float)k, 16777215 + (l << 24));
+ }
RenderSystem.m_69461_();
}
}
@@ -1138,7 +_,7 @@
@@ -1054,7 +_,7 @@
ItemStack itemstack = this.f_92986_.f_91074_.m_150109_().m_36056_();
if (itemstack.m_41619_()) {
this.f_92993_ = 0;
@@ -0,0 +1,11 @@
--- a/net/minecraft/client/gui/components/AbstractButton.java
+++ b/net/minecraft/client/gui/components/AbstractButton.java
@@ -32,7 +_,7 @@
RenderSystem.m_69482_();
m_275833_(p_275468_, this.m_252754_(), this.m_252907_(), this.m_5711_(), this.m_93694_(), 20, 4, 200, 20, 0, this.m_274533_());
RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, 1.0F);
- int i = this.f_93623_ ? 16777215 : 10526880;
+ int i = getFGColor();
this.m_274375_(p_275468_, minecraft.f_91062_, i | Mth.m_14167_(this.f_93625_ * 255.0F) << 24);
}
@@ -1,7 +1,7 @@
--- a/net/minecraft/client/gui/components/AbstractSelectionList.java
+++ b/net/minecraft/client/gui/components/AbstractSelectionList.java
@@ -536,6 +_,13 @@
@@ -515,6 +_,13 @@
return new ScreenRectangle(this.f_93393_, this.f_93390_, this.f_93392_ - this.f_93393_, this.f_93391_ - this.f_93390_);
}
+ public int getWidth() { return this.f_93388_; }
@@ -12,5 +12,5 @@
+ public int getRight() { return this.f_93392_; }
+
@OnlyIn(Dist.CLIENT)
public abstract static class Entry<E extends AbstractSelectionList.Entry<E>> implements GuiEventListener {
protected abstract static class Entry<E extends AbstractSelectionList.Entry<E>> implements GuiEventListener {
/** @deprecated */
@@ -1,15 +1,6 @@
--- a/net/minecraft/client/gui/components/AbstractWidget.java
+++ b/net/minecraft/client/gui/components/AbstractWidget.java
@@ -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.m_252754_() + this.f_93618_ / 2, this.m_252907_() + (this.f_93619_ - 8) / 2, j | Mth.m_14167_(this.f_93625_ * 255.0F) << 24);
}
@@ -222,6 +_,10 @@
@@ -231,6 +_,10 @@
this.f_93618_ = p_93675_;
}
@@ -20,9 +11,9 @@
public void m_93650_(float p_93651_) {
this.f_93625_ = p_93651_;
}
@@ -244,6 +_,19 @@
@@ -261,6 +_,19 @@
protected void m_93692_(boolean p_93693_) {
public void m_93692_(boolean p_93693_) {
this.f_93616_ = p_93693_;
+ }
+
@@ -6,10 +6,10 @@
int k = i / 2 - 91;
+ var event = net.minecraftforge.client.ForgeHooksClient.onCustomizeBossEventProgress(p_93705_, this.f_93698_.m_91268_(), lerpingbossevent, k, j, 10 + this.f_93698_.f_91062_.f_92710_);
+ if (!event.isCanceled()) {
RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.m_157456_(0, f_93697_);
this.m_93706_(p_93705_, k, j, lerpingbossevent);
@@ -42,7 +_,8 @@
Component component = lerpingbossevent.m_18861_();
@@ -41,7 +_,8 @@
int i1 = i / 2 - l / 2;
int j1 = j - 9;
this.f_93698_.f_91062_.m_92763_(p_93705_, component, (float)i1, (float)j1, 16777215);
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/components/toasts/ToastComponent.java
+++ b/net/minecraft/client/gui/components/toasts/ToastComponent.java
@@ -103,6 +_,7 @@
@@ -102,6 +_,7 @@
}
public void m_94922_(Toast p_94923_) {
@@ -0,0 +1,11 @@
--- a/net/minecraft/client/gui/screens/ChatScreen.java
+++ b/net/minecraft/client/gui/screens/ChatScreen.java
@@ -225,7 +_,7 @@
this.f_96541_.f_91074_.f_108617_.m_246175_(p_242400_);
}
- return true;
+ return f_96541_.f_91080_ == this; // FORGE: Prevent closing the screen if another screen has been opened.
}
}
@@ -0,0 +1,11 @@
--- a/net/minecraft/client/gui/screens/ConnectScreen.java
+++ b/net/minecraft/client/gui/screens/ConnectScreen.java
@@ -72,6 +_,8 @@
}
if (!optional.isPresent()) {
+ ConnectScreen.f_95683_.error("Couldn't connect to server: Unknown host \"{}\"", p_249536_.m_171863_());
+ net.minecraftforge.network.DualStackUtils.logInitialPreferences();
p_251955_.execute(() -> {
p_251955_.m_91152_(new DisconnectedScreen(ConnectScreen.this.f_95686_, CommonComponents.f_130661_, ConnectScreen.f_169260_));
});
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/LoadingOverlay.java
+++ b/net/minecraft/client/gui/screens/LoadingOverlay.java
@@ -121,6 +_,7 @@
@@ -119,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));
}
@@ -130,6 +_,7 @@
@@ -128,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());
@@ -137,7 +_,6 @@
@@ -135,7 +_,6 @@
this.f_96165_.accept(Optional.of(throwable));
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/MenuScreens.java
+++ b/net/minecraft/client/gui/screens/MenuScreens.java
@@ -40,6 +_,10 @@
@@ -41,6 +_,10 @@
private static final Map<MenuType<?>, MenuScreens.ScreenConstructor<?, ?>> f_96196_ = Maps.newHashMap();
public static <T extends AbstractContainerMenu> void m_96201_(@Nullable MenuType<T> p_96202_, Minecraft p_96203_, int p_96204_, Component p_96205_) {
@@ -11,7 +11,7 @@
if (p_96202_ == null) {
f_96195_.warn("Trying to open invalid screen with name: {}", (Object)p_96205_.getString());
} else {
@@ -47,9 +_,10 @@
@@ -48,9 +_,10 @@
if (screenconstructor == null) {
f_96195_.warn("Failed to create screen for menu type: {}", (Object)BuiltInRegistries.f_256818_.m_7981_(p_96202_));
} else {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/OptionsScreen.java
+++ b/net/minecraft/client/gui/screens/OptionsScreen.java
@@ -168,6 +_,14 @@
@@ -151,6 +_,14 @@
super.m_86412_(p_96249_, p_96250_, p_96251_, p_96252_);
}
@@ -0,0 +1,10 @@
--- a/net/minecraft/client/gui/screens/PauseScreen.java
+++ b/net/minecraft/client/gui/screens/PauseScreen.java
@@ -83,6 +_,7 @@
} else {
gridlayout$rowhelper.m_264139_(this.m_262456_(f_262254_, SocialInteractionsScreen::new));
}
+ gridlayout$rowhelper.m_264108_(Button.m_253074_(Component.m_237115_("fml.menu.mods"), button -> this.f_96541_.m_91152_(new net.minecraftforge.client.gui.ModListScreen(this))).m_252780_(f_262268_).m_253136_(), 2);
Component component = this.f_96541_.m_91090_() ? f_262217_ : f_262246_;
this.f_252482_ = gridlayout$rowhelper.m_264108_(Button.m_253074_(component, (p_275864_) -> {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/Screen.java
+++ b/net/minecraft/client/gui/screens/Screen.java
@@ -143,7 +_,7 @@
@@ -214,7 +_,7 @@
}
public void m_7379_() {
@@ -9,7 +9,7 @@
}
protected <T extends GuiEventListener & Renderable & NarratableEntry> T m_142416_(T p_169406_) {
@@ -180,15 +_,29 @@
@@ -251,15 +_,29 @@
this.f_169368_.clear();
}
@@ -43,7 +43,7 @@
this.m_262809_(p_169389_, list, p_169392_, p_169393_, DefaultTooltipPositioner.f_262752_);
}
@@ -201,24 +_,48 @@
@@ -272,24 +_,48 @@
}
public void m_96597_(PoseStack p_96598_, List<Component> p_96599_, int p_96600_, int p_96601_) {
@@ -94,88 +94,106 @@
if (k > i) {
i = k;
}
@@ -226,8 +_,8 @@
@@ -297,7 +_,7 @@
j += clienttooltipcomponent.m_142103_();
}
- 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 @@
- Vector2ic vector2ic = p_262920_.m_262814_(this, p_263065_, p_262996_, i, j);
+ Vector2ic vector2ic = p_262920_.m_262814_(this, preEvent.getX(), preEvent.getY(), i, j);
int l = vector2ic.x();
int i1 = vector2ic.y();
p_263064_.m_85836_();
@@ -307,9 +_,10 @@
RenderSystem.m_157427_(GameRenderer::m_172811_);
bufferbuilder.m_166779_(VertexFormat.Mode.QUADS, DefaultVertexFormat.f_85815_);
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_) -> {
- TooltipRenderUtil.m_262796_((p_262872_, p_262873_, p_262874_, p_262875_, p_262876_, p_262877_, p_262878_, p_262879_, p_262880_) -> {
+ net.minecraftforge.client.event.RenderTooltipEvent.Color colorEvent = net.minecraftforge.client.ForgeHooksClient.onRenderTooltipColor(this.tooltipStack, p_263064_, l, i1, preEvent.getFont(), p_262990_);
+ TooltipRenderUtil.renderTooltipBackground((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 @@
- }, matrix4f, bufferbuilder, l, i1, i, j, 400);
+ }, matrix4f, bufferbuilder, l, i1, i, j, 400, colorEvent.getBackgroundStart(), colorEvent.getBackgroundEnd(), colorEvent.getBorderStart(), colorEvent.getBorderEnd());
RenderSystem.m_69482_();
RenderSystem.m_69478_();
RenderSystem.m_69453_();
@@ -320,7 +_,7 @@
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);
for(int l1 = 0; l1 < p_262990_.size(); ++l1) {
ClientTooltipComponent clienttooltipcomponent1 = p_262990_.get(l1);
- clienttooltipcomponent1.m_142440_(this.f_96547_, l, k1, matrix4f, multibuffersource$buffersource);
+ clienttooltipcomponent1.m_142440_(preEvent.getFont(), l, k1, matrix4f, multibuffersource$buffersource);
k1 += clienttooltipcomponent1.m_142103_() + (l1 == 0 ? 2 : 0);
}
@@ -266,7 +_,7 @@
@@ -329,7 +_,7 @@
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);
- clienttooltipcomponent2.m_183452_(this.f_96547_, l, k1, p_263064_, this.f_96542_);
+ clienttooltipcomponent2.m_183452_(preEvent.getFont(), l, k1, p_263064_, this.f_96542_);
k1 += clienttooltipcomponent2.m_142103_() + (i2 == 0 ? 2 : 0);
}
@@ -368,9 +_,19 @@
this.f_96547_ = p_96607_.f_91062_;
@@ -432,7 +_,10 @@
this.f_96543_ = p_96608_;
this.f_96544_ = p_96609_;
+ java.util.function.Consumer<GuiEventListener> add = (b) -> {
+ if (b instanceof Renderable r)
+ this.f_169369_.add(r);
+ if (b instanceof NarratableEntry ne)
+ this.f_169368_.add(ne);
+ f_96540_.add(b);
+ };
+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.Init.Pre(this, this.f_96540_, add, this::m_169411_))) {
this.m_232761_();
this.m_169407_(false);
this.m_169378_(f_169370_);
if (!this.f_267454_) {
+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.Init.Pre(this, this.f_96540_, this::addEventWidget, this::m_169411_))) {
this.m_7856_();
+ }
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.Init.Post(this, this.f_96540_, this::addEventWidget, this::m_169411_));
} else {
this.m_267719_();
}
@@ -445,7 +_,10 @@
protected void m_232761_() {
this.m_169413_();
this.m_264131_();
+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.Init.Pre(this, this.f_96540_, this::addEventWidget, this::m_169411_))) {
this.m_7856_();
+ }
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.Init.Post(this, this.f_96540_, add, this::m_169411_));
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.Init.Post(this, this.f_96540_, this::addEventWidget, this::m_169411_));
}
protected void m_232761_() {
@@ -399,6 +_,7 @@
public void m_96558_(PoseStack p_96559_, int p_96560_) {
public List<? extends GuiEventListener> m_6702_() {
@@ -467,6 +_,7 @@
public void m_7333_(PoseStack p_96557_) {
if (this.f_96541_.f_91073_ != null) {
this.m_93179_(p_96559_, 0, 0, this.f_96543_, this.f_96544_, -1072689136, -804253680);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.BackgroundRendered(this, p_96559_));
m_93179_(p_96557_, 0, 0, this.f_96543_, this.f_96544_, -1072689136, -804253680);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.BackgroundRendered(this, p_96557_));
} else {
this.m_96626_(p_96560_);
this.m_264065_(p_96557_);
}
@@ -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_();
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.BackgroundRendered(this, new PoseStack()));
@@ -479,6 +_,7 @@
int i = 32;
m_93143_(p_265092_, 0, 0, 0, 0.0F, 0.0F, this.f_96543_, this.f_96544_, 32, 32);
RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, 1.0F);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.BackgroundRendered(this, p_265092_));
}
public boolean m_7043_() {
@@ -503,6 +_,10 @@
@@ -572,6 +_,10 @@
public void m_7400_(List<Path> p_96591_) {
}
public void m_7400_(List<Path> p_96591_) {
+ }
+
+ public Minecraft getMinecraft() {
+ return this.f_96541_;
}
+ }
+
private void m_169380_(long p_169381_, boolean p_169382_) {
this.f_169377_ = Util.m_137550_() + p_169381_;
if (p_169382_) {
@@ -733,5 +_,13 @@
this.f_169421_ = p_169425_;
this.f_169422_ = p_169426_;
}
+ }
+
+ private void addEventWidget(GuiEventListener b) {
+ if (b instanceof Renderable r)
+ this.f_169369_.add(r);
+ if (b instanceof NarratableEntry ne)
+ this.f_169368_.add(ne);
+ f_96540_.add(b);
}
}
@@ -1,14 +1,14 @@
--- a/net/minecraft/client/gui/screens/TitleScreen.java
+++ b/net/minecraft/client/gui/screens/TitleScreen.java
@@ -68,6 +_,7 @@
private long f_96715_;
@@ -63,6 +_,7 @@
@Nullable
private TitleScreen.WarningLabel f_232768_;
private final LogoRenderer f_263781_;
+ private net.minecraftforge.client.gui.TitleScreenModUpdateIndicator modUpdateNotification;
public TitleScreen() {
this(false);
@@ -112,11 +_,15 @@
@@ -113,11 +_,15 @@
int j = this.f_96543_ - i - 2;
int k = 24;
int l = this.f_96544_ / 4 + 48;
@@ -24,7 +24,7 @@
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_()));
@@ -161,7 +_,7 @@
@@ -162,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_();
@@ -33,31 +33,31 @@
}
@Nullable
@@ -267,6 +_,7 @@
this.f_232768_.m_232790_(p_96739_, l);
@@ -245,6 +_,7 @@
this.f_232768_.m_232790_(p_96739_, i);
}
+ net.minecraftforge.client.ForgeHooksClient.renderMainMenu(this, p_96739_, this.f_96547_, this.f_96543_, this.f_96544_, l);
+ net.minecraftforge.client.ForgeHooksClient.renderMainMenu(this, p_96739_, this.f_96547_, this.f_96543_, this.f_96544_, i);
if (this.f_96721_ != null) {
p_96739_.m_85836_();
p_96739_.m_252880_((float)(this.f_96543_ / 2 + 90), 70.0F, 0.0F);
@@ -289,7 +_,14 @@
@@ -267,7 +_,14 @@
s = s + I18n.m_118938_("menu.modded");
}
- m_93236_(p_96739_, this.f_96547_, s, 2, this.f_96544_ - 10, 16777215 | l);
- m_93236_(p_96739_, this.f_96547_, s, 2, this.f_96544_ - 10, 16777215 | i);
+ net.minecraftforge.internal.BrandingControl.forEachLine(true, true, (brdline, brd) ->
+ m_93236_(p_96739_, this.f_96547_, brd, 2, this.f_96544_ - ( 10 + brdline * (this.f_96547_.f_92710_ + 1)), 16777215 | l)
+ m_93236_(p_96739_, this.f_96547_, brd, 2, this.f_96544_ - ( 10 + brdline * (this.f_96547_.f_92710_ + 1)), 16777215 | i)
+ );
+
+ net.minecraftforge.internal.BrandingControl.forEachAboveCopyrightLine((brdline, brd) ->
+ m_93236_(p_96739_, this.f_96547_, brd, this.f_96543_ - f_96547_.m_92895_(brd), this.f_96544_ - (10 + (brdline + 1) * ( this.f_96547_.f_92710_ + 1)), 16777215 | l)
+ m_93236_(p_96739_, this.f_96547_, brd, this.f_96543_ - f_96547_.m_92895_(brd), this.f_96544_ - (10 + (brdline + 1) * ( this.f_96547_.f_92710_ + 1)), 16777215 | i)
+ );
+
for(GuiEventListener guieventlistener : this.m_6702_()) {
if (guieventlistener instanceof AbstractWidget) {
@@ -302,6 +_,7 @@
@@ -280,6 +_,7 @@
RenderSystem.m_69482_();
this.f_96726_.m_86412_(p_96739_, p_96740_, p_96741_, p_96742_);
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/advancements/AdvancementTab.java
+++ b/net/minecraft/client/gui/screens/advancements/AdvancementTab.java
@@ -39,6 +_,7 @@
@@ -38,6 +_,7 @@
private int f_97141_ = Integer.MIN_VALUE;
private float f_97142_;
private boolean f_97143_;
@@ -8,7 +8,7 @@
public AdvancementTab(Minecraft p_97145_, AdvancementsScreen p_97146_, AdvancementTabType p_97147_, int p_97148_, Advancement p_97149_, DisplayInfo p_97150_) {
this.f_97126_ = p_97145_;
@@ -53,6 +_,15 @@
@@ -52,6 +_,15 @@
this.m_97175_(this.f_97134_, p_97149_);
}
@@ -24,7 +24,7 @@
public AdvancementTabType m_169538_() {
return this.f_97128_;
}
@@ -165,8 +_,8 @@
@@ -151,8 +_,8 @@
return null;
} else {
for(AdvancementTabType advancementtabtype : AdvancementTabType.values()) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java
+++ b/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java
@@ -42,6 +_,7 @@
@@ -41,6 +_,7 @@
@Nullable
private AdvancementTab f_97336_;
private boolean f_97337_;
@@ -8,7 +8,7 @@
public AdvancementsScreen(ClientAdvancements p_97340_) {
super(GameNarrator.f_93310_);
@@ -57,7 +_,15 @@
@@ -56,7 +_,15 @@
} else {
this.f_97334_.m_104401_(this.f_97336_ == null ? null : this.f_97336_.m_97182_(), true);
}
@@ -25,7 +25,7 @@
}
public void m_7861_() {
@@ -75,7 +_,7 @@
@@ -74,7 +_,7 @@
int j = (this.f_96544_ - 140) / 2;
for(AdvancementTab advancementtab : this.f_97335_.values()) {
@@ -34,7 +34,7 @@
this.f_97334_.m_104401_(advancementtab.m_97182_(), true);
break;
}
@@ -99,6 +_,11 @@
@@ -98,9 +_,15 @@
int i = (this.f_96543_ - 252) / 2;
int j = (this.f_96544_ - 140) / 2;
this.m_7333_(p_97361_);
@@ -46,7 +46,11 @@
this.m_97373_(p_97361_, p_97362_, p_97363_, i, j);
this.m_97356_(p_97361_, i, j);
this.m_97381_(p_97361_, p_97362_, p_97363_, i, j);
@@ -149,12 +_,14 @@
+ super.m_86412_(p_97361_, p_97362_, p_97363_, p_97364_);
}
public boolean m_7979_(double p_97347_, double p_97348_, int p_97349_, double p_97350_, double p_97351_) {
@@ -138,10 +_,12 @@
RenderSystem.m_157456_(0, f_97330_);
for(AdvancementTab advancementtab : this.f_97335_.values()) {
@@ -54,14 +58,12 @@
advancementtab.m_97165_(p_97357_, p_97358_, p_97359_, advancementtab == this.f_97336_);
}
RenderSystem.m_69453_();
for(AdvancementTab advancementtab1 : this.f_97335_.values()) {
+ if (advancementtab1.getPage() == tabPage)
advancementtab1.m_97159_(p_97358_, p_97359_, this.f_96542_);
advancementtab1.m_274613_(p_97357_, p_97358_, p_97359_, this.f_96542_);
}
@@ -180,7 +_,7 @@
}
@@ -161,7 +_,7 @@
if (this.f_97335_.size() > 1) {
for(AdvancementTab advancementtab : this.f_97335_.values()) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/controls/KeyBindsList.java
+++ b/net/minecraft/client/gui/screens/controls/KeyBindsList.java
@@ -50,7 +_,7 @@
@@ -65,7 +_,7 @@
}
protected int m_5756_() {
@@ -9,48 +9,34 @@
}
public int m_5759_() {
@@ -108,10 +_,11 @@
this.f_193911_ = p_193917_;
this.f_193912_ = Button.m_253074_(p_193917_, (p_193939_) -> {
@@ -130,10 +_,11 @@
this.f_193912_ = Button.m_253074_(p_193917_, (p_269618_) -> {
KeyBindsList.this.f_193858_.f_193975_ = p_193916_;
KeyBindsList.this.m_269130_();
- }).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_193913_ = Button.m_253074_(Component.m_237115_("controls.reset"), (p_269616_) -> {
+ this.f_193910_.setToDefault();
KeyBindsList.this.f_93386_.f_91066_.m_92159_(p_193916_, p_193916_.m_90861_());
KeyMapping.m_90854_();
KeyBindsList.this.m_269130_();
}).m_252987_(0, 0, 50, 20).m_252778_((p_253313_) -> {
@@ -123,7 +_,7 @@
boolean flag = KeyBindsList.this.f_193858_.f_193975_ == this.f_193910_;
@@ -145,7 +_,7 @@
public void m_6311_(PoseStack p_193923_, int p_193924_, int p_193925_, int p_193926_, int p_193927_, int p_193928_, int p_193929_, int p_193930_, boolean p_193931_, float p_193932_) {
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_.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_253211_(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
this.f_193912_.m_252865_(p_193926_ + 105);
@@ -174,7 +_,7 @@
MutableComponent mutablecomponent = Component.m_237119_();
if (!this.f_193910_.m_90862_()) {
for(KeyMapping keymapping : KeyBindsList.this.f_93386_.f_91066_.f_92059_) {
if (keymapping != this.f_193910_ && this.f_193910_.m_90850_(keymapping)) {
flag1 = true;
- break;
+ keyCodeModifierConflict &= keymapping.hasKeyModifierConflict(this.f_193910_);
}
}
}
@@ -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) {
- this.f_193912_.m_93666_(this.f_193912_.m_6035_().m_6881_().m_130940_(ChatFormatting.RED));
+ this.f_193912_.m_93666_(this.f_193912_.m_6035_().m_6881_().m_130940_(keyCodeModifierConflict ? ChatFormatting.GOLD : ChatFormatting.RED));
}
this.f_193912_.m_86412_(p_193923_, p_193929_, p_193930_, p_193932_);
- if (keymapping != this.f_193910_ && this.f_193910_.m_90850_(keymapping)) {
+ if ((keymapping != this.f_193910_ && this.f_193910_.m_90850_(keymapping)) || keymapping.hasKeyModifierConflict(this.f_193910_)) { // FORGE: gracefully handle conflicts like SHIFT vs SHIFT+G
if (this.f_268447_) {
mutablecomponent.m_130946_(", ");
}
@@ -2,13 +2,13 @@
+++ b/net/minecraft/client/gui/screens/controls/KeyBindsScreen.java
@@ -31,7 +_,7 @@
this.m_7787_(this.f_193977_);
this.f_193978_ = this.m_142416_(Button.m_253074_(Component.m_237115_("controls.resetAll"), (p_193999_) -> {
this.f_193978_ = this.m_142416_(Button.m_253074_(Component.m_237115_("controls.resetAll"), (p_269619_) -> {
for(KeyMapping keymapping : this.f_96282_.f_92059_) {
- keymapping.m_90848_(keymapping.m_90861_());
+ keymapping.setToDefault();
}
KeyMapping.m_90854_();
this.f_193977_.m_269130_();
@@ -55,11 +_,14 @@
public boolean m_7933_(int p_193987_, int p_193988_, int p_193989_) {
if (this.f_193975_ != null) {
@@ -23,4 +23,4 @@
+ if(!net.minecraftforge.client.settings.KeyModifier.isKeyCodeModifier(this.f_193975_.getKey()))
this.f_193975_ = null;
this.f_193976_ = Util.m_137550_();
KeyMapping.m_90854_();
this.f_193977_.m_269130_();
@@ -1,19 +1,19 @@
--- a/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java
@@ -89,6 +_,7 @@
@@ -88,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_86412_(p_97795_, p_97796_, p_97797_, p_97798_);
PoseStack posestack = RenderSystem.m_157191_();
@@ -110,11 +_,12 @@
p_97795_.m_85836_();
@@ -104,11 +_,12 @@
this.f_97734_ = slot;
int l = slot.f_40220_;
int i1 = slot.f_40221_;
- m_169606_(p_97795_, l, i1, this.m_93252_());
+ renderSlotHighlight(p_97795_, l, i1, this.m_93252_(), this.getSlotColor(k));
- m_169606_(p_97795_, l, i1, 0);
+ renderSlotHighlight(p_97795_, l, i1, 0, this.getSlotColor(k));
}
}
@@ -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;
@@ -154,9 +_,13 @@
@@ -147,9 +_,13 @@
}
public static void m_169606_(PoseStack p_169607_, int p_169608_, int p_169609_, int p_169610_) {
@@ -37,19 +37,17 @@
RenderSystem.m_69444_(true, true, true, true);
RenderSystem.m_69482_();
}
@@ -174,8 +_,10 @@
RenderSystem.m_157182_();
this.m_93250_(200);
this.f_96542_.f_115093_ = 200.0F;
+ var font = net.minecraftforge.client.extensions.common.IClientItemExtensions.of(p_97783_).getFont(p_97783_, net.minecraftforge.client.extensions.common.IClientItemExtensions.FontContext.ITEM_COUNT);
+ if (font == null) font = this.f_96547_;
this.f_96542_.m_115203_(p_97783_, p_97784_, p_97785_);
- this.f_96542_.m_115174_(this.f_96547_, p_97783_, p_97784_, p_97785_ - (this.f_97711_.m_41619_() ? 0 : 8), p_97786_);
+ this.f_96542_.m_115174_(font, p_97783_, p_97784_, p_97785_ - (this.f_97711_.m_41619_() ? 0 : 8), p_97786_);
this.m_93250_(0);
this.f_96542_.f_115093_ = 0.0F;
@@ -165,7 +_,8 @@
p_275498_.m_85836_();
p_275498_.m_252880_(0.0F, 0.0F, 232.0F);
this.f_96542_.m_274369_(p_275498_, p_275341_, p_275289_, p_275690_);
- this.f_96542_.m_274364_(p_275498_, this.f_96547_, p_275341_, p_275289_, p_275690_ - (this.f_97711_.m_41619_() ? 0 : 8), p_275201_);
+ var font = net.minecraftforge.client.extensions.common.IClientItemExtensions.of(p_275341_).getFont(p_275341_, net.minecraftforge.client.extensions.common.IClientItemExtensions.FontContext.ITEM_COUNT);
+ this.f_96542_.m_274364_(p_275498_, font == null ? this.f_96547_ : font, p_275341_, p_275289_, p_275690_ - (this.f_97711_.m_41619_() ? 0 : 8), p_275201_);
p_275498_.m_85849_();
}
@@ -285,7 +_,8 @@
@@ -272,7 +_,8 @@
if (super.m_6375_(p_97748_, p_97749_, p_97750_)) {
return true;
} else {
@@ -59,7 +57,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_;
@@ -296,6 +_,7 @@
@@ -283,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 +65,7 @@
int l = -1;
if (slot != null) {
l = slot.f_40219_;
@@ -321,7 +_,7 @@
@@ -308,7 +_,7 @@
}
} else if (!this.f_97738_) {
if (this.f_97732_.m_142621_().m_41619_()) {
@@ -76,7 +74,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));
@@ -345,7 +_,7 @@
@@ -332,7 +_,7 @@
this.f_97717_ = 0;
} else if (p_97750_ == 1) {
this.f_97717_ = 1;
@@ -85,7 +83,7 @@
this.f_97717_ = 2;
}
}
@@ -414,10 +_,13 @@
@@ -401,10 +_,13 @@
}
public boolean m_6348_(double p_97812_, double p_97813_, int p_97814_) {
@@ -99,7 +97,7 @@
int k = -1;
if (slot != null) {
k = slot.f_40219_;
@@ -431,7 +_,7 @@
@@ -418,7 +_,7 @@
if (m_96638_()) {
if (!this.f_97724_.m_41619_()) {
for(Slot slot2 : this.f_97732_.f_38839_) {
@@ -108,7 +106,7 @@
this.m_6597_(slot2, slot2.f_40219_, p_97814_, ClickType.QUICK_MOVE);
}
}
@@ -494,7 +_,7 @@
@@ -481,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 +115,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));
@@ -541,34 +_,39 @@
@@ -528,34 +_,39 @@
}
public boolean m_7933_(int p_97765_, int p_97766_, int p_97767_) {
@@ -164,7 +162,7 @@
this.m_6597_(this.f_97734_, this.f_97734_.f_40219_, i, ClickType.SWAP);
return true;
}
@@ -603,6 +_,18 @@
@@ -590,6 +_,18 @@
public T m_6262_() {
return this.f_97732_;
@@ -92,16 +92,17 @@
}
(this.f_97732_).f_98639_.addAll(searchtree.m_6293_(s.toLowerCase(Locale.ROOT)));
@@ -416,7 +_,7 @@
@@ -415,7 +_,8 @@
protected void m_7027_(PoseStack p_98616_, int p_98617_, int p_98618_) {
if (f_98507_.m_40789_()) {
RenderSystem.m_69461_();
- this.f_96547_.m_92889_(p_98616_, f_98507_.m_40786_(), 8.0F, 6.0F, 4210752);
+ RenderSystem.m_69461_();
+ this.f_96547_.m_92889_(p_98616_, f_98507_.m_40786_(), 8.0F, 6.0F, f_98507_.getLabelColor());
}
}
@@ -426,7 +_,7 @@
@@ -425,7 +_,7 @@
double d0 = p_98531_ - (double)this.f_97735_;
double d1 = p_98532_ - (double)this.f_97736_;
@@ -110,7 +111,7 @@
if (this.m_98562_(creativemodetab, d0, d1)) {
return true;
}
@@ -447,7 +_,7 @@
@@ -446,7 +_,7 @@
double d1 = p_98623_ - (double)this.f_97736_;
this.f_98509_ = false;
@@ -119,7 +120,7 @@
if (this.m_98562_(creativemodetab, d0, d1)) {
this.m_98560_(creativemodetab);
return true;
@@ -465,6 +_,7 @@
@@ -464,6 +_,7 @@
private void m_98560_(CreativeModeTab p_98561_) {
CreativeModeTab creativemodetab = f_98507_;
f_98507_ = p_98561_;
@@ -127,7 +128,7 @@
this.f_97737_.clear();
(this.f_97732_).f_98639_.clear();
this.m_238391_();
@@ -541,13 +_,15 @@
@@ -540,13 +_,15 @@
this.f_98511_ = null;
}
@@ -135,7 +136,7 @@
+ if (f_98507_.hasSearchBar()) {
this.f_98510_.m_94194_(true);
this.f_98510_.m_94190_(false);
this.f_98510_.m_94178_(true);
this.f_98510_.m_93692_(true);
if (creativemodetab != p_98561_) {
this.f_98510_.m_94144_("");
}
@@ -144,7 +145,7 @@
this.m_98630_();
} else {
@@ -604,7 +_,7 @@
@@ -603,7 +_,7 @@
this.m_7333_(p_98577_);
super.m_86412_(p_98577_, p_98578_, p_98579_, p_98580_);
@@ -153,23 +154,22 @@
if (this.m_98584_(p_98577_, creativemodetab, p_98578_, p_98579_)) {
break;
}
@@ -614,6 +_,15 @@
@@ -613,13 +_,22 @@
this.m_96602_(p_98577_, f_98506_, p_98578_, p_98579_);
}
+ 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;
+ p_98577_.m_85836_();
+ p_98577_.m_252880_(0F, 0F, 300F);
+ 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;
+ p_98577_.m_85849_();
+ }
+
RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, 1.0F);
+ RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, 1.0F);
this.m_7025_(p_98577_, p_98578_, p_98579_);
}
@@ -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;
@@ -178,7 +178,7 @@
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,20 +_,20 @@
@@ -639,35 +_,36 @@
int i = 1;
@@ -196,37 +196,32 @@
}
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);
- for(CreativeModeTab creativemodetab : CreativeModeTabs.m_257388_()) {
+ for(CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) {
RenderSystem.m_157427_(GameRenderer::m_172817_);
RenderSystem.m_157456_(0, f_98504_);
if (creativemodetab != f_98507_) {
@@ -663,7 +_,7 @@
this.m_98581_(p_98572_, creativemodetab);
}
}
RenderSystem.m_157427_(GameRenderer::m_172817_);
- 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_);
m_93228_(p_98572_, this.f_97735_, this.f_97736_, 0, 0, this.f_97726_, this.f_97727_);
this.f_98510_.m_86412_(p_98572_, p_98574_, p_98575_, p_98573_);
RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, 1.0F);
@@ -671,11 +_,12 @@
int j = this.f_97735_ + 175;
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, 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);
m_93228_(p_98572_, j, k + (int)((float)(i - k - 17) * this.f_98508_), 232 + (this.m_98631_() ? 0 : 12), 0, 12, 15);
}
+ if (currentPage.getVisibleTabs().contains(f_98507_)) //Forge: only display tab selection when the selected tab is on the current page
this.m_98581_(p_98572_, f_98507_);
if (f_98507_.m_257962_() == CreativeModeTab.Type.INVENTORY) {
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_);
@@ -684,7 +_,7 @@
InventoryScreen.m_274545_(p_98572_, 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_);
@@ -676,7 +_,7 @@
}
private int m_258094_(CreativeModeTab p_260136_) {
@@ -235,7 +230,7 @@
int j = 27;
int k = 27 * i;
if (p_260136_.m_6563_()) {
@@ -696,7 +_,7 @@
@@ -688,7 +_,7 @@
private int m_257995_(CreativeModeTab p_260181_) {
int i = 0;
@@ -244,7 +239,7 @@
i -= 32;
} else {
i += this.f_97727_;
@@ -724,8 +_,8 @@
@@ -716,8 +_,8 @@
protected void m_98581_(PoseStack p_98582_, CreativeModeTab p_98583_) {
boolean flag = p_98583_ == f_98507_;
@@ -255,15 +250,15 @@
int j = i * 26;
int k = 0;
int l = this.f_97735_ + this.m_258094_(p_98583_);
@@ -742,6 +_,7 @@
@@ -734,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, 26, 32);
this.f_96542_.f_115093_ = 100.0F;
l += 5;
@@ -784,6 +_,14 @@
m_93228_(p_98582_, l, i1, j, k, 26, 32);
p_98582_.m_85836_();
p_98582_.m_252880_(0.0F, 0.0F, 100.0F);
@@ -777,6 +_,14 @@
}
@@ -278,7 +273,7 @@
@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 @@
@@ -944,6 +_,22 @@
public boolean m_8010_(Player p_98665_) {
return this.f_98655_.m_8010_(p_98665_);
@@ -1,8 +1,8 @@
--- a/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java
@@ -42,12 +_,17 @@
Collection<MobEffectInstance> collection = this.f_96541_.f_91074_.m_21220_();
if (!collection.isEmpty() && j >= 32) {
RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, 1.0F);
boolean flag = j >= 120;
+ var event = net.minecraftforge.client.ForgeHooksClient.onScreenPotionSize(this, j, !flag, i);
+ if (event.isCanceled()) return;
@@ -19,27 +19,27 @@
this.m_194002_(p_194015_, i, k, iterable, flag);
this.m_194008_(p_194015_, i, k, iterable, flag);
if (flag) {
@@ -95,6 +_,11 @@
@@ -94,6 +_,11 @@
int i = this.f_97736_;
for(MobEffectInstance mobeffectinstance : p_194012_) {
+ var renderer = net.minecraftforge.client.extensions.common.IClientMobEffectExtensions.of(mobeffectinstance);
+ if (renderer.renderInventoryIcon(mobeffectinstance, this, p_194009_, p_194010_ + (p_194013_ ? 6 : 7), i, this.m_93252_())) {
+ if (renderer.renderInventoryIcon(mobeffectinstance, this, p_194009_, p_194010_ + (p_194013_ ? 6 : 7), i, 0)) {
+ i += p_194011_;
+ continue;
+ }
MobEffect mobeffect = mobeffectinstance.m_19544_();
TextureAtlasSprite textureatlassprite = mobeffecttexturemanager.m_118732_(mobeffect);
RenderSystem.m_157456_(0, textureatlassprite.m_247685_());
@@ -108,6 +_,11 @@
@@ -107,6 +_,11 @@
int i = this.f_97736_;
for(MobEffectInstance mobeffectinstance : p_98726_) {
+ var renderer = net.minecraftforge.client.extensions.common.IClientMobEffectExtensions.of(mobeffectinstance);
+ if (renderer.renderInventoryText(mobeffectinstance, this, p_98723_, p_98724_, i, this.m_93252_())) {
+ if (renderer.renderInventoryText(mobeffectinstance, this, p_98723_, p_98724_, i, 0)) {
+ i += p_98725_;
+ continue;
+ }
Component component = this.m_194000_(mobeffectinstance);
this.f_96547_.m_92763_(p_98723_, component, (float)(p_98724_ + 10 + 18), (float)(i + 6), 16777215);
String s = MobEffectUtil.m_19581_(mobeffectinstance, 1.0F);
Component component1 = MobEffectUtil.m_267641_(mobeffectinstance, 1.0F);
@@ -1,15 +1,15 @@
--- a/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java
@@ -147,7 +_,7 @@
@@ -140,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;
- if ((l < i1 + 1 || this.f_96541_.f_91074_.f_36078_ < l1) && !this.f_96541_.f_91074_.m_150110_().f_35937_) {
+ if (((l < i1 + 1 || this.f_96541_.f_91074_.f_36078_ < l1) && !this.f_96541_.f_91074_.m_150110_().f_35937_) || this.f_97732_.f_39447_[i1] == -1) { // Forge: render buttons as disabled when enchantable but enchantability not met on lower levels
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);
@@ -186,10 +_,13 @@
m_93228_(p_98762_, j1, j + 14 + 19 * i1, 0, 185, 108, 19);
m_93228_(p_98762_, j1 + 1, j + 15 + 19 * i1, 16 * i1, 239, 16, 16);
this.f_96547_.m_274535_(p_98762_, formattedtext, k1, j + 16 + 19 * i1, i2, (j2 & 16711422) >> 1);
@@ -179,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;
@@ -0,0 +1,11 @@
--- a/net/minecraft/client/gui/screens/inventory/HangingSignEditScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/HangingSignEditScreen.java
@@ -17,7 +_,7 @@
private static final Vector3f f_243728_ = new Vector3f(1.0F, 1.0F, 1.0F);
private static final int f_244604_ = 16;
private static final int f_244207_ = 16;
- private final ResourceLocation f_243720_ = new ResourceLocation("textures/gui/hanging_signs/" + this.f_244069_.f_61839_() + ".png");
+ private final ResourceLocation f_243720_ = new ResourceLocation(this.f_244069_.f_61839_() + ".png").m_246208_("textures/gui/hanging_signs/");
public HangingSignEditScreen(SignBlockEntity p_249425_, boolean p_250356_) {
super(p_249425_, p_250356_, Component.m_237115_("hanging_sign.edit"));
@@ -1,14 +1,16 @@
--- a/net/minecraft/client/gui/screens/inventory/InventoryScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/InventoryScreen.java
@@ -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));
+ renderEntityInInventoryRaw(p_98851_, p_98852_, p_98853_, f, f1, p_98856_);
@@ -98,6 +_,13 @@
public static void m_274545_(PoseStack p_275396_, int p_275688_, int p_275245_, int p_275535_, float p_275604_, float p_275546_, LivingEntity p_275689_) {
float f = (float)Math.atan((double)(p_275604_ / 40.0F));
float f1 = (float)Math.atan((double)(p_275546_ / 40.0F));
+ // Forge: Allow passing in direct angle components instead of mouse position
+ renderEntityInInventoryFollowsAngle(p_275396_, p_275688_, p_275245_, p_275535_, f, f1, p_275689_);
+ }
+ public static void renderEntityInInventoryRaw(int p_98851_, int p_98852_, int p_98853_, float angleXComponent, float angleYComponent, LivingEntity p_98856_) {
+
+ public static void renderEntityInInventoryFollowsAngle(PoseStack p_275396_, int p_275688_, int p_275245_, int p_275535_, float angleXComponent, float angleYComponent, LivingEntity p_275689_) {
+ float f = angleXComponent;
+ float f1 = angleYComponent;
PoseStack posestack = RenderSystem.m_157191_();
posestack.m_85836_();
posestack.m_252880_((float)p_98851_, (float)p_98852_, 1050.0F);
Quaternionf quaternionf = (new Quaternionf()).rotateZ((float)Math.PI);
Quaternionf quaternionf1 = (new Quaternionf()).rotateX(f1 * 20.0F * ((float)Math.PI / 180F));
quaternionf.mul(quaternionf1);
@@ -1,16 +1,16 @@
--- a/net/minecraft/client/gui/screens/inventory/MerchantScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/MerchantScreen.java
@@ -240,7 +_,12 @@
this.f_96542_.m_115169_(this.f_96547_, p_99164_, p_99166_, p_99167_);
@@ -234,7 +_,12 @@
this.f_96542_.m_274412_(p_99163_, this.f_96547_, p_99164_, p_99166_, p_99167_);
} else {
this.f_96542_.m_115174_(this.f_96547_, p_99165_, p_99166_, p_99167_, p_99165_.m_41613_() == 1 ? "1" : null);
- this.f_96542_.m_115174_(this.f_96547_, p_99164_, p_99166_ + 14, p_99167_, p_99164_.m_41613_() == 1 ? "1" : null);
this.f_96542_.m_274364_(p_99163_, this.f_96547_, p_99165_, p_99166_, p_99167_, p_99165_.m_41613_() == 1 ? "1" : null);
- this.f_96542_.m_274364_(p_99163_, this.f_96547_, p_99164_, p_99166_ + 14, p_99167_, p_99164_.m_41613_() == 1 ? "1" : null);
+ // Forge: fixes Forge-8806, code for count rendering taken from ItemRenderer#renderGuiItemDecorations
+ PoseStack posestack = new PoseStack();
+ posestack.m_85837_(0.0D, 0.0D, (f_96542_.f_115093_ + 200.0F));
+ posestack.m_85837_(0.0D, 0.0D, 200F);
+ 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_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);
+ f_96547_.m_272078_(String.valueOf(p_99164_.m_41613_()), (float) (p_99166_ + 14) + 19 - 2 - f_96547_.m_92895_(String.valueOf(p_99164_.m_41613_())), (float)p_99167_ + 6 + 3, 0xFFFFFF, true, posestack.m_85850_().m_252922_(), bufferSource, net.minecraft.client.gui.Font.DisplayMode.NORMAL, 0, 15728880, false);
+ bufferSource.m_109911_();
RenderSystem.m_157427_(GameRenderer::m_172817_);
RenderSystem.m_157456_(0, f_99113_);
this.m_93250_(this.m_93252_() + 300);
p_99163_.m_85836_();
p_99163_.m_252880_(0.0F, 0.0F, 300.0F);
@@ -0,0 +1,49 @@
--- a/net/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil.java
+++ b/net/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil.java
@@ -18,16 +_,21 @@
private static final int f_262743_ = 1344798847;
public static void m_262796_(TooltipRenderUtil.BlitPainter p_262929_, Matrix4f p_263052_, BufferBuilder p_263082_, int p_263046_, int p_263101_, int p_263024_, int p_262926_, int p_263038_) {
+ renderTooltipBackground(p_262929_, p_263052_, p_263082_, p_263046_, p_263101_, p_263024_, p_262926_, p_263038_, f_262744_, f_262744_, f_262725_, f_262743_);
+ }
+
+ // Forge: Allow specifying colors for the inner border gradient and a gradient instead of a single color for the background and outer border
+ public static void renderTooltipBackground(TooltipRenderUtil.BlitPainter p_262929_, Matrix4f p_263052_, BufferBuilder p_263082_, int p_263046_, int p_263101_, int p_263024_, int p_262926_, int p_263038_, int backgroundTop, int backgroundBottom, int borderTop, int borderBottom) {
int i = p_263046_ - 3;
int j = p_263101_ - 3;
int k = p_263024_ + 3 + 3;
int l = p_262926_ + 3 + 3;
- m_262855_(p_262929_, p_263052_, p_263082_, i, j - 1, k, p_263038_, -267386864);
- m_262855_(p_262929_, p_263052_, p_263082_, i, j + l, k, p_263038_, -267386864);
- m_262805_(p_262929_, p_263052_, p_263082_, i, j, k, l, p_263038_, -267386864);
- m_262798_(p_262929_, p_263052_, p_263082_, i - 1, j, l, p_263038_, -267386864);
- m_262798_(p_262929_, p_263052_, p_263082_, i + k, j, l, p_263038_, -267386864);
- m_262846_(p_262929_, p_263052_, p_263082_, i, j + 1, k, l, p_263038_, 1347420415, 1344798847);
+ m_262855_(p_262929_, p_263052_, p_263082_, i, j - 1, k, p_263038_, backgroundTop);
+ m_262855_(p_262929_, p_263052_, p_263082_, i, j + l, k, p_263038_, backgroundBottom);
+ renderRectangle(p_262929_, p_263052_, p_263082_, i, j, k, l, p_263038_, backgroundTop, backgroundBottom);
+ m_262849_(p_262929_, p_263052_, p_263082_, i - 1, j, l, p_263038_, backgroundTop, backgroundBottom);
+ m_262849_(p_262929_, p_263052_, p_263082_, i + k, j, l, p_263038_, backgroundTop, backgroundBottom);
+ m_262846_(p_262929_, p_263052_, p_263082_, i, j + 1, k, l, p_263038_, borderTop, borderBottom);
}
private static void m_262846_(TooltipRenderUtil.BlitPainter p_262974_, Matrix4f p_263030_, BufferBuilder p_263061_, int p_262982_, int p_262912_, int p_262946_, int p_263049_, int p_263118_, int p_263104_, int p_262979_) {
@@ -49,8 +_,17 @@
p_262966_.m_262815_(p_263094_, p_262943_, p_262949_, p_263068_, p_262949_ + p_263111_, p_263068_ + 1, p_263095_, p_262918_, p_262918_);
}
+ /**
+ * @deprecated Forge: Use gradient overload instead
+ */
+ @Deprecated
private static void m_262805_(TooltipRenderUtil.BlitPainter p_262933_, Matrix4f p_263035_, BufferBuilder p_263084_, int p_262945_, int p_262955_, int p_263017_, int p_262978_, int p_262950_, int p_262931_) {
- p_262933_.m_262815_(p_263035_, p_263084_, p_262945_, p_262955_, p_262945_ + p_263017_, p_262955_ + p_262978_, p_262950_, p_262931_, p_262931_);
+ renderRectangle(p_262933_, p_263035_, p_263084_, p_262945_, p_262955_, p_263017_, p_262978_, p_262950_, p_262931_, p_262931_);
+ }
+
+ // Forge: Allow specifying a gradient instead of a single color for the background
+ private static void renderRectangle(TooltipRenderUtil.BlitPainter p_262933_, Matrix4f p_263035_, BufferBuilder p_263084_, int p_262945_, int p_262955_, int p_263017_, int p_262978_, int p_262950_, int p_262931_, int colorTo) {
+ p_262933_.m_262815_(p_263035_, p_263084_, p_262945_, p_262955_, p_262945_ + p_263017_, p_262955_ + p_262978_, p_262950_, p_262931_, colorTo);
}
@FunctionalInterface
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java
+++ b/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java
@@ -259,6 +_,11 @@
@@ -281,6 +_,11 @@
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java
+++ b/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java
@@ -321,6 +_,8 @@
@@ -330,6 +_,8 @@
this.f_99855_.m_99707_(list1);
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/packs/PackSelectionModel.java
+++ b/net/minecraft/client/gui/screens/packs/PackSelectionModel.java
@@ -102,6 +_,8 @@
@@ -110,6 +_,8 @@
boolean m_7802_();
boolean m_7803_();
@@ -9,7 +9,7 @@
}
@OnlyIn(Dist.CLIENT)
@@ -176,6 +_,11 @@
@@ -198,6 +_,11 @@
public void m_7845_() {
this.m_99938_(1);
@@ -1,11 +1,11 @@
--- a/net/minecraft/client/gui/screens/packs/PackSelectionScreen.java
+++ b/net/minecraft/client/gui/screens/packs/PackSelectionScreen.java
@@ -130,7 +_,7 @@
private void m_100013_(TransferableSelectionList p_100014_, Stream<PackSelectionModel.Entry> p_100015_) {
p_100014_.m_6702_().clear();
TransferableSelectionList.PackEntry transferableselectionlist$packentry = p_100014_.m_93511_();
String s = transferableselectionlist$packentry == null ? "" : transferableselectionlist$packentry.m_264411_();
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_));
});
}
- p_100015_.forEach((p_264692_) -> {
+ p_100015_.filter(PackSelectionModel.Entry::notHidden).forEach((p_264692_) -> {
TransferableSelectionList.PackEntry transferableselectionlist$packentry1 = new TransferableSelectionList.PackEntry(this.f_96541_, p_100014_, p_264692_);
p_100014_.m_6702_().add(transferableselectionlist$packentry1);
if (p_264692_.m_264249_().equals(s)) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java
+++ b/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java
@@ -108,7 +_,7 @@
@@ -106,7 +_,7 @@
this.m_5674_();
this.f_100279_.clear();
@@ -9,7 +9,7 @@
this.f_100279_.add(new RecipeBookTabButton(recipebookcategories));
}
@@ -305,7 +_,7 @@
@@ -297,7 +_,7 @@
}
if (itemstack != null && this.f_100272_.f_91080_ != null) {
@@ -5,7 +5,7 @@
public void m_100417_(PoseStack p_100418_, int p_100419_, int p_100420_) {
if (this.f_100397_.f_91080_ != null && this.f_100395_ != null && !this.f_100396_.m_100212_()) {
- this.f_100397_.f_91080_.m_96597_(p_100418_, this.f_100395_.m_100477_(this.f_100397_.f_91080_), p_100419_, p_100420_);
+ this.f_100397_.f_91080_.renderComponentTooltip(p_100418_, this.f_100395_.m_100477_(this.f_100397_.f_91080_), p_100419_, p_100420_, this.f_100395_.m_100488_().m_8043_());
+ this.f_100397_.f_91080_.renderComponentTooltip(p_100418_, this.f_100395_.m_100477_(this.f_100397_.f_91080_), p_100419_, p_100420_, this.f_100395_.m_100488_().m_8043_(f_100397_.f_91073_.m_9598_()));
}
}
@@ -1,37 +1,23 @@
--- a/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
+++ b/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
@@ -113,7 +_,8 @@
@@ -119,6 +_,7 @@
public static void m_232896_(Minecraft p_232897_, @Nullable Screen p_232898_) {
m_232899_(p_232897_, f_232866_);
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.
WorldLoader.InitConfig worldloader$initconfig = m_245574_(packrepository, WorldDataConfiguration.f_244649_);
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_, 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 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);
}
@@ -368,7 +_,7 @@
if (p_269627_) {
p_270552_.accept(this.f_267389_.m_267573_().f_243842_());
} else {
- p_270552_.accept(WorldDataConfiguration.f_244649_);
+ p_270552_.accept(new WorldDataConfiguration(new DataPackConfig(ImmutableList.of("vanilla"), ImmutableList.of()), FeatureFlags.f_244332_)); // FORGE: Revert to *actual* vanilla data
}
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);
}
@@ -612,6 +_,7 @@
}, Component.m_237115_("dataPack.validation.failed"), CommonComponents.f_237098_, Component.m_237115_("dataPack.validation.back"), Component.m_237115_("dataPack.validation.reset")));
@@ -482,6 +_,7 @@
if (path != null) {
if (this.f_100832_ == null) {
this.f_100832_ = ServerPacksSource.m_245786_(path);
@@ -0,0 +1,13 @@
--- a/net/minecraft/client/gui/screens/worldselection/PresetEditor.java
+++ b/net/minecraft/client/gui/screens/worldselection/PresetEditor.java
@@ -28,6 +_,10 @@
@OnlyIn(Dist.CLIENT)
public interface PresetEditor {
+ /**
+ * @deprecated Forge: Use {@link net.minecraftforge.client.PresetEditorManager#get(ResourceKey)} instead.
+ */
+ @Deprecated
Map<Optional<ResourceKey<WorldPreset>>, PresetEditor> f_232950_ = Map.of(Optional.of(WorldPresets.f_226438_), (p_232974_, p_232975_) -> {
ChunkGenerator chunkgenerator = p_232975_.f_243796_().m_246737_();
RegistryAccess registryaccess = p_232975_.m_246480_();
@@ -0,0 +1,13 @@
--- a/net/minecraft/client/gui/screens/worldselection/WorldCreationContext.java
+++ b/net/minecraft/client/gui/screens/worldselection/WorldCreationContext.java
@@ -38,6 +_,10 @@
return new WorldCreationContext(this.f_244272_, this.f_244375_, p_250676_.apply(this.m_246480_(), this.f_243796_), this.f_243708_, this.f_232990_, this.f_243842_);
}
+ public WorldCreationContext withDataConfiguration(WorldDataConfiguration dataConfiguration) {
+ return new WorldCreationContext(this.f_244272_, this.f_244375_, this.f_243796_, this.f_243708_, this.f_232990_, dataConfiguration);
+ }
+
public RegistryAccess.Frozen m_246480_() {
return this.f_243708_.m_247579_();
}
@@ -0,0 +1,11 @@
--- a/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java
+++ b/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java
@@ -226,7 +_,7 @@
@Nullable
public PresetEditor m_267744_() {
Holder<WorldPreset> holder = this.m_267828_().f_267398_();
- return holder != null ? PresetEditor.f_232950_.get(holder.m_203543_()) : null;
+ return holder != null ? holder.m_203543_().map(net.minecraftforge.client.PresetEditorManager::get).orElse(null) : null; // FORGE: redirect lookup to expanded map
}
public List<WorldCreationUiState.WorldTypeEntry> m_267815_() {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java
+++ b/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java
@@ -158,13 +_,23 @@
@@ -159,13 +_,23 @@
}
private void m_233145_(Screen p_233146_, String p_233147_, boolean p_233148_, boolean p_233149_) {
@@ -23,8 +23,8 @@
+ }
} catch (Exception 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(() -> {
@@ -177,7 +_,9 @@
if (!p_233148_) {
@@ -185,7 +_,9 @@
WorldData worlddata = worldstem.f_206895_();
boolean flag = worlddata.m_246337_().m_247070_();
boolean flag1 = worlddata.m_5754_() != Lifecycle.stable();
@@ -35,7 +35,7 @@
this.f_233089_.m_247489_().m_247400_(levelstoragesource$levelstorageaccess).thenApply((p_233177_) -> {
return true;
}).exceptionallyComposeAsync((p_233183_) -> {
@@ -199,9 +_,11 @@
@@ -207,9 +_,11 @@
return null;
});
} else {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java
+++ b/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java
@@ -65,6 +_,7 @@
@@ -63,6 +_,7 @@
static final DateFormat f_101646_ = new SimpleDateFormat();
static final ResourceLocation f_101647_ = new ResourceLocation("textures/misc/unknown_server.png");
static final ResourceLocation f_101648_ = new ResourceLocation("textures/gui/world_selection.png");
@@ -8,7 +8,7 @@
static final Component f_101649_ = Component.m_237115_("selectWorld.tooltip.fromNewerVersion1").m_130940_(ChatFormatting.RED);
static final Component f_101650_ = Component.m_237115_("selectWorld.tooltip.fromNewerVersion2").m_130940_(ChatFormatting.RED);
static final Component f_101651_ = Component.m_237115_("selectWorld.tooltip.snapshot1").m_130940_(ChatFormatting.GOLD);
@@ -325,6 +_,7 @@
@@ -313,6 +_,7 @@
RenderSystem.m_69478_();
GuiComponent.m_93133_(p_101721_, p_101724_, p_101723_, 0.0F, 0.0F, 32, 32, 32, 32);
RenderSystem.m_69461_();
@@ -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);
@@ -560,6 +_,21 @@
@@ -545,6 +_,21 @@
public boolean m_214209_() {
return !this.f_101695_.m_164916_();
@@ -1,15 +1,6 @@
--- a/net/minecraft/client/main/Main.java
+++ b/net/minecraft/client/main/Main.java
@@ -48,7 +_,7 @@
@DontObfuscate
public static void main(String[] p_129642_) {
- m_239872_(p_129642_, true);
+ m_239872_(p_129642_, !net.minecraftforge.fml.loading.FMLConfig.isOptimizedDFUDisabled());
}
public static void m_239872_(String[] p_239873_, boolean p_239874_) {
@@ -142,7 +_,7 @@
@@ -135,7 +_,7 @@
}
CrashReport.m_127529_();
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/model/HumanoidModel.java
+++ b/net/minecraft/client/model/HumanoidModel.java
@@ -264,6 +_,8 @@
@@ -270,6 +_,8 @@
case TOOT_HORN:
this.f_102811_.f_104203_ = Mth.m_14036_(this.f_102808_.f_104203_, -1.2F, 1.2F) - 1.4835298F;
this.f_102811_.f_104204_ = this.f_102808_.f_104204_ - ((float)Math.PI / 6F);
@@ -9,7 +9,7 @@
}
}
@@ -304,6 +_,8 @@
@@ -314,6 +_,8 @@
case TOOT_HORN:
this.f_102812_.f_104203_ = Mth.m_14036_(this.f_102808_.f_104203_, -1.2F, 1.2F) - 1.4835298F;
this.f_102812_.f_104204_ = this.f_102808_.f_104204_ + ((float)Math.PI / 6F);
@@ -18,7 +18,7 @@
}
}
@@ -396,7 +_,7 @@
@@ -406,7 +_,7 @@
}
@OnlyIn(Dist.CLIENT)
@@ -27,7 +27,7 @@
EMPTY(false),
ITEM(false),
BLOCK(false),
@@ -411,10 +_,29 @@
@@ -422,10 +_,29 @@
private ArmPose(boolean p_102896_) {
this.f_102890_ = p_102896_;
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/model/geom/LayerDefinitions.java
+++ b/net/minecraft/client/model/geom/LayerDefinitions.java
@@ -313,6 +_,7 @@
@@ -319,6 +_,7 @@
WoodType.m_61843_().forEach((p_247864_) -> {
builder.put(ModelLayers.m_247439_(p_247864_), layerdefinition24);
});
@@ -1,17 +1,17 @@
--- a/net/minecraft/client/model/geom/ModelLayers.java
+++ b/net/minecraft/client/model/geom/ModelLayers.java
@@ -217,11 +_,13 @@
@@ -220,11 +_,13 @@
}
public static ModelLayerLocation m_171291_(WoodType p_171292_) {
- return m_171300_("sign/" + p_171292_.m_61846_(), "main");
+ ResourceLocation location = new ResourceLocation(p_171292_.m_61846_());
- return m_171300_("sign/" + p_171292_.f_61839_(), "main");
+ ResourceLocation location = new ResourceLocation(p_171292_.f_61839_());
+ 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 m_171300_("hanging_sign/" + p_252225_.f_61839_(), "main");
+ ResourceLocation location = new ResourceLocation(p_252225_.f_61839_());
+ return new ModelLayerLocation(new ResourceLocation(location.m_135827_(), "hanging_sign/" + location.m_135815_()), "main");
}
@@ -8,11 +8,11 @@
this.f_104410_.m_104487_(i, levelchunk, (LevelChunk)null);
}
@@ -100,6 +_,7 @@
@@ -115,6 +_,7 @@
}
this.f_104411_.m_171649_(chunkpos);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.level.ChunkEvent.Load(levelchunk));
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.level.ChunkEvent.Load(levelchunk, false));
return levelchunk;
}
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/multiplayer/ClientLevel.java
+++ b/net/minecraft/client/multiplayer/ClientLevel.java
@@ -117,12 +_,15 @@
@@ -116,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);
@@ -176,6 +_,8 @@
@@ -175,6 +_,8 @@
this.f_194123_ = p_205510_;
this.m_46465_();
this.m_46466_();
@@ -25,7 +25,7 @@
}
public void m_194171_(Runnable p_194172_) {
@@ -262,6 +_,7 @@
@@ -261,6 +_,7 @@
this.m_46473_().m_6521_(() -> {
return BuiltInRegistries.f_256780_.m_7981_(p_104640_.m_6095_()).toString();
});
@@ -33,7 +33,7 @@
p_104640_.m_8119_();
this.m_46473_().m_7238_();
@@ -324,8 +_,10 @@
@@ -323,8 +_,10 @@
}
private void m_104739_(int p_104740_, Entity p_104741_) {
@@ -44,7 +44,7 @@
}
public void m_171642_(int p_171643_, Entity.RemovalReason p_171644_) {
@@ -452,6 +_,12 @@
@@ -451,6 +_,12 @@
}
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_) {
@@ -57,7 +57,7 @@
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_);
}
@@ -459,6 +_,12 @@
@@ -458,6 +_,12 @@
}
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_) {
@@ -70,7 +70,7 @@
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_));
}
@@ -907,6 +_,7 @@
@@ -902,6 +_,7 @@
}
public void m_104851_(Difficulty p_104852_) {
@@ -78,7 +78,7 @@
this.f_104840_ = p_104852_;
}
@@ -944,14 +_,46 @@
@@ -939,14 +_,46 @@
ClientLevel.this.f_104566_.add((AbstractClientPlayer)p_171712_);
}
@@ -1,33 +1,33 @@
--- a/net/minecraft/client/multiplayer/ClientPacketListener.java
+++ b/net/minecraft/client/multiplayer/ClientPacketListener.java
@@ -398,6 +_,7 @@
@@ -411,6 +_,7 @@
this.f_104888_.f_91064_.m_113434_();
this.f_104888_.f_91074_.m_172530_();
+ net.minecraftforge.client.ForgeHooksClient.firePlayerLogin(this.f_104888_.f_91072_, this.f_104888_.f_91074_, this.f_104888_.m_91403_().m_6198_());
+ net.minecraftforge.client.ForgeHooksClient.firePlayerLogin(this.f_104888_.f_91072_, this.f_104888_.f_91074_, this.f_104888_.m_91403_().f_104885_);
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_);
@@ -410,6 +_,7 @@
@@ -423,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_244346_ = new LastSeenMessagesTracker(20);
@@ -1003,8 +_,10 @@
this.f_252517_ = null;
@@ -1055,8 +_,10 @@
localplayer1.m_21204_().m_22159_(localplayer.m_21204_());
}
+ localplayer1.updateSyncFields(localplayer); // Forge: fix MC-10657
localplayer1.m_172530_();
localplayer1.m_108748_(s);
+ net.minecraftforge.client.ForgeHooksClient.firePlayerRespawn(this.f_104888_.f_91072_, localplayer, localplayer1, localplayer1.f_108617_.m_6198_());
+ net.minecraftforge.client.ForgeHooksClient.firePlayerRespawn(this.f_104888_.f_91072_, localplayer, localplayer1, localplayer1.f_108617_.f_104885_);
this.f_104889_.m_104630_(i, localplayer1);
localplayer1.m_146922_(-180.0F);
localplayer1.f_108618_ = new KeyboardInput(this.f_104888_.f_91066_);
@@ -1109,10 +_,7 @@
@@ -1161,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,7 +39,7 @@
if (p_205557_ instanceof CommandBlockEntity && this.f_104888_.f_91080_ instanceof CommandBlockEditScreen) {
((CommandBlockEditScreen)this.f_104888_.f_91080_).m_98398_();
@@ -1257,7 +_,9 @@
@@ -1310,7 +_,9 @@
public void m_7443_(ClientboundCommandsPacket p_104990_) {
PacketUtils.m_131363_(p_104990_, this, this.f_104888_);
@@ -50,15 +50,15 @@
}
public void m_7183_(ClientboundStopSoundPacket p_105116_) {
@@ -1276,6 +_,7 @@
@@ -1329,6 +_,7 @@
ClientRecipeBook clientrecipebook = this.f_104888_.f_91074_.m_108631_();
clientrecipebook.m_90625_(this.f_104900_.m_44051_());
clientrecipebook.m_266394_(this.f_104900_.m_44051_(), this.f_104888_.f_91073_.m_9598_());
this.f_104888_.m_231374_(SearchRegistry.f_119943_, clientrecipebook.m_90639_());
+ net.minecraftforge.client.ForgeHooksClient.onRecipesUpdated(this.f_104900_);
}
public void m_7244_(ClientboundPlayerLookAtPacket p_105054_) {
@@ -1368,7 +_,8 @@
@@ -1424,7 +_,8 @@
Blocks.m_50758_();
}
@@ -68,15 +68,15 @@
}
public void m_241155_(ClientboundUpdateEnabledFeaturesPacket p_251591_) {
@@ -1753,6 +_,7 @@
@@ -1826,6 +_,7 @@
}
public void m_7413_(ClientboundCustomPayloadPacket p_105004_) {
+ if (!f_104888_.m_18695_() && net.minecraftforge.network.NetworkHooks.onCustomPayload(p_105004_, this.f_104885_)) return;
+ if (net.minecraftforge.network.NetworkHooks.onCustomPayload(p_105004_, this.f_104885_)) return;
PacketUtils.m_131363_(p_105004_, this, this.f_104888_);
ResourceLocation resourcelocation = p_105004_.m_132042_();
FriendlyByteBuf friendlybytebuf = null;
@@ -1950,7 +_,7 @@
@@ -2023,7 +_,7 @@
int j5 = friendlybytebuf.m_130242_();
this.f_104888_.f_91064_.f_173815_.m_173830_(positionsource, j5);
} else {
@@ -85,7 +85,7 @@
}
} finally {
if (friendlybytebuf != null) {
@@ -2284,6 +_,8 @@
@@ -2370,6 +_,8 @@
}
public void m_246175_(String p_249888_) {
@@ -94,7 +94,7 @@
Instant instant = Instant.now();
long i = Crypt.SaltSupplier.m_216113_();
LastSeenMessagesTracker.Update lastseenmessagestracker$update = this.f_244346_.m_246442_();
@@ -2292,6 +_,7 @@
@@ -2378,6 +_,7 @@
}
public void m_246623_(String p_250092_) {
@@ -84,7 +84,7 @@
public float m_105286_() {
- return this.f_105197_.m_46408_() ? 5.0F : 4.5F;
+ return (float) this.f_105189_.f_91074_.getReachDistance();
+ return (float) this.f_105189_.f_91074_.getBlockReach();
}
public void m_105287_() {
Loaded 100 of 691 files, more files were not shown because too many files have changed in this diff. Show more