├── .editorconfig ├── .github ├── ISSUE_TEMPLATE │ ├── bug.yml │ ├── bugfix.yml │ └── config.yml └── workflows │ └── build.yml ├── .gitignore ├── FIXED_ISSUES.md ├── LICENSE ├── README.md ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── scripts └── getFixedIssues.sh ├── settings.gradle └── src └── main ├── java └── io │ └── github │ └── potassiummc │ └── thorium │ ├── Thorium.java │ ├── ThoriumMixinPlugin.java │ ├── access │ └── LanguageSelectionListWidgetAccess.java │ ├── config │ └── ThoriumConfig.java │ └── mixin │ ├── access │ ├── ClientPlayerEntityInvoker.java │ ├── EntityAccessor.java │ └── LivingEntityInvoker.java │ ├── client │ ├── mc112730 │ │ └── RebuildTaskMixin.java │ ├── mc115092 │ │ └── SquidEntityRendererMixin.java │ ├── mc12062 │ │ └── ClientPlayNetworkHandlerMixin.java │ ├── mc127970 │ │ └── HeldItemRendererMixin.java │ ├── mc144761 │ │ └── InterpolationMixin.java │ ├── mc147766 │ │ └── TextFieldWidgetMixin.java │ ├── mc148993 │ │ └── ClientPlayerEntityMixin.java │ ├── mc165595 │ │ └── GuardianEntityRendererMixin.java │ ├── mc168016 │ │ └── PageTurnWidgetMixin.java │ ├── mc184029 │ │ ├── LanguageEntryMixin.java │ │ └── LanguageSelectionListWidgetMixin.java │ ├── mc201723 │ │ └── ItemStatsListWidgetMixin.java │ ├── mc210318 │ │ └── BookEditScreenMixin.java │ ├── mc215531 │ │ └── InGameHudMixin.java │ ├── mc227169 │ │ └── PlayerEntityRendererMixin.java │ ├── mc35361 │ │ └── MinecraftClientMixin.java │ ├── mc4490 │ │ └── FishingBobberEntityRendererMixin.java │ ├── mc46503 │ │ └── ClientPlayNetworkHandlerMixin.java │ ├── mc46737 │ │ └── GameRendererMixin.java │ ├── mc46766 │ │ └── MinecraftClientMixin.java │ ├── mc55347 │ │ └── ClientPlayNetworkHandlerMixin.java │ ├── mc62997 │ │ └── InGameHudMixin.java │ └── mc75721 │ │ └── BookScreenMixin.java │ └── server │ ├── mc119417 │ └── ServerPlayerEntityMixin.java │ ├── mc123450 │ └── ItemFrameEntityMixin.java │ ├── mc123605 │ └── MinecraftServerMixin.java │ ├── mc139041 │ └── FishingRodItemMixin.java │ ├── mc147659 │ └── CatSpawnerMixin.java │ ├── mc159283 │ └── EndIslandsMixin.java │ ├── mc170462 │ └── StatusEffectsMixin.java │ ├── mc175622 │ └── WolfEntityMixin.java │ ├── mc176806 │ └── RespawnAnchorBlockMixin.java │ ├── mc181412 │ └── JukeboxBlockMixin.java │ ├── mc193343 │ └── ServerPlayerEntityMixin.java │ ├── mc202637 │ └── LivingEntityMixin.java │ ├── mc215530 │ └── ServerPlayerEntityMixin.java │ ├── mc225364 │ └── ChorusFlowerBlockMixin.java │ ├── mc227337 │ └── ShulkerBulletEntityMixin.java │ ├── mc237843 │ └── ServerPlayNetworkHandlerMixin.java │ ├── mc244948 │ └── BundleItemMixin.java │ ├── mc245394 │ └── RaidMixin.java │ ├── mc252934 │ └── AbstractDecorationEntityMixin.java │ ├── mc6431 │ ├── PlayerManagerMixin.java │ └── ServerPlayerEntityMixin.java │ ├── mc69216 │ └── ServerPlayerEntityMixin.java │ ├── mc7569 │ └── RconCommandOutputMixin.java │ ├── mc81773 │ └── ServerPlayerEntityMixin.java │ ├── mc84661 │ └── StatusEffectsMixin.java │ └── mc86252 │ └── ServerPlayerEntityMixin.java └── resources ├── assets └── thorium │ ├── icon.png │ └── icon.svg ├── fabric.mod.json ├── thorium.accesswidener └── thorium.mixins.json /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 4 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | ij_any_block_comment_at_first_column = false 11 | ij_any_line_comment_at_first_column = false 12 | ij_any_block_comment_add_space = true 13 | ij_typescript_use_double_quotes = false 14 | ij_javascript_use_double_quotes = false 15 | ij_sass_use_double_quotes = false 16 | ij_html_quote_style = double 17 | 18 | [*.java] 19 | ij_java_insert_inner_class_imports = false 20 | ij_java_use_fq_class_names = false 21 | ij_java_class_count_to_use_import_on_demand = 99999 22 | ij_java_names_count_to_use_import_on_demand = 99999 23 | 24 | [*.json] 25 | indent_size = 2 26 | 27 | [*.yml] 28 | indent_size = 2 29 | 30 | [*.md] 31 | trim_trailing_whitespace = false 32 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug.yml: -------------------------------------------------------------------------------- 1 | name: Bug 2 | description: Report a bug in thorium itself. 3 | labels: [ "status: awaiting triage", "type: bug" ] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | Thank you for taking the time to fill out an issue for thorium! Before making an issue, please check if one exists already. 9 | Please keep in mind this form is for reporting issues with thorium/thorium fixes themselves, not for requesting a new Minecraft bugfix. 10 | For those types of issues, use the "Bugfix Request" issue form. 11 | 12 | - type: textarea 13 | attributes: 14 | label: Expected behavior 15 | description: What you expected to see. 16 | validations: 17 | required: true 18 | 19 | - type: textarea 20 | attributes: 21 | label: Observed/Actual behavior 22 | description: What you actually saw. 23 | validations: 24 | required: true 25 | 26 | - type: textarea 27 | attributes: 28 | label: Steps/models to reproduce 29 | description: This may include a build schematic, a video, or detailed instructions to help reconstruct the issue. 30 | validations: 31 | required: true 32 | 33 | - type: textarea 34 | attributes: 35 | label: Other 36 | description: Add any other context or screenshots about the issue below. 37 | validations: 38 | required: false 39 | 40 | - type: markdown 41 | attributes: 42 | value: | 43 | Before submitting this issue, please search our issue tracker to ensure your issue has not 44 | already been reported. 45 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bugfix.yml: -------------------------------------------------------------------------------- 1 | name: Bugfix Request 2 | description: Request a fix for a bug in Minecraft. 3 | labels: [ "status: awaiting triage", "type: Minecraft bug fix" ] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | Thank you for taking the time to fill out an issue for thorium! Before making an issue, please check if one exists already. 9 | When requesting a fix for a bug in Minecraft, please link the related [Mojira](https://bugs.mojang.com) issue. 10 | Please keep in mind that thorium does not fix issues that would require the mod to be installed on both the client and the server. 11 | An example of such an issue would be a block not having a primary tool assigned to it, or walk speed being calculated incorrectly. 12 | 13 | - type: textarea 14 | attributes: 15 | label: Issue explanation 16 | description: Provide a short summary of the Minecraft bug you are experiencing. 17 | validations: 18 | required: true 19 | 20 | - type: input 21 | attributes: 22 | label: Mojira issue link 23 | description: Provide a link to the Mojira ticket belonging to this bug. 24 | validations: 25 | required: false 26 | 27 | - type: textarea 28 | attributes: 29 | label: Other 30 | description: Add any other context or screenshots about the bugfix request below. 31 | validations: 32 | required: false 33 | 34 | - type: markdown 35 | attributes: 36 | value: | 37 | Before submitting this bugfix request, please search our issue tracker to ensure your fix has not 38 | already been requested. 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: true 2 | contact_links: 3 | - name: PotassiumMC Discord 4 | url: https://discord.gg/bXG8H6PVuS 5 | about: For general support-related questions, come ask us in our Discord server! 6 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | # Automatically build the project and run any configured tests for every push 2 | # and submitted pull request. This can help catch issues that only occur on 3 | # certain platforms or Java versions, and provides a first line of defence 4 | # against bad commits. 5 | 6 | name: build 7 | on: [ pull_request, push ] 8 | 9 | jobs: 10 | build: 11 | strategy: 12 | matrix: 13 | # Use these Java versions 14 | java: [ 15 | 17, # Current Java LTS & minimum supported by Minecraft 16 | ] 17 | # and run on both Linux and Windows 18 | os: [ ubuntu-20.04, windows-2022 ] 19 | runs-on: ${{ matrix.os }} 20 | steps: 21 | - name: checkout repository 22 | uses: actions/checkout@v2 23 | - name: validate gradle wrapper 24 | uses: gradle/wrapper-validation-action@v1 25 | - name: setup jdk ${{ matrix.java }} 26 | uses: actions/setup-java@v1 27 | with: 28 | java-version: ${{ matrix.java }} 29 | - name: make gradle wrapper executable 30 | if: ${{ runner.os != 'Windows' }} 31 | run: chmod +x ./gradlew 32 | - name: build 33 | run: ./gradlew build 34 | - name: capture build artifacts 35 | if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from latest java on one OS 36 | uses: actions/upload-artifact@v2 37 | with: 38 | name: thorium Artifacts 39 | # Don't copy the sources artifact, only the minecraft-compatible one. 40 | path: | 41 | build/libs/thorium-*.jar 42 | !build/libs/thorium-*-sources.jar 43 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # gradle 2 | 3 | .gradle/ 4 | build/ 5 | out/ 6 | classes/ 7 | 8 | # eclipse 9 | 10 | *.launch 11 | 12 | # idea 13 | 14 | .idea/ 15 | *.iml 16 | *.ipr 17 | *.iws 18 | 19 | # vscode 20 | 21 | .settings/ 22 | .vscode/ 23 | bin/ 24 | .classpath 25 | .project 26 | 27 | # macos 28 | 29 | *.DS_Store 30 | 31 | # fabric 32 | 33 | run/ 34 | -------------------------------------------------------------------------------- /FIXED_ISSUES.md: -------------------------------------------------------------------------------- 1 | # Fixed issues 2 | 3 | You can find the full list of all issues fixed by thorium below. 4 | Please keep in mind that some fixes may (unintentionally) also fix similar issues. 5 | 6 | | Mojira Issue | Issue name | 7 | |-------------------------------------------------------|-------------------------------------------------------------------------------------------------------------| 8 | | [MC-4490](https://bugs.mojang.com/browse/MC-4490) | Fishing line not attached to fishing rod in third person while crouching | 9 | | [MC-6431](https://bugs.mojang.com/browse/MC-6431) | Status effects are lost when returning to the overworld from the exit end portal | 10 | | [MC-7569](https://bugs.mojang.com/browse/MC-7569) | RCON output has newlines removed | 11 | | [MC-12062](https://bugs.mojang.com/browse/MC-12062) | Hotbar selection resets to the far left when exiting the end | 12 | | [MC-35361](https://bugs.mojang.com/browse/MC-35361) | Inventory opening is detected while in Nether Portal | 13 | | [MC-46503](https://bugs.mojang.com/browse/MC-46503) | You can retain a mob's shader in spectator mode by running /kill | 14 | | [MC-46737](https://bugs.mojang.com/browse/MC-46737) | Spectating entities whilst in third person still applies the mob's shader | 15 | | [MC-46766](https://bugs.mojang.com/browse/MC-46766) | Mining a block in Survival, then changing to Spectator creates a breaking animation and sound | 16 | | [MC-55347](https://bugs.mojang.com/browse/MC-55347) | Title with long duration shows in other world | 17 | | [MC-62997](https://bugs.mojang.com/browse/MC-62997) | Scoreboard overlaps debug screen | 18 | | [MC-69216](https://bugs.mojang.com/browse/MC-69216) | Switching to spectator mode while fishing keeps rod cast | 19 | | [MC-75721](https://bugs.mojang.com/browse/MC-75721) | Arrow buttons within the book GUI are rendered above tooltips | 20 | | [MC-81773](https://bugs.mojang.com/browse/MC-81773) | Bows and tridents drawn in survival/creative/adventure mode can be released in spectator mode | 21 | | [MC-84661](https://bugs.mojang.com/browse/MC-84661) | Glowing is considered a positive effect in potion item tooltips | 22 | | [MC-86252](https://bugs.mojang.com/browse/MC-86252) | Shields stay blocking and allow left-clicking under a specific condition | 23 | | [MC-115092](https://bugs.mojang.com/browse/MC-115092) | Squid/glow squid named "Dinnerbone" or "Grumm" is not upside-down | 24 | | [MC-112730](https://bugs.mojang.com/browse/MC-112730) | Beacon beam and structure block render twice per frame | 25 | | [MC-119417](https://bugs.mojang.com/browse/MC-119417) | A spectator can occupy a bed if they enter it and then are switched to spectator mode | 26 | | [MC-123605](https://bugs.mojang.com/browse/MC-123605) | Debug world still sets clear weather time instead of deactivating gamerule doWeatherCycle | 27 | | [MC-123450](https://bugs.mojang.com/browse/MC-123450) | Item frames play sound when item frame item is read from NBT | 28 | | [MC-127970](https://bugs.mojang.com/browse/MC-127970) | Using riptide on a trident with an item in your off-hand causes visual glitch with the item in your offhand | 29 | | [MC-129909](https://bugs.mojang.com/browse/MC-129909) | Players in spectator mode continue to consume foods and liquids shortly after switching game modes | 30 | | [MC-139041](https://bugs.mojang.com/browse/MC-139041) | The sounds of fishing bobbers aren't controlled by the "Players" sound slider | 31 | | [MC-143474](https://bugs.mojang.com/browse/MC-143474) | Respawning causes your hotbar to reset to the first space | 32 | | [MC-144761](https://bugs.mojang.com/browse/MC-144761) | Animated texture interpolation ignores alpha channel during transition from/to transparent pixels | 33 | | [MC-147659](https://bugs.mojang.com/browse/MC-147659) | Some witch huts spawn the incorrect cat | 34 | | [MC-147766](https://bugs.mojang.com/browse/MC-147766) | Shift key stays pressed until press any other key | 35 | | [MC-148993](https://bugs.mojang.com/browse/MC-148993) | While spectating a player, chunks cannot be loaded | 36 | | [MC-159283](https://bugs.mojang.com/browse/MC-159283) | The End terrain does not generate in multiple rings centered around the world center | 37 | | [MC-165595](https://bugs.mojang.com/browse/MC-165595) | Guardian beam does not render when over a certain "Time" in level.dat | 38 | | [MC-168016](https://bugs.mojang.com/browse/MC-168016) | The sounds of pages in books rustling aren't controlled by any sound sliders | 39 | | [MC-170462](https://bugs.mojang.com/browse/MC-170462) | Bad Omen is considered a positive effect in potion item tooltips | 40 | | [MC-175622](https://bugs.mojang.com/browse/MC-175622) | Wolf's tail will spin 360 degrees if max health is increased | 41 | | [MC-176806](https://bugs.mojang.com/browse/MC-176806) | Scoreboard criteria for using glowstone doesn't increase score when charging a respawn anchor | 42 | | [MC-181412](https://bugs.mojang.com/browse/MC-181412) | Removing a jukebox with a command while its playing a music disc, then the music will continue playing | 43 | | [MC-184029](https://bugs.mojang.com/browse/MC-184029) | Clicking into the language list does not remove focus from the focused button | 44 | | [MC-193343](https://bugs.mojang.com/browse/MC-193343) | Soul speed effect remains after switching to spectator mode | 45 | | [MC-195732](https://bugs.mojang.com/browse/MC-195732) | Going through Nether/End Portal while eating food or item causes two food items to be consumed in total | 46 | | [MC-201723](https://bugs.mojang.com/browse/MC-201723) | Statistics sprites don't look pressed when clicked | 47 | | [MC-202637](https://bugs.mojang.com/browse/MC-202637) | Last sound clip of eating will still play when Players volume is set to 0% | 48 | | [MC-206705](https://bugs.mojang.com/browse/MC-206705) | Spyglasses stay in use in spectator mode | 49 | | [MC-210318](https://bugs.mojang.com/browse/MC-210318) | Maximum length of book title changed from 16 to 15 characters | 50 | | [MC-212926](https://bugs.mojang.com/browse/MC-212926) | Eating while entering a nether portal can auto skip the eating animation | 51 | | [MC-215530](https://bugs.mojang.com/browse/MC-215530) | The freezing effect isn't immediately removed when switching into spectator mode | 52 | | [MC-215531](https://bugs.mojang.com/browse/MC-215531) | The carved pumpkin overlay isn't removed when switching into spectator mode | 53 | | [MC-225364](https://bugs.mojang.com/browse/MC-225364) | Chorus flowers can be shot in adventure | 54 | | [MC-227169](https://bugs.mojang.com/browse/MC-227169) | The main hand is broken when you hold a crossbow loaded into the secondary hand | 55 | | [MC-227337](https://bugs.mojang.com/browse/MC-227337) | When a shulker bullet hits an entity, the explodes sound is not played and particles are not produced | 56 | | [MC-237843](https://bugs.mojang.com/browse/MC-237843) | Players can be idle kicked whilst viewing the end credits | 57 | | [MC-244948](https://bugs.mojang.com/browse/MC-244948) | The minecraft:item.bundle.remove_one sound plays even when no items are unpacked from bundles | 58 | | [MC-245394](https://bugs.mojang.com/browse/MC-245394) | The sounds of raid horns blaring aren't controlled by the correct sound slider | 59 | | [MC-252934](https://bugs.mojang.com/browse/MC-252934) | Placing structures with item frames logs "Hanging entity at invalid position: BlockPosition" | 60 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | 9 | This version of the GNU Lesser General Public License incorporates 10 | the terms and conditions of version 3 of the GNU General Public 11 | License, supplemented by the additional permissions listed below. 12 | 13 | 0. Additional Definitions. 14 | 15 | As used herein, "this License" refers to version 3 of the GNU Lesser 16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU 17 | General Public License. 18 | 19 | "The Library" refers to a covered work governed by this License, 20 | other than an Application or a Combined Work as defined below. 21 | 22 | An "Application" is any work that makes use of an interface provided 23 | by the Library, but which is not otherwise based on the Library. 24 | Defining a subclass of a class defined by the Library is deemed a mode 25 | of using an interface provided by the Library. 26 | 27 | A "Combined Work" is a work produced by combining or linking an 28 | Application with the Library. The particular version of the Library 29 | with which the Combined Work was made is also called the "Linked 30 | Version". 31 | 32 | The "Minimal Corresponding Source" for a Combined Work means the 33 | Corresponding Source for the Combined Work, excluding any source code 34 | for portions of the Combined Work that, considered in isolation, are 35 | based on the Application, and not on the Linked Version. 36 | 37 | The "Corresponding Application Code" for a Combined Work means the 38 | object code and/or source code for the Application, including any data 39 | and utility programs needed for reproducing the Combined Work from the 40 | Application, but excluding the System Libraries of the Combined Work. 41 | 42 | 1. Exception to Section 3 of the GNU GPL. 43 | 44 | You may convey a covered work under sections 3 and 4 of this License 45 | without being bound by section 3 of the GNU GPL. 46 | 47 | 2. Conveying Modified Versions. 48 | 49 | If you modify a copy of the Library, and, in your modifications, a 50 | facility refers to a function or data to be supplied by an Application 51 | that uses the facility (other than as an argument passed when the 52 | facility is invoked), then you may convey a copy of the modified 53 | version: 54 | 55 | a) under this License, provided that you make a good faith effort to 56 | ensure that, in the event an Application does not supply the 57 | function or data, the facility still operates, and performs 58 | whatever part of its purpose remains meaningful, or 59 | 60 | b) under the GNU GPL, with none of the additional permissions of 61 | this License applicable to that copy. 62 | 63 | 3. Object Code Incorporating Material from Library Header Files. 64 | 65 | The object code form of an Application may incorporate material from 66 | a header file that is part of the Library. You may convey such object 67 | code under terms of your choice, provided that, if the incorporated 68 | material is not limited to numerical parameters, data structure 69 | layouts and accessors, or small macros, inline functions and templates 70 | (ten or fewer lines in length), you do both of the following: 71 | 72 | a) Give prominent notice with each copy of the object code that the 73 | Library is used in it and that the Library and its use are 74 | covered by this License. 75 | 76 | b) Accompany the object code with a copy of the GNU GPL and this license 77 | document. 78 | 79 | 4. Combined Works. 80 | 81 | You may convey a Combined Work under terms of your choice that, 82 | taken together, effectively do not restrict modification of the 83 | portions of the Library contained in the Combined Work and reverse 84 | engineering for debugging such modifications, if you also do each of 85 | the following: 86 | 87 | a) Give prominent notice with each copy of the Combined Work that 88 | the Library is used in it and that the Library and its use are 89 | covered by this License. 90 | 91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license 92 | document. 93 | 94 | c) For a Combined Work that displays copyright notices during 95 | execution, include the copyright notice for the Library among 96 | these notices, as well as a reference directing the user to the 97 | copies of the GNU GPL and this license document. 98 | 99 | d) Do one of the following: 100 | 101 | 0) Convey the Minimal Corresponding Source under the terms of this 102 | License, and the Corresponding Application Code in a form 103 | suitable for, and under terms that permit, the user to 104 | recombine or relink the Application with a modified version of 105 | the Linked Version to produce a modified Combined Work, in the 106 | manner specified by section 6 of the GNU GPL for conveying 107 | Corresponding Source. 108 | 109 | 1) Use a suitable shared library mechanism for linking with the 110 | Library. A suitable mechanism is one that (a) uses at run time 111 | a copy of the Library already present on the user's computer 112 | system, and (b) will operate properly with a modified version 113 | of the Library that is interface-compatible with the Linked 114 | Version. 115 | 116 | e) Provide Installation Information, but only if you would otherwise 117 | be required to provide such information under section 6 of the 118 | GNU GPL, and only to the extent that such information is 119 | necessary to install and execute a modified version of the 120 | Combined Work produced by recombining or relinking the 121 | Application with a modified version of the Linked Version. (If 122 | you use option 4d0, the Installation Information must accompany 123 | the Minimal Corresponding Source and Corresponding Application 124 | Code. If you use option 4d1, you must provide the Installation 125 | Information in the manner specified by section 6 of the GNU GPL 126 | for conveying Corresponding Source.) 127 | 128 | 5. Combined Libraries. 129 | 130 | You may place library facilities that are a work based on the 131 | Library side by side in a single library together with other library 132 | facilities that are not Applications and are not covered by this 133 | License, and convey such a combined library under terms of your 134 | choice, if you do both of the following: 135 | 136 | a) Accompany the combined library with a copy of the same work based 137 | on the Library, uncombined with any other library facilities, 138 | conveyed under the terms of this License. 139 | 140 | b) Give prominent notice with the combined library that part of it 141 | is a work based on the Library, and explaining where to find the 142 | accompanying uncombined form of the same work. 143 | 144 | 6. Revised Versions of the GNU Lesser General Public License. 145 | 146 | The Free Software Foundation may publish revised and/or new versions 147 | of the GNU Lesser General Public License from time to time. Such new 148 | versions will be similar in spirit to the present version, but may 149 | differ in detail to address new problems or concerns. 150 | 151 | Each version is given a distinguishing version number. If the 152 | Library as you received it specifies that a certain numbered version 153 | of the GNU Lesser General Public License "or any later version" 154 | applies to it, you have the option of following the terms and 155 | conditions either of that published version or of any later version 156 | published by the Free Software Foundation. If the Library as you 157 | received it does not specify a version number of the GNU Lesser 158 | General Public License, you may choose any version of the GNU Lesser 159 | General Public License ever published by the Free Software Foundation. 160 | 161 | If the Library as you received it specifies that a proxy can decide 162 | whether future versions of the GNU Lesser General Public License shall 163 | apply, that proxy's public statement of acceptance of any version is 164 | permanent authorization for you to choose that version for the 165 | Library. 166 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | thorium Icon 2 | 3 | # thorium 4 | 5 | [![Discord Shield](https://discordapp.com/api/guilds/938463953644847205/widget.png?style=shield)](https://discord.gg/bXG8H6PVuS) 6 | [![Build Status](https://img.shields.io/github/actions/workflow/status/PotassiumMC/thorium/build.yml?branch=master)](https://github.com/PotassiumMC/thorium/actions) 7 | [![License](https://img.shields.io/github/license/PotassiumMC/thorium)](https://github.com/PotassiumMC/thorium/blob/master/LICENSE) 8 | [![Latest Release](https://img.shields.io/github/v/release/PotassiumMC/thorium)](https://github.com/PotassiumMC/thorium/releases) 9 | [![CurseForge Download Count](https://cf.way2muchnoise.eu/full_thorium_downloads.svg)](https://www.curseforge.com/minecraft/mc-mods/thorium) 10 | [![Modrinth Download Count](https://img.shields.io/modrinth/dt/ImUQFWcy?label=modrinth%20downloads)](https://modrinth.com/mod/thorium) 11 | 12 | thorium is a fabric mod that fixes 50+ small bugs and annoyances in Minecraft, without affecting gameplay mechanics. 13 | Check out [this list](FIXED_ISSUES.md) to view all issues thorium fixes! 14 | 15 | Because thorium does not affect gameplay mechanics, it is not a hard requirement to have installed on the client or the 16 | server when joining a server. 17 | However, we still recommend installing it on both, since not all issues can be fixed on the server (or client) side. 18 | 19 | If you have encountered an issue or would like to request a fix for a Minecraft bug, please create an issue on 20 | our [issue tracker](https://github.com/PotassiumMC/thorium/issues/new/choose). 21 | 22 | For support, check out our [Discord](https://discord.gg/bXG8H6PVuS) 23 | or [IRC Channels](https://webchat.esper.net/?channels=potassium)! 24 | 25 | ## Special Thanks To 26 | 27 | ![YourKit Logo](https://www.yourkit.com/images/yklogo.png) 28 | 29 | YourKit supports open source projects with innovative and intelligent tools 30 | for monitoring and profiling Java and .NET applications. 31 | YourKit is the creator of [YourKit Java Profiler](https://www.yourkit.com/java/profiler/), 32 | [YourKit .NET Profiler](https://www.yourkit.com/.net/profiler/), 33 | and [YourKit YouMonitor](ttps://www.yourkit.com/youmonitor/). 34 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'fabric-loom' version '0.12-SNAPSHOT' 3 | id 'maven-publish' 4 | } 5 | 6 | sourceCompatibility = JavaVersion.VERSION_17 7 | targetCompatibility = JavaVersion.VERSION_17 8 | 9 | archivesBaseName = project.archives_base_name 10 | version = project.mod_version 11 | group = project.maven_group 12 | 13 | repositories { 14 | // Add repositories to retrieve artifacts from in here. 15 | // You should only use this when depending on other mods because 16 | // Loom adds the essential maven repositories to download Minecraft and libraries from automatically. 17 | // See https://docs.gradle.org/current/userguide/declaring_repositories.html 18 | // for more information about repositories. 19 | 20 | maven { 21 | name = "stellardriftSnapshots" 22 | url = uri("https://repo.stellardrift.ca/repository/snapshots/") 23 | mavenContent { snapshotsOnly() } 24 | } 25 | } 26 | 27 | dependencies { 28 | // To change the versions see the gradle.properties file 29 | minecraft "com.mojang:minecraft:${project.minecraft_version}" 30 | mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" 31 | modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" 32 | 33 | // TODO Fix this so we don't have to manually include configurate's dependencies 34 | modImplementation include("org.spongepowered:configurate-core:4.1.2") 35 | modImplementation include("org.spongepowered:configurate-hocon:4.1.2") 36 | modImplementation include("com.typesafe:config:1.4.2") 37 | modImplementation include("io.leangen.geantyref:geantyref:1.3.13") 38 | } 39 | 40 | processResources { 41 | inputs.property "version", project.version 42 | 43 | filesMatching("fabric.mod.json") { 44 | expand "version": project.version 45 | } 46 | } 47 | 48 | tasks.withType(JavaCompile).configureEach { 49 | // Minecraft 1.18 (1.18-pre2) upwards uses Java 17. 50 | it.options.release = 17 51 | } 52 | 53 | java { 54 | // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task 55 | // if it is present. 56 | // If you remove this line, sources will not be generated. 57 | withSourcesJar() 58 | } 59 | 60 | loom { 61 | accessWidenerPath = file("src/main/resources/thorium.accesswidener") 62 | } 63 | 64 | jar { 65 | from("LICENSE") { 66 | rename { "${it}_${project.archivesBaseName}" } 67 | } 68 | } 69 | 70 | // configure the maven publication 71 | publishing { 72 | publications { 73 | mavenJava(MavenPublication) { 74 | from components.java 75 | } 76 | } 77 | 78 | // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. 79 | repositories { 80 | // Add repositories to publish to here. 81 | // Notice: This block does NOT have the same function as the block in the top level. 82 | // The repositories here will be used for publishing your artifact, not for 83 | // retrieving dependencies. 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Done to increase the memory available to gradle. 2 | org.gradle.jvmargs=-Xmx1G 3 | 4 | # Fabric Properties 5 | # check these on https://fabricmc.net/develop 6 | minecraft_version=1.19.3 7 | yarn_mappings=1.19.3+build.2 8 | loader_version=0.14.11 9 | 10 | # Mod Properties 11 | mod_version=1.4.0+DEV 12 | maven_group=io.github.potassiummc.thorium 13 | archives_base_name=thorium 14 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PotassiumMC/thorium/3fbcf371965e6fcb7830eefe65b9f693c216403d/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip 4 | networkTimeout=10000 5 | zipStoreBase=GRADLE_USER_HOME 6 | zipStorePath=wrapper/dists 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | # 21 | # Gradle start up script for POSIX generated by Gradle. 22 | # 23 | # Important for running: 24 | # 25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 26 | # noncompliant, but you have some other compliant shell such as ksh or 27 | # bash, then to run this script, type that shell name before the whole 28 | # command line, like: 29 | # 30 | # ksh Gradle 31 | # 32 | # Busybox and similar reduced shells will NOT work, because this script 33 | # requires all of these POSIX shell features: 34 | # * functions; 35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 37 | # * compound commands having a testable exit status, especially «case»; 38 | # * various built-in commands including «command», «set», and «ulimit». 39 | # 40 | # Important for patching: 41 | # 42 | # (2) This script targets any POSIX shell, so it avoids extensions provided 43 | # by Bash, Ksh, etc; in particular arrays are avoided. 44 | # 45 | # The "traditional" practice of packing multiple parameters into a 46 | # space-separated string is a well documented source of bugs and security 47 | # problems, so this is (mostly) avoided, by progressively accumulating 48 | # options in "$@", and eventually passing that to Java. 49 | # 50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 52 | # see the in-line comments for details. 53 | # 54 | # There are tweaks for specific operating systems such as AIX, CygWin, 55 | # Darwin, MinGW, and NonStop. 56 | # 57 | # (3) This script is generated from the Groovy template 58 | # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 59 | # within the Gradle project. 60 | # 61 | # You can find Gradle at https://github.com/gradle/gradle/. 62 | # 63 | ############################################################################## 64 | 65 | # Attempt to set APP_HOME 66 | 67 | # Resolve links: $0 may be a link 68 | app_path=$0 69 | 70 | # Need this for daisy-chained symlinks. 71 | while 72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 73 | [ -h "$app_path" ] 74 | do 75 | ls=$( ls -ld "$app_path" ) 76 | link=${ls#*' -> '} 77 | case $link in #( 78 | /*) app_path=$link ;; #( 79 | *) app_path=$APP_HOME$link ;; 80 | esac 81 | done 82 | 83 | # This is normally unused 84 | # shellcheck disable=SC2034 85 | APP_BASE_NAME=${0##*/} 86 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit 87 | 88 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 89 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 90 | 91 | # Use the maximum available, or set MAX_FD != -1 to use that value. 92 | MAX_FD=maximum 93 | 94 | warn () { 95 | echo "$*" 96 | } >&2 97 | 98 | die () { 99 | echo 100 | echo "$*" 101 | echo 102 | exit 1 103 | } >&2 104 | 105 | # OS specific support (must be 'true' or 'false'). 106 | cygwin=false 107 | msys=false 108 | darwin=false 109 | nonstop=false 110 | case "$( uname )" in #( 111 | CYGWIN* ) cygwin=true ;; #( 112 | Darwin* ) darwin=true ;; #( 113 | MSYS* | MINGW* ) msys=true ;; #( 114 | NONSTOP* ) nonstop=true ;; 115 | esac 116 | 117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 118 | 119 | 120 | # Determine the Java command to use to start the JVM. 121 | if [ -n "$JAVA_HOME" ] ; then 122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 123 | # IBM's JDK on AIX uses strange locations for the executables 124 | JAVACMD=$JAVA_HOME/jre/sh/java 125 | else 126 | JAVACMD=$JAVA_HOME/bin/java 127 | fi 128 | if [ ! -x "$JAVACMD" ] ; then 129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 130 | 131 | Please set the JAVA_HOME variable in your environment to match the 132 | location of your Java installation." 133 | fi 134 | else 135 | JAVACMD=java 136 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 137 | 138 | Please set the JAVA_HOME variable in your environment to match the 139 | location of your Java installation." 140 | fi 141 | 142 | # Increase the maximum file descriptors if we can. 143 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 144 | case $MAX_FD in #( 145 | max*) 146 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. 147 | # shellcheck disable=SC3045 148 | MAX_FD=$( ulimit -H -n ) || 149 | warn "Could not query maximum file descriptor limit" 150 | esac 151 | case $MAX_FD in #( 152 | '' | soft) :;; #( 153 | *) 154 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. 155 | # shellcheck disable=SC3045 156 | ulimit -n "$MAX_FD" || 157 | warn "Could not set maximum file descriptor limit to $MAX_FD" 158 | esac 159 | fi 160 | 161 | # Collect all arguments for the java command, stacking in reverse order: 162 | # * args from the command line 163 | # * the main class name 164 | # * -classpath 165 | # * -D...appname settings 166 | # * --module-path (only if needed) 167 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 168 | 169 | # For Cygwin or MSYS, switch paths to Windows format before running java 170 | if "$cygwin" || "$msys" ; then 171 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 172 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 173 | 174 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 175 | 176 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 177 | for arg do 178 | if 179 | case $arg in #( 180 | -*) false ;; # don't mess with options #( 181 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 182 | [ -e "$t" ] ;; #( 183 | *) false ;; 184 | esac 185 | then 186 | arg=$( cygpath --path --ignore --mixed "$arg" ) 187 | fi 188 | # Roll the args list around exactly as many times as the number of 189 | # args, so each arg winds up back in the position where it started, but 190 | # possibly modified. 191 | # 192 | # NB: a `for` loop captures its iteration list before it begins, so 193 | # changing the positional parameters here affects neither the number of 194 | # iterations, nor the values presented in `arg`. 195 | shift # remove old arg 196 | set -- "$@" "$arg" # push replacement arg 197 | done 198 | fi 199 | 200 | # Collect all arguments for the java command; 201 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of 202 | # shell script including quotes and variable substitutions, so put them in 203 | # double quotes to make sure that they get re-expanded; and 204 | # * put everything else in single quotes, so that it's not re-expanded. 205 | 206 | set -- \ 207 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 208 | -classpath "$CLASSPATH" \ 209 | org.gradle.wrapper.GradleWrapperMain \ 210 | "$@" 211 | 212 | # Stop when "xargs" is not available. 213 | if ! command -v xargs >/dev/null 2>&1 214 | then 215 | die "xargs is not available" 216 | fi 217 | 218 | # Use "xargs" to parse quoted args. 219 | # 220 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 221 | # 222 | # In Bash we could simply go: 223 | # 224 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 225 | # set -- "${ARGS[@]}" "$@" 226 | # 227 | # but POSIX shell has neither arrays nor command substitution, so instead we 228 | # post-process each arg (as a line of input to sed) to backslash-escape any 229 | # character that might be a shell metacharacter, then use eval to reverse 230 | # that process (while maintaining the separation between arguments), and wrap 231 | # the whole thing up as a single "set" statement. 232 | # 233 | # This will of course break if any of these variables contains a newline or 234 | # an unmatched quote. 235 | # 236 | 237 | eval "set -- $( 238 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 239 | xargs -n1 | 240 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 241 | tr '\n' ' ' 242 | )" '"$@"' 243 | 244 | exec "$JAVACMD" "$@" 245 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%"=="" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%"=="" set DIRNAME=. 29 | @rem This is normally unused 30 | set APP_BASE_NAME=%~n0 31 | set APP_HOME=%DIRNAME% 32 | 33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 35 | 36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 38 | 39 | @rem Find java.exe 40 | if defined JAVA_HOME goto findJavaFromJavaHome 41 | 42 | set JAVA_EXE=java.exe 43 | %JAVA_EXE% -version >NUL 2>&1 44 | if %ERRORLEVEL% equ 0 goto execute 45 | 46 | echo. 47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 48 | echo. 49 | echo Please set the JAVA_HOME variable in your environment to match the 50 | echo location of your Java installation. 51 | 52 | goto fail 53 | 54 | :findJavaFromJavaHome 55 | set JAVA_HOME=%JAVA_HOME:"=% 56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 57 | 58 | if exist "%JAVA_EXE%" goto execute 59 | 60 | echo. 61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 62 | echo. 63 | echo Please set the JAVA_HOME variable in your environment to match the 64 | echo location of your Java installation. 65 | 66 | goto fail 67 | 68 | :execute 69 | @rem Setup the command line 70 | 71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 72 | 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if %ERRORLEVEL% equ 0 goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | set EXIT_CODE=%ERRORLEVEL% 85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 87 | exit /b %EXIT_CODE% 88 | 89 | :mainEnd 90 | if "%OS%"=="Windows_NT" endlocal 91 | 92 | :omega 93 | -------------------------------------------------------------------------------- /scripts/getFixedIssues.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | README_PATH="${BASH_SOURCE%/*}/../FIXED_ISSUES.md" 4 | MOJIRA_ISSUE_REGEX="\\[MC-[0-9]*\\]" 5 | MOJIRA_ENDPOINT="https://bugs.mojang.com/" 6 | ISSUE_DELAY=0.25 7 | declare -i unfixed=0 8 | declare -i fixed=0 9 | declare -i total=0 10 | 11 | echo "Checking for fixed issues..." 12 | 13 | for issue in $(cat $README_PATH | grep -o $MOJIRA_ISSUE_REGEX) 14 | do 15 | issue_id=$(echo $issue | sed 's:^.\(.*\).$:\1:') 16 | mojira_response=$(curl -sX GET "${MOJIRA_ENDPOINT}rest/api/2/issue/${issue_id}?fields=status,fixVersions") 17 | issue_status=$(echo $mojira_response | jq -r '.fields.status.statusCategory.key') 18 | 19 | if [ $issue_status = "done" ] 20 | then 21 | resolved_in=$(echo $mojira_response | jq -r '.fields.fixVersions [0].name') 22 | echo "https://bugs.mojang.com/browse/${issue_id} has been resolved in ${resolved_in}!" 23 | fixed=$fixed+1 24 | else 25 | unfixed=$unfixed+1 26 | fi 27 | 28 | total=$total+1 29 | 30 | sleep $ISSUE_DELAY 31 | done 32 | 33 | echo "Done! Checked ${total} issues (${fixed} fixed, ${unfixed} unfixed)." 34 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | maven { 4 | name = 'Fabric' 5 | url = 'https://maven.fabricmc.net/' 6 | } 7 | mavenCentral() 8 | gradlePluginPortal() 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/Thorium.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium; 2 | 3 | import io.github.potassiummc.thorium.config.ThoriumConfig; 4 | import net.fabricmc.api.ModInitializer; 5 | import org.slf4j.Logger; 6 | import org.slf4j.LoggerFactory; 7 | 8 | public class Thorium implements ModInitializer { 9 | 10 | public static final Logger LOGGER = LoggerFactory.getLogger("thorium"); 11 | 12 | @Override 13 | public void onInitialize() { 14 | ThoriumConfig.getInstance().save(); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/ThoriumMixinPlugin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium; 2 | 3 | import io.github.potassiummc.thorium.config.ThoriumConfig; 4 | import net.minecraft.util.Pair; 5 | import org.jetbrains.annotations.Nullable; 6 | import org.objectweb.asm.tree.ClassNode; 7 | import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; 8 | import org.spongepowered.asm.mixin.extensibility.IMixinInfo; 9 | 10 | import java.util.List; 11 | import java.util.Set; 12 | import java.util.regex.Matcher; 13 | import java.util.regex.Pattern; 14 | 15 | public class ThoriumMixinPlugin implements IMixinConfigPlugin { 16 | 17 | private static final Pattern THORIUM_FIX_PATTERN = Pattern.compile("io\\.github\\.potassiummc\\.thorium\\.mixin\\.(client|server)\\.mc(\\d+)"); 18 | 19 | @Override 20 | public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { 21 | Pair bug = getBugFromFQN(mixinClassName); 22 | 23 | // This mixin doesn't belong to a specific bug (e.g. an accessor), so it should always be enabled. 24 | if (bug == null) { 25 | return true; 26 | } 27 | 28 | ThoriumConfig config = ThoriumConfig.getInstance(); 29 | config.loadIfUnloaded(); 30 | 31 | return config.isFixEnabled(bug.getLeft(), bug.getRight()); 32 | } 33 | 34 | @Nullable 35 | private Pair getBugFromFQN(String fqn) { 36 | Matcher matcher = THORIUM_FIX_PATTERN.matcher(fqn); 37 | 38 | if (!matcher.find()) { 39 | return null; 40 | } 41 | 42 | return new Pair<>(matcher.group(1), matcher.group(2)); 43 | } 44 | 45 | @Override 46 | public void onLoad(String mixinPackage) { 47 | } 48 | 49 | @Override 50 | public String getRefMapperConfig() { 51 | return null; 52 | } 53 | 54 | @Override 55 | public void acceptTargets(Set myTargets, Set otherTargets) { 56 | } 57 | 58 | @Override 59 | public List getMixins() { 60 | return null; 61 | } 62 | 63 | @Override 64 | public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) { 65 | } 66 | 67 | @Override 68 | public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) { 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/access/LanguageSelectionListWidgetAccess.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.access; 2 | 3 | import net.minecraft.client.gui.screen.option.LanguageOptionsScreen; 4 | 5 | public interface LanguageSelectionListWidgetAccess { 6 | 7 | LanguageOptionsScreen getLanguageOptionsScreen(); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/config/ThoriumConfig.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.config; 2 | 3 | import io.github.potassiummc.thorium.Thorium; 4 | import net.fabricmc.loader.api.FabricLoader; 5 | import org.spongepowered.configurate.CommentedConfigurationNode; 6 | import org.spongepowered.configurate.hocon.HoconConfigurationLoader; 7 | 8 | import java.io.IOException; 9 | import java.nio.file.Path; 10 | 11 | public class ThoriumConfig { 12 | 13 | private final static ThoriumConfig INSTANCE = new ThoriumConfig(); 14 | private final static String CLIENT_SIDE = "Client Side"; 15 | private final static String CLIENT_SIDE_COMMENT = "These fixes will only apply for you and will do nothing if the mod is installed on a dedicated server."; 16 | private final static String SERVER_SIDE = "Server Side"; 17 | private final static String SERVER_SIDE_COMMENT = "These fixes will apply for everyone connected to this dedicated server or LAN-opened world."; 18 | 19 | private final HoconConfigurationLoader loader = HoconConfigurationLoader.builder() 20 | .path(getConfigPath()) 21 | .build(); 22 | private CommentedConfigurationNode root; 23 | 24 | public void load() { 25 | try { 26 | root = loader.load(); 27 | } catch (IOException e) { 28 | Thorium.LOGGER.warn("Failed to load config!", e.getCause() == null ? e : e.getCause()); 29 | } 30 | } 31 | 32 | public void loadIfUnloaded() { 33 | if (root != null) { 34 | return; 35 | } 36 | 37 | load(); 38 | } 39 | 40 | public void save() { 41 | try { 42 | loader.save(root); 43 | } catch (IOException e) { 44 | Thorium.LOGGER.warn("Failed to save config!", e.getCause() == null ? e : e.getCause()); 45 | } 46 | } 47 | 48 | public boolean isFixEnabled(String rawSide, String bug) { 49 | boolean isClientSide = rawSide.equals("client"); 50 | String side = isClientSide ? CLIENT_SIDE : SERVER_SIDE; 51 | String comment = isClientSide ? CLIENT_SIDE_COMMENT : SERVER_SIDE_COMMENT; 52 | String bugName = "MC-" + bug; 53 | boolean enabledByDefault = enableFixesByDefault(); 54 | 55 | return root.node("Fixes").node(side).commentIfAbsent(comment).node(bugName).getBoolean(enabledByDefault); 56 | } 57 | 58 | public boolean enableFixesByDefault() { 59 | return root.node("Default For New Fixes").getBoolean(true); 60 | } 61 | 62 | public static ThoriumConfig getInstance() { 63 | return INSTANCE; 64 | } 65 | 66 | private static Path getConfigPath() { 67 | return Path.of(FabricLoader.getInstance().getConfigDir().toString(), "thorium", "thorium.conf"); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/access/ClientPlayerEntityInvoker.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.access; 2 | 3 | import net.minecraft.client.network.ClientPlayerEntity; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.gen.Invoker; 6 | 7 | @Mixin(ClientPlayerEntity.class) 8 | public interface ClientPlayerEntityInvoker { 9 | 10 | @Invoker("isCamera") 11 | boolean invokeIsCamera(); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/access/EntityAccessor.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.access; 2 | 3 | import net.minecraft.entity.Entity; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.gen.Accessor; 6 | 7 | @Mixin(Entity.class) 8 | public interface EntityAccessor { 9 | 10 | @Accessor("inNetherPortal") 11 | boolean inNetherPortal(); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/access/LivingEntityInvoker.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.access; 2 | 3 | import net.minecraft.entity.LivingEntity; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.gen.Invoker; 6 | 7 | @Mixin(LivingEntity.class) 8 | public interface LivingEntityInvoker { 9 | 10 | @Invoker("removeSoulSpeedBoost") 11 | void invokeRemoveSoulSpeedBoost(); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/client/mc112730/RebuildTaskMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.client.mc112730; 2 | 3 | import net.minecraft.block.entity.BlockEntity; 4 | import net.minecraft.client.render.block.entity.BlockEntityRenderer; 5 | import net.minecraft.client.render.chunk.ChunkBuilder; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.injection.At; 8 | import org.spongepowered.asm.mixin.injection.Inject; 9 | import org.spongepowered.asm.mixin.injection.Redirect; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 11 | import org.spongepowered.asm.mixin.injection.callback.LocalCapture; 12 | 13 | import java.util.List; 14 | 15 | @Mixin(net.minecraft.client.render.chunk.ChunkBuilder.BuiltChunk.RebuildTask.class) 16 | public class RebuildTaskMixin { 17 | 18 | @Redirect(method = "addBlockEntity(Lnet/minecraft/client/render/chunk/ChunkBuilder$BuiltChunk$RebuildTask$RenderData;Lnet/minecraft/block/entity/BlockEntity;)V", at = @At(value = "INVOKE", target = "Ljava/util/List;add(Ljava/lang/Object;)Z")) 19 | public boolean cancelBlockEntitiesAdd(List instance, Object e) { 20 | return false; 21 | } 22 | 23 | @Inject(method = "addBlockEntity(Lnet/minecraft/client/render/chunk/ChunkBuilder$BuiltChunk$RebuildTask$RenderData;Lnet/minecraft/block/entity/BlockEntity;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/block/entity/BlockEntityRenderer;rendersOutsideBoundingBox(Lnet/minecraft/block/entity/BlockEntity;)Z", shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD) 24 | public void addToChunkBlockEntityList(ChunkBuilder.BuiltChunk.RebuildTask.RenderData renderData, E blockEntity, CallbackInfo ci, BlockEntityRenderer blockEntityRenderer) { 25 | // Only add it to the *chunk* block entity list if it isn't already in the block entity renderer list. 26 | if (blockEntityRenderer.rendersOutsideBoundingBox(blockEntity)) { 27 | return; 28 | } 29 | renderData.blockEntities.add(blockEntity); 30 | } 31 | 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/client/mc115092/SquidEntityRendererMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.client.mc115092; 2 | 3 | import net.minecraft.client.render.entity.SquidEntityRenderer; 4 | import net.minecraft.client.util.math.MatrixStack; 5 | import net.minecraft.entity.passive.SquidEntity; 6 | import net.minecraft.util.math.RotationAxis; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 11 | 12 | @Mixin(SquidEntityRenderer.class) 13 | public class SquidEntityRendererMixin { 14 | 15 | // Based on code analysis by OMGItzAndrew: https://bugs.mojang.com/browse/MC-115092 16 | @Inject(method = "setupTransforms(Lnet/minecraft/entity/passive/SquidEntity;Lnet/minecraft/client/util/math/MatrixStack;FFF)V", at = @At("TAIL")) 17 | private void setupTransformsRotate(T squidEntity, MatrixStack matrixStack, float f, float g, float h, CallbackInfo ci) { 18 | String name = squidEntity.getName().getString(); 19 | 20 | if (name.equals("Dinnerbone") || name.equals("Grumm")) { 21 | matrixStack.translate(0.0D, squidEntity.getHeight() + 0.1F, 0.0D); 22 | matrixStack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(180.0F)); 23 | } 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/client/mc12062/ClientPlayNetworkHandlerMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.client.mc12062; 2 | 3 | import net.minecraft.client.network.ClientPlayNetworkHandler; 4 | import net.minecraft.client.network.ClientPlayerEntity; 5 | import net.minecraft.network.packet.s2c.play.PlayerRespawnS2CPacket; 6 | import net.minecraft.registry.RegistryKey; 7 | import net.minecraft.registry.entry.RegistryEntry; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | import org.spongepowered.asm.mixin.injection.Inject; 11 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 12 | import org.spongepowered.asm.mixin.injection.callback.LocalCapture; 13 | 14 | @Mixin(ClientPlayNetworkHandler.class) 15 | public class ClientPlayNetworkHandlerMixin { 16 | 17 | // Also fixes MC-143474 18 | @Inject(method = "onPlayerRespawn(Lnet/minecraft/network/packet/s2c/play/PlayerRespawnS2CPacket;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;setId(I)V", shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD) 19 | private void onPlayerRespawnSetInventorySlot(PlayerRespawnS2CPacket packet, CallbackInfo ci, RegistryKey registryKey, RegistryEntry registryEntry, ClientPlayerEntity oldClientPlayerEntity, int i, String string, ClientPlayerEntity newClientPlayerEntity) { 20 | newClientPlayerEntity.getInventory().selectedSlot = oldClientPlayerEntity.getInventory().selectedSlot; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/client/mc127970/HeldItemRendererMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.client.mc127970; 2 | 3 | import net.minecraft.client.network.AbstractClientPlayerEntity; 4 | import net.minecraft.client.render.VertexConsumerProvider; 5 | import net.minecraft.client.render.item.HeldItemRenderer; 6 | import net.minecraft.client.util.math.MatrixStack; 7 | import net.minecraft.item.ItemStack; 8 | import net.minecraft.item.Items; 9 | import net.minecraft.util.Hand; 10 | import org.spongepowered.asm.mixin.Mixin; 11 | import org.spongepowered.asm.mixin.injection.At; 12 | import org.spongepowered.asm.mixin.injection.Redirect; 13 | 14 | @Mixin(HeldItemRenderer.class) 15 | public class HeldItemRendererMixin { 16 | 17 | // Based on code analysis by null: https://bugs.mojang.com/browse/MC-127970?focusedCommentId=1129478#comment-1129478 18 | @Redirect(method = "renderFirstPersonItem(Lnet/minecraft/client/network/AbstractClientPlayerEntity;FFLnet/minecraft/util/Hand;FLnet/minecraft/item/ItemStack;FLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/AbstractClientPlayerEntity;isUsingRiptide()Z")) 19 | private boolean renderFirstPersonItemIsUsingRiptide(AbstractClientPlayerEntity player, AbstractClientPlayerEntity player1, float tickDelta, float pitch, Hand hand, float swingProgress, ItemStack item, float equipProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light) { 20 | return player.isUsingRiptide() && item.isOf(Items.TRIDENT); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/client/mc144761/InterpolationMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.client.mc144761; 2 | 3 | import net.minecraft.client.texture.NativeImage; 4 | import net.minecraft.client.texture.SpriteContents; 5 | import org.spongepowered.asm.mixin.Final; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.Shadow; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.Redirect; 11 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 12 | import org.spongepowered.asm.mixin.injection.callback.LocalCapture; 13 | 14 | import java.util.List; 15 | 16 | @Mixin(targets = "net.minecraft.client.texture.SpriteContents$Interpolation", priority = 1100) 17 | public abstract class InterpolationMixin { 18 | 19 | @Final 20 | @Shadow 21 | private NativeImage[] images; 22 | 23 | @Shadow 24 | protected abstract int lerp(double delta, int to, int from); 25 | 26 | // Based on code analysis by gudenau: https://bugs.mojang.com/browse/MC-144761?focusedCommentId=780425#comment-780425 27 | @Redirect(method = "apply(IILnet/minecraft/client/texture/SpriteContents$AnimatorImpl;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/texture/NativeImage;setColor(III)V")) 28 | public void cancelSetColor(NativeImage instance, int x, int y, int color) { 29 | } 30 | 31 | @Inject(method = "apply(IILnet/minecraft/client/texture/SpriteContents$AnimatorImpl;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/texture/NativeImage;setColor(III)V", shift = At.Shift.BEFORE), locals = LocalCapture.CAPTURE_FAILHARD) 32 | public void setColorWithLerpedAlpha(int a, int b, SpriteContents.AnimatorImpl animator, CallbackInfo ci, SpriteContents.Animation animation, List list, SpriteContents.AnimationFrame animationFrame, double delta, int i, int j, int k, int l, int m, int y, int x, int dest, int source, int red, int green, int blue) { 33 | int alpha = lerp(delta, (dest >>> 24) & 255, (source >>> 24) & 255); 34 | images[k].setColor(x, y, (alpha << 24) | (red << 16) | (green << 8) | blue); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/client/mc147766/TextFieldWidgetMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.client.mc147766; 2 | 3 | import net.minecraft.client.gui.screen.Screen; 4 | import net.minecraft.client.gui.widget.TextFieldWidget; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.Shadow; 7 | import org.spongepowered.asm.mixin.injection.At; 8 | import org.spongepowered.asm.mixin.injection.Inject; 9 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 10 | 11 | @Mixin(TextFieldWidget.class) 12 | public class TextFieldWidgetMixin { 13 | 14 | @Shadow 15 | private boolean selecting; 16 | 17 | @Inject(method = "setCursor(I)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/TextFieldWidget;setSelectionStart(I)V", shift = At.Shift.AFTER)) 18 | private void setCursorSetSelectionEnd(int cursor, CallbackInfo ci) { 19 | this.selecting = Screen.hasShiftDown(); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/client/mc148993/ClientPlayerEntityMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.client.mc148993; 2 | 3 | import io.github.potassiummc.thorium.mixin.access.ClientPlayerEntityInvoker; 4 | import net.minecraft.client.network.ClientPlayerEntity; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Redirect; 8 | 9 | @Mixin(ClientPlayerEntity.class) 10 | public class ClientPlayerEntityMixin { 11 | 12 | @Redirect(method = "sendMovementPackets()V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isCamera()Z")) 13 | private boolean sendMovementPacketsIsCameraOrSpectator(ClientPlayerEntity instance) { 14 | return ((ClientPlayerEntityInvoker) instance).invokeIsCamera() || instance.isSpectator(); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/client/mc165595/GuardianEntityRendererMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.client.mc165595; 2 | 3 | import net.minecraft.client.render.entity.GuardianEntityRenderer; 4 | import net.minecraft.world.World; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Redirect; 8 | 9 | @Mixin(value = GuardianEntityRenderer.class, priority = 900) 10 | public class GuardianEntityRendererMixin { 11 | 12 | @Redirect(method = "render(Lnet/minecraft/entity/mob/GuardianEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;getTime()J")) 13 | public long getTimeOfDay(World instance) { 14 | return instance.getTimeOfDay(); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/client/mc168016/PageTurnWidgetMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.client.mc168016; 2 | 3 | import net.minecraft.client.gui.widget.PageTurnWidget; 4 | import net.minecraft.client.sound.PositionedSoundInstance; 5 | import net.minecraft.client.sound.SoundInstance; 6 | import net.minecraft.sound.SoundCategory; 7 | import net.minecraft.sound.SoundEvent; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | import org.spongepowered.asm.mixin.injection.Redirect; 11 | 12 | @Mixin(PageTurnWidget.class) 13 | public class PageTurnWidgetMixin { 14 | 15 | @Redirect(method = "playDownSound(Lnet/minecraft/client/sound/SoundManager;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/sound/PositionedSoundInstance;master(Lnet/minecraft/sound/SoundEvent;F)Lnet/minecraft/client/sound/PositionedSoundInstance;")) 16 | public PositionedSoundInstance playDownSoundGetSound(SoundEvent sound, float pitch) { 17 | return new PositionedSoundInstance(sound.getId(), SoundCategory.PLAYERS, 0.25F, pitch, SoundInstance.createRandom(), false, 0, SoundInstance.AttenuationType.LINEAR, 0.0D, 0.0D, 0.0D, true); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/client/mc184029/LanguageEntryMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.client.mc184029; 2 | 3 | import io.github.potassiummc.thorium.access.LanguageSelectionListWidgetAccess; 4 | import net.minecraft.client.gui.Element; 5 | import net.minecraft.client.gui.screen.option.LanguageOptionsScreen; 6 | import org.spongepowered.asm.mixin.Final; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.Shadow; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | import org.spongepowered.asm.mixin.injection.Inject; 11 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 12 | 13 | @Mixin(LanguageOptionsScreen.LanguageSelectionListWidget.LanguageEntry.class) 14 | public class LanguageEntryMixin { 15 | 16 | @Final 17 | @Shadow 18 | LanguageOptionsScreen.LanguageSelectionListWidget field_19100; 19 | 20 | @Inject(method = "onPressed()V", at = @At("TAIL")) 21 | public void onPressedUnfocusOtherButtons(CallbackInfo ci) { 22 | Element focused = ((LanguageSelectionListWidgetAccess) field_19100).getLanguageOptionsScreen().getFocused(); 23 | if (focused == null) return; 24 | focused.changeFocus(false); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/client/mc184029/LanguageSelectionListWidgetMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.client.mc184029; 2 | 3 | import io.github.potassiummc.thorium.access.LanguageSelectionListWidgetAccess; 4 | import net.minecraft.client.gui.screen.option.LanguageOptionsScreen; 5 | import org.spongepowered.asm.mixin.Final; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.Shadow; 8 | 9 | @Mixin(LanguageOptionsScreen.LanguageSelectionListWidget.class) 10 | public class LanguageSelectionListWidgetMixin implements LanguageSelectionListWidgetAccess { 11 | 12 | @Final 13 | @Shadow 14 | LanguageOptionsScreen field_18744; 15 | 16 | public LanguageOptionsScreen getLanguageOptionsScreen() { 17 | return field_18744; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/client/mc201723/ItemStatsListWidgetMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.client.mc201723; 2 | 3 | import net.minecraft.client.MinecraftClient; 4 | import net.minecraft.client.Mouse; 5 | import net.minecraft.client.gui.screen.StatsScreen; 6 | import net.minecraft.client.gui.widget.AlwaysSelectedEntryListWidget; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.Shadow; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | import org.spongepowered.asm.mixin.injection.Redirect; 11 | 12 | @Mixin(net.minecraft.client.gui.screen.StatsScreen.ItemStatsListWidget.class) 13 | public class ItemStatsListWidgetMixin extends AlwaysSelectedEntryListWidget { 14 | 15 | @Shadow 16 | protected int selectedHeaderColumn; 17 | 18 | public ItemStatsListWidgetMixin(MinecraftClient minecraftClient, int i, int j, int k, int l, int m) { 19 | super(minecraftClient, i, j, k, l, m); 20 | } 21 | 22 | // Based on code analysis by ISRosillo14: https://bugs.mojang.com/browse/MC-201723 23 | @Redirect(method = "renderHeader(Lnet/minecraft/client/util/math/MatrixStack;IILnet/minecraft/client/render/Tessellator;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Mouse;wasLeftButtonClicked()Z")) 24 | private boolean renderHeaderWasLeftClicked(Mouse instance) { 25 | return true; 26 | } 27 | 28 | @Override 29 | public boolean mouseReleased(double mouseX, double mouseY, int button) { 30 | if (button == 0) { 31 | selectedHeaderColumn = -1; 32 | } 33 | 34 | return super.mouseReleased(mouseX, mouseY, button); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/client/mc210318/BookEditScreenMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.client.mc210318; 2 | 3 | import net.minecraft.client.gui.screen.ingame.BookEditScreen; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.injection.Constant; 6 | import org.spongepowered.asm.mixin.injection.ModifyConstant; 7 | 8 | @Mixin(BookEditScreen.class) 9 | public abstract class BookEditScreenMixin { 10 | 11 | @ModifyConstant(method = "method_27593(Ljava/lang/String;)Z", constant = @Constant(intValue = 16), allow = 1) 12 | private static int getCorrectMaxLength(int constant) { 13 | // <= 16 === < 17 14 | return 17; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/client/mc215531/InGameHudMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.client.mc215531; 2 | 3 | import net.minecraft.client.MinecraftClient; 4 | import net.minecraft.client.gui.hud.InGameHud; 5 | import net.minecraft.client.option.Perspective; 6 | import org.spongepowered.asm.mixin.Final; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.Shadow; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | import org.spongepowered.asm.mixin.injection.Redirect; 11 | 12 | @Mixin(InGameHud.class) 13 | public class InGameHudMixin { 14 | 15 | @Final 16 | @Shadow 17 | private MinecraftClient client; 18 | 19 | // Maybe servers somehow rely on this behaviour? If your server (ab)uses this bug, please make a GH issue. 20 | @Redirect(method = "render(Lnet/minecraft/client/util/math/MatrixStack;F)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/Perspective;isFirstPerson()Z")) 21 | private boolean renderIsFirstPersonOrSpectator(Perspective instance) { 22 | return instance.isFirstPerson() && !client.player.isSpectator(); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/client/mc227169/PlayerEntityRendererMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.client.mc227169; 2 | 3 | import net.minecraft.client.MinecraftClient; 4 | import net.minecraft.client.network.AbstractClientPlayerEntity; 5 | import net.minecraft.client.render.entity.PlayerEntityRenderer; 6 | import net.minecraft.client.render.entity.model.BipedEntityModel; 7 | import net.minecraft.util.Hand; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | import org.spongepowered.asm.mixin.injection.Inject; 11 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 12 | 13 | @Mixin(value = PlayerEntityRenderer.class, priority = 1100) 14 | public class PlayerEntityRendererMixin { 15 | 16 | @Inject(method = "getArmPose(Lnet/minecraft/client/network/AbstractClientPlayerEntity;Lnet/minecraft/util/Hand;)Lnet/minecraft/client/render/entity/model/BipedEntityModel$ArmPose;", at = @At(value = "FIELD", target = "Lnet/minecraft/client/render/entity/model/BipedEntityModel$ArmPose;CROSSBOW_HOLD:Lnet/minecraft/client/render/entity/model/BipedEntityModel$ArmPose;"), cancellable = true) 17 | private static void setArmPoseIfOffHand(AbstractClientPlayerEntity player, Hand hand, CallbackInfoReturnable cir) { 18 | // This issue happens because the game has already decided the hand position for the main hand before deciding 19 | // the crossbow orientation for the offhand. Because of this, the main hand will still appear, but in the wrong 20 | // rotation, which is intended to only be seen in third-person mode. 21 | // Thus, we should also keep the current arm pose if this is a different player, or if we're in third person mode. 22 | if (hand == Hand.MAIN_HAND || !player.isMainPlayer() || !MinecraftClient.getInstance().options.getPerspective().isFirstPerson()) { 23 | return; 24 | } 25 | 26 | cir.setReturnValue(BipedEntityModel.ArmPose.ITEM); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/client/mc35361/MinecraftClientMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.client.mc35361; 2 | 3 | import io.github.potassiummc.thorium.mixin.access.EntityAccessor; 4 | import net.minecraft.client.MinecraftClient; 5 | import net.minecraft.client.network.ClientPlayerEntity; 6 | import net.minecraft.client.tutorial.TutorialManager; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Redirect; 10 | 11 | @Mixin(MinecraftClient.class) 12 | public class MinecraftClientMixin { 13 | 14 | @Redirect(method = "handleInputEvents()V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/tutorial/TutorialManager;onInventoryOpened()V")) 15 | private void handleInputEventsOnInventoryOpened(TutorialManager instance) { 16 | ClientPlayerEntity me = ((MinecraftClient) (Object) this).player; 17 | // Don't call the 'event' if we're in a nether portal. 18 | if (((EntityAccessor) me).inNetherPortal()) return; 19 | 20 | instance.onInventoryOpened(); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/client/mc4490/FishingBobberEntityRendererMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.client.mc4490; 2 | 3 | import net.minecraft.client.render.entity.FishingBobberEntityRenderer; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.injection.Constant; 6 | import org.spongepowered.asm.mixin.injection.ModifyConstant; 7 | 8 | @Mixin(FishingBobberEntityRenderer.class) 9 | public abstract class FishingBobberEntityRendererMixin { 10 | 11 | @ModifyConstant(method = "render(Lnet/minecraft/entity/projectile/FishingBobberEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", constant = @Constant(floatValue = -0.1875F)) 12 | private float renderSneakOffset(float constant) { 13 | return -0.2875F; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/client/mc46503/ClientPlayNetworkHandlerMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.client.mc46503; 2 | 3 | import net.minecraft.client.MinecraftClient; 4 | import net.minecraft.client.network.ClientPlayNetworkHandler; 5 | import net.minecraft.network.packet.s2c.play.PlayerRespawnS2CPacket; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.injection.At; 8 | import org.spongepowered.asm.mixin.injection.Inject; 9 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 10 | 11 | @Mixin(ClientPlayNetworkHandler.class) 12 | public class ClientPlayNetworkHandlerMixin { 13 | 14 | // Maybe servers somehow rely on this behaviour? If your server (ab)uses this bug, please make a GH issue. 15 | @Inject(method = "onPlayerRespawn(Lnet/minecraft/network/packet/s2c/play/PlayerRespawnS2CPacket;)V", at = @At("TAIL")) 16 | private void onPlayerRespawnOnCameraEntitySet(PlayerRespawnS2CPacket packet, CallbackInfo ci) { 17 | MinecraftClient client = MinecraftClient.getInstance(); 18 | client.gameRenderer.onCameraEntitySet(client.player); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/client/mc46737/GameRendererMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.client.mc46737; 2 | 3 | import net.minecraft.client.render.GameRenderer; 4 | import net.minecraft.util.Identifier; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.Shadow; 7 | import org.spongepowered.asm.mixin.injection.At; 8 | import org.spongepowered.asm.mixin.injection.Redirect; 9 | 10 | @Mixin(GameRenderer.class) 11 | public abstract class GameRendererMixin { 12 | 13 | @Shadow 14 | abstract void loadPostProcessor(Identifier id); 15 | 16 | // Maybe servers somehow rely on this behaviour? If your server (ab)uses this bug, please make a GH issue. 17 | @Redirect(method = "onCameraEntitySet(Lnet/minecraft/entity/Entity;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/GameRenderer;loadPostProcessor(Lnet/minecraft/util/Identifier;)V")) 18 | private void onCameraEntitySetEarlyExit(GameRenderer instance, Identifier id) { 19 | if (!instance.getClient().options.getPerspective().isFirstPerson()) return; 20 | this.loadPostProcessor(id); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/client/mc46766/MinecraftClientMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.client.mc46766; 2 | 3 | import net.minecraft.block.BlockState; 4 | import net.minecraft.client.MinecraftClient; 5 | import net.minecraft.client.network.ClientPlayerEntity; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.injection.At; 8 | import org.spongepowered.asm.mixin.injection.Redirect; 9 | 10 | @Mixin(MinecraftClient.class) 11 | public class MinecraftClientMixin { 12 | 13 | @Redirect(method = "handleBlockBreaking(Z)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;isAir()Z")) 14 | private boolean handleBlockBreakingIsAirOrSpectator(BlockState instance) { 15 | ClientPlayerEntity me = ((MinecraftClient) (Object) this).player; 16 | // Pretend the block is air if we're a spectator. 17 | return instance.isAir() || me.isSpectator(); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/client/mc55347/ClientPlayNetworkHandlerMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.client.mc55347; 2 | 3 | import com.mojang.authlib.GameProfile; 4 | import net.minecraft.client.MinecraftClient; 5 | import net.minecraft.client.gui.screen.Screen; 6 | import net.minecraft.client.network.ClientPlayNetworkHandler; 7 | import net.minecraft.client.network.ServerInfo; 8 | import net.minecraft.client.util.telemetry.WorldSession; 9 | import net.minecraft.network.ClientConnection; 10 | import org.spongepowered.asm.mixin.Mixin; 11 | import org.spongepowered.asm.mixin.injection.At; 12 | import org.spongepowered.asm.mixin.injection.Inject; 13 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 14 | 15 | @Mixin(ClientPlayNetworkHandler.class) 16 | public class ClientPlayNetworkHandlerMixin { 17 | 18 | // We reset the title in the ctor, because the GameJoin packet is sent when the player switches worlds and proxied servers. 19 | @Inject(method = "", at = @At("TAIL")) 20 | private void onInitResetTitle(MinecraftClient client, Screen screen, ClientConnection connection, ServerInfo serverInfo, GameProfile profile, WorldSession worldSession, CallbackInfo ci) { 21 | client.inGameHud.clearTitle(); 22 | client.inGameHud.setDefaultTitleFade(); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/client/mc62997/InGameHudMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.client.mc62997; 2 | 3 | import net.minecraft.client.MinecraftClient; 4 | import net.minecraft.client.gui.hud.DebugHud; 5 | import net.minecraft.client.gui.hud.InGameHud; 6 | import net.minecraft.client.util.math.MatrixStack; 7 | import org.spongepowered.asm.mixin.Final; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.Shadow; 10 | import org.spongepowered.asm.mixin.injection.At; 11 | import org.spongepowered.asm.mixin.injection.Inject; 12 | import org.spongepowered.asm.mixin.injection.Redirect; 13 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 14 | 15 | @Mixin(InGameHud.class) 16 | public class InGameHudMixin { 17 | 18 | @Final 19 | @Shadow 20 | private MinecraftClient client; 21 | 22 | @Final 23 | @Shadow 24 | private DebugHud debugHud; 25 | 26 | @Redirect(method = "render(Lnet/minecraft/client/util/math/MatrixStack;F)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/DebugHud;render(Lnet/minecraft/client/util/math/MatrixStack;)V")) 27 | public void cancelEarlyDebugRender(DebugHud instance, MatrixStack matrices) { 28 | } 29 | 30 | @Inject(method = "render(Lnet/minecraft/client/util/math/MatrixStack;F)V", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;enableBlend()V", shift = At.Shift.BEFORE, ordinal = 4)) 31 | public void renderDebugScreenAfterScoreboard(MatrixStack matrices, float tickDelta, CallbackInfo ci) { 32 | if (this.client.options.debugEnabled) { 33 | this.debugHud.render(matrices); 34 | } 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/client/mc75721/BookScreenMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.client.mc75721; 2 | 3 | import net.minecraft.client.gui.screen.Screen; 4 | import net.minecraft.client.gui.screen.ingame.BookScreen; 5 | import net.minecraft.client.util.math.MatrixStack; 6 | import net.minecraft.text.Text; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.Redirect; 11 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 12 | 13 | @Mixin(BookScreen.class) 14 | public abstract class BookScreenMixin extends Screen { 15 | 16 | protected BookScreenMixin(Text title) { 17 | super(title); 18 | } 19 | 20 | // Based on code analysis by Tobi14601: https://bugs.mojang.com/browse/MC-75721?focusedCommentId=920466#comment-920466 21 | @Redirect(method = "render(Lnet/minecraft/client/util/math/MatrixStack;IIF)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;render(Lnet/minecraft/client/util/math/MatrixStack;IIF)V")) 22 | private void renderSuperAfterHover(Screen instance, MatrixStack matrices, int mouseX, int mouseY, float delta) { 23 | } 24 | 25 | @Inject(method = "render(Lnet/minecraft/client/util/math/MatrixStack;IIF)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/ingame/BookScreen;getTextStyleAt(DD)Lnet/minecraft/text/Style;", shift = At.Shift.BEFORE)) 26 | private void renderSuperBeforeHover(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) { 27 | super.render(matrices, mouseX, mouseY, delta); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/server/mc119417/ServerPlayerEntityMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.server.mc119417; 2 | 3 | import net.minecraft.server.network.ServerPlayerEntity; 4 | import net.minecraft.world.GameMode; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 9 | 10 | @Mixin(ServerPlayerEntity.class) 11 | public class ServerPlayerEntityMixin { 12 | 13 | @Inject(method = "changeGameMode(Lnet/minecraft/world/GameMode;)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayerEntity;stopRiding()V", shift = At.Shift.AFTER)) 14 | private void changeGameModeWakeUp(GameMode gameMode, CallbackInfoReturnable cir) { 15 | if (((ServerPlayerEntity) (Object) this).isSleeping()) { 16 | ((ServerPlayerEntity) (Object) this).wakeUp(true, true); 17 | } 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/server/mc123450/ItemFrameEntityMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.server.mc123450; 2 | 3 | import net.minecraft.entity.decoration.ItemFrameEntity; 4 | import net.minecraft.item.ItemStack; 5 | import net.minecraft.sound.SoundEvent; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.injection.At; 8 | import org.spongepowered.asm.mixin.injection.Redirect; 9 | 10 | @Mixin(ItemFrameEntity.class) 11 | public class ItemFrameEntityMixin { 12 | 13 | @Redirect(method = "setHeldItemStack(Lnet/minecraft/item/ItemStack;Z)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/decoration/ItemFrameEntity;playSound(Lnet/minecraft/sound/SoundEvent;FF)V")) 14 | private void setHeldItemStackPlaySound(ItemFrameEntity instance, SoundEvent soundEvent, float v, float p, ItemStack value, boolean update) { 15 | if (!update) return; 16 | instance.playSound(soundEvent, v, p); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/server/mc123605/MinecraftServerMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.server.mc123605; 2 | 3 | import net.minecraft.server.MinecraftServer; 4 | import net.minecraft.world.GameRules; 5 | import net.minecraft.world.level.ServerWorldProperties; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.injection.At; 8 | import org.spongepowered.asm.mixin.injection.Redirect; 9 | 10 | @Mixin(MinecraftServer.class) 11 | public class MinecraftServerMixin { 12 | 13 | @Redirect(method = "setToDebugWorldProperties(Lnet/minecraft/world/SaveProperties;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/ServerWorldProperties;setClearWeatherTime(I)V")) 14 | private void setDebugWorldPropertiesSetGamerule(ServerWorldProperties instance, int i) { 15 | instance.getGameRules().get(GameRules.DO_WEATHER_CYCLE).set(false, (MinecraftServer) (Object) this); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/server/mc139041/FishingRodItemMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.server.mc139041; 2 | 3 | import net.minecraft.item.FishingRodItem; 4 | import net.minecraft.sound.SoundCategory; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.ModifyArg; 8 | 9 | @Mixin(FishingRodItem.class) 10 | public class FishingRodItemMixin { 11 | 12 | @ModifyArg(method = "use(Lnet/minecraft/world/World;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/Hand;)Lnet/minecraft/util/TypedActionResult;", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;playSound(Lnet/minecraft/entity/player/PlayerEntity;DDDLnet/minecraft/sound/SoundEvent;Lnet/minecraft/sound/SoundCategory;FF)V"), index = 5) 13 | private SoundCategory playRaidHornMakeSoundPacket(SoundCategory sound) { 14 | return SoundCategory.PLAYERS; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/server/mc147659/CatSpawnerMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.server.mc147659; 2 | 3 | import net.minecraft.entity.passive.CatEntity; 4 | import net.minecraft.server.world.ServerWorld; 5 | import net.minecraft.util.math.BlockPos; 6 | import net.minecraft.world.spawner.CatSpawner; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.Redirect; 11 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 12 | import org.spongepowered.asm.mixin.injection.callback.LocalCapture; 13 | 14 | @Mixin(CatSpawner.class) 15 | public class CatSpawnerMixin { 16 | 17 | @Redirect(method = "spawn(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/server/world/ServerWorld;)I", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/passive/CatEntity;refreshPositionAndAngles(Lnet/minecraft/util/math/BlockPos;FF)V")) 18 | public void spawnCancelLateRefreshPos(CatEntity instance, BlockPos blockPos, float a, float b) { 19 | } 20 | 21 | @Inject(method = "spawn(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/server/world/ServerWorld;)I", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/passive/CatEntity;initialize(Lnet/minecraft/world/ServerWorldAccess;Lnet/minecraft/world/LocalDifficulty;Lnet/minecraft/entity/SpawnReason;Lnet/minecraft/entity/EntityData;Lnet/minecraft/nbt/NbtCompound;)Lnet/minecraft/entity/EntityData;", shift = At.Shift.BEFORE), locals = LocalCapture.CAPTURE_FAILHARD) 22 | public void spawnRefreshPosBeforeInit(BlockPos pos, ServerWorld world, CallbackInfoReturnable cir, CatEntity catEntity) { 23 | catEntity.refreshPositionAndAngles(pos, 0.0F, 0.0F); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/server/mc159283/EndIslandsMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.server.mc159283; 2 | 3 | import net.minecraft.util.math.MathHelper; 4 | import net.minecraft.util.math.noise.SimplexNoiseSampler; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Redirect; 8 | import org.spongepowered.asm.mixin.injection.Slice; 9 | 10 | @Mixin(targets = "net.minecraft.world.gen.densityfunction.DensityFunctionTypes$EndIslands") 11 | public class EndIslandsMixin { 12 | 13 | @Redirect(method = "sample(Lnet/minecraft/util/math/noise/SimplexNoiseSampler;II)F", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;sqrt(F)F"), slice = @Slice(to = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;clamp(FFF)F"))) 14 | private static float getNoiseAt(float value, SimplexNoiseSampler simplexNoiseSampler, int i, int j) { 15 | // Explicitly cast i and j to longs. 16 | return MathHelper.sqrt((long) i * (long) i + (long) j * (long) j); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/server/mc170462/StatusEffectsMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.server.mc170462; 2 | 3 | import net.minecraft.entity.effect.StatusEffectCategory; 4 | import net.minecraft.entity.effect.StatusEffects; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.ModifyArg; 8 | 9 | @Mixin(StatusEffects.class) 10 | public class StatusEffectsMixin { 11 | 12 | @ModifyArg(method = "()V", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/effect/StatusEffects$1;(Lnet/minecraft/entity/effect/StatusEffectCategory;I)V", ordinal = 0), index = 0) 13 | private static StatusEffectCategory createBadOmenEffectSetCategory(StatusEffectCategory category) { 14 | return StatusEffectCategory.HARMFUL; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/server/mc175622/WolfEntityMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.server.mc175622; 2 | 3 | import net.minecraft.entity.passive.WolfEntity; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.injection.At; 6 | import org.spongepowered.asm.mixin.injection.Inject; 7 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 8 | 9 | @Mixin(WolfEntity.class) 10 | public class WolfEntityMixin { 11 | 12 | @Inject(method = "getTailAngle()F", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/passive/WolfEntity;isTamed()Z", shift = At.Shift.BEFORE), cancellable = true) 13 | private void fixedGetTailAngleWhenNotAngry(CallbackInfoReturnable cir) { 14 | WolfEntity me = (WolfEntity) (Object) this; 15 | // New formula taken from tryashtar's comment: https://bugs.mojang.com/browse/MC-175622?focusedCommentId=1134847#comment-1134847 16 | cir.setReturnValue(me.isTamed() ? (0.15F + 0.4F * (me.getHealth() / me.getMaxHealth())) * 3.1415927F : 0.62831855F); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/server/mc176806/RespawnAnchorBlockMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.server.mc176806; 2 | 3 | import net.minecraft.block.BlockState; 4 | import net.minecraft.block.RespawnAnchorBlock; 5 | import net.minecraft.entity.player.PlayerEntity; 6 | import net.minecraft.item.ItemStack; 7 | import net.minecraft.stat.Stats; 8 | import net.minecraft.util.ActionResult; 9 | import net.minecraft.util.Hand; 10 | import net.minecraft.util.hit.BlockHitResult; 11 | import net.minecraft.util.math.BlockPos; 12 | import net.minecraft.world.World; 13 | import org.spongepowered.asm.mixin.Mixin; 14 | import org.spongepowered.asm.mixin.injection.At; 15 | import org.spongepowered.asm.mixin.injection.Inject; 16 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 17 | import org.spongepowered.asm.mixin.injection.callback.LocalCapture; 18 | 19 | @Mixin(RespawnAnchorBlock.class) 20 | public class RespawnAnchorBlockMixin { 21 | 22 | @Inject(method = "onUse(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/Hand;Lnet/minecraft/util/hit/BlockHitResult;)Lnet/minecraft/util/ActionResult;", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/RespawnAnchorBlock;charge(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)V", shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD) 23 | public void onUseAwardStat(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit, CallbackInfoReturnable cir, ItemStack itemInHand) { 24 | player.incrementStat(Stats.USED.getOrCreateStat(itemInHand.getItem())); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/server/mc181412/JukeboxBlockMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.server.mc181412; 2 | 3 | import net.minecraft.block.JukeboxBlock; 4 | import net.minecraft.util.math.BlockPos; 5 | import net.minecraft.world.World; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.injection.At; 8 | import org.spongepowered.asm.mixin.injection.Inject; 9 | import org.spongepowered.asm.mixin.injection.Redirect; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 11 | 12 | @Mixin(JukeboxBlock.class) 13 | public class JukeboxBlockMixin { 14 | 15 | @Redirect(method = "removeRecord(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;syncWorldEvent(ILnet/minecraft/util/math/BlockPos;I)V")) 16 | private void cancelLateWorldEvent(World instance, int i, BlockPos blockPos, int j) { 17 | } 18 | 19 | @Inject(method = "removeRecord(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/entity/JukeboxBlockEntity;getRecord()Lnet/minecraft/item/ItemStack;", shift = At.Shift.BEFORE)) 20 | private void callWorldEventEarlier(World world, BlockPos pos, CallbackInfo ci) { 21 | world.syncWorldEvent(1010, pos, 0); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/server/mc193343/ServerPlayerEntityMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.server.mc193343; 2 | 3 | import io.github.potassiummc.thorium.mixin.access.LivingEntityInvoker; 4 | import net.minecraft.server.network.ServerPlayerEntity; 5 | import net.minecraft.world.GameMode; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.injection.At; 8 | import org.spongepowered.asm.mixin.injection.Inject; 9 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 10 | 11 | @Mixin(ServerPlayerEntity.class) 12 | public class ServerPlayerEntityMixin { 13 | 14 | @Inject(method = "changeGameMode(Lnet/minecraft/world/GameMode;)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayerEntity;stopRiding()V", shift = At.Shift.AFTER)) 15 | private void changeGameModeRemoveSoulSpeed(GameMode gameMode, CallbackInfoReturnable cir) { 16 | ((LivingEntityInvoker) this).invokeRemoveSoulSpeedBoost(); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/server/mc202637/LivingEntityMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.server.mc202637; 2 | 3 | import net.minecraft.entity.LivingEntity; 4 | import net.minecraft.sound.SoundCategory; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.ModifyArg; 8 | 9 | @Mixin(LivingEntity.class) 10 | public class LivingEntityMixin { 11 | 12 | @ModifyArg(method = "eatFood(Lnet/minecraft/world/World;Lnet/minecraft/item/ItemStack;)Lnet/minecraft/item/ItemStack;", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;playSound(Lnet/minecraft/entity/player/PlayerEntity;DDDLnet/minecraft/sound/SoundEvent;Lnet/minecraft/sound/SoundCategory;FF)V"), index = 5) 13 | private SoundCategory eatFoodCorrectSoundCategory(SoundCategory category) { 14 | return SoundCategory.PLAYERS; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/server/mc215530/ServerPlayerEntityMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.server.mc215530; 2 | 3 | import net.minecraft.server.network.ServerPlayerEntity; 4 | import net.minecraft.world.GameMode; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 9 | 10 | @Mixin(ServerPlayerEntity.class) 11 | public class ServerPlayerEntityMixin { 12 | 13 | @Inject(method = "changeGameMode(Lnet/minecraft/world/GameMode;)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayerEntity;stopRiding()V", shift = At.Shift.AFTER)) 14 | private void changeGameModeResetFrozenTicks(GameMode gameMode, CallbackInfoReturnable cir) { 15 | ((ServerPlayerEntity) (Object) this).setFrozenTicks(0); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/server/mc225364/ChorusFlowerBlockMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.server.mc225364; 2 | 3 | import net.minecraft.block.BlockState; 4 | import net.minecraft.block.ChorusFlowerBlock; 5 | import net.minecraft.entity.player.PlayerEntity; 6 | import net.minecraft.entity.projectile.ProjectileEntity; 7 | import net.minecraft.util.hit.BlockHitResult; 8 | import net.minecraft.world.World; 9 | import org.spongepowered.asm.mixin.Mixin; 10 | import org.spongepowered.asm.mixin.injection.At; 11 | import org.spongepowered.asm.mixin.injection.Inject; 12 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 13 | 14 | @Mixin(ChorusFlowerBlock.class) 15 | public class ChorusFlowerBlockMixin { 16 | 17 | @Inject(method = "onProjectileHit(Lnet/minecraft/world/World;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/hit/BlockHitResult;Lnet/minecraft/entity/projectile/ProjectileEntity;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;breakBlock(Lnet/minecraft/util/math/BlockPos;ZLnet/minecraft/entity/Entity;)Z", shift = At.Shift.BEFORE), cancellable = true) 18 | private void onProjectileHitCheckMayBreak(World world, BlockState state, BlockHitResult hit, ProjectileEntity projectile, CallbackInfo ci) { 19 | if (!(projectile.getOwner() instanceof PlayerEntity player)) return; 20 | if (player.getAbilities().allowModifyWorld) return; 21 | 22 | // Cancel if we aren't allowed to build. 23 | ci.cancel(); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/server/mc227337/ShulkerBulletEntityMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.server.mc227337; 2 | 3 | import net.minecraft.entity.projectile.ShulkerBulletEntity; 4 | import net.minecraft.particle.ParticleTypes; 5 | import net.minecraft.server.world.ServerWorld; 6 | import net.minecraft.sound.SoundEvents; 7 | import net.minecraft.util.hit.EntityHitResult; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | import org.spongepowered.asm.mixin.injection.Inject; 11 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 12 | 13 | @Mixin(ShulkerBulletEntity.class) 14 | public class ShulkerBulletEntityMixin { 15 | 16 | @Inject(method = "onEntityHit(Lnet/minecraft/util/hit/EntityHitResult;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/projectile/ProjectileEntity;onEntityHit(Lnet/minecraft/util/hit/EntityHitResult;)V", shift = At.Shift.AFTER)) 17 | private void onEntityHitPlaySoundAndParticle(EntityHitResult entityHitResult, CallbackInfo ci) { 18 | // Based on code analysis by Avoma: https://bugs.mojang.com/browse/MC-227337?focusedCommentId=1135924#comment-1135924 19 | ShulkerBulletEntity me = (ShulkerBulletEntity) (Object) this; 20 | 21 | ((ServerWorld) me.world).spawnParticles(ParticleTypes.EXPLOSION, me.getX(), me.getY(), me.getZ(), 2, 0.2D, 0.2D, 0.2D, 0.0D); 22 | me.playSound(SoundEvents.ENTITY_SHULKER_BULLET_HIT, 1.0F, 1.0F); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/server/mc237843/ServerPlayNetworkHandlerMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.server.mc237843; 2 | 3 | import net.minecraft.server.network.ServerPlayNetworkHandler; 4 | import net.minecraft.server.network.ServerPlayerEntity; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.Shadow; 7 | import org.spongepowered.asm.mixin.injection.At; 8 | import org.spongepowered.asm.mixin.injection.Inject; 9 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 10 | 11 | @Mixin(ServerPlayNetworkHandler.class) 12 | public class ServerPlayNetworkHandlerMixin { 13 | 14 | @Shadow 15 | public ServerPlayerEntity player; 16 | 17 | @Inject(method = "tick()V", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayNetworkHandler;disconnect(Lnet/minecraft/text/Text;)V", shift = At.Shift.BEFORE, ordinal = 3), cancellable = true) 18 | private void tickIdleKick(CallbackInfo ci) { 19 | if (this.player.notInAnyWorld) { 20 | ci.cancel(); 21 | } 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/server/mc244948/BundleItemMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.server.mc244948; 2 | 3 | import net.minecraft.entity.Entity; 4 | import net.minecraft.entity.player.PlayerEntity; 5 | import net.minecraft.item.BundleItem; 6 | import net.minecraft.item.ItemStack; 7 | import net.minecraft.nbt.NbtCompound; 8 | import net.minecraft.nbt.NbtList; 9 | import net.minecraft.screen.slot.Slot; 10 | import net.minecraft.util.ClickType; 11 | import org.spongepowered.asm.mixin.Mixin; 12 | import org.spongepowered.asm.mixin.Shadow; 13 | import org.spongepowered.asm.mixin.injection.At; 14 | import org.spongepowered.asm.mixin.injection.Inject; 15 | import org.spongepowered.asm.mixin.injection.Redirect; 16 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 17 | 18 | @Mixin(BundleItem.class) 19 | public abstract class BundleItemMixin { 20 | 21 | @Shadow 22 | protected abstract void playRemoveOneSound(Entity entity); 23 | 24 | @Redirect(method = "onStackClicked(Lnet/minecraft/item/ItemStack;Lnet/minecraft/screen/slot/Slot;Lnet/minecraft/util/ClickType;Lnet/minecraft/entity/player/PlayerEntity;)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/BundleItem;playRemoveOneSound(Lnet/minecraft/entity/Entity;)V")) 25 | private void voidOriginalClickSound(BundleItem instance, Entity entity) { 26 | } 27 | 28 | @Inject(method = "onStackClicked(Lnet/minecraft/item/ItemStack;Lnet/minecraft/screen/slot/Slot;Lnet/minecraft/util/ClickType;Lnet/minecraft/entity/player/PlayerEntity;)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/BundleItem;playRemoveOneSound(Lnet/minecraft/entity/Entity;)V")) 29 | private void onlyPlayClickSoundIfBundleHasItems(ItemStack bundle, Slot slot, ClickType clickType, PlayerEntity player, CallbackInfoReturnable cir) { 30 | NbtCompound nbtCompound = bundle.getOrCreateNbt(); 31 | if (!(nbtCompound.get("Items") instanceof NbtList items)) return; 32 | if (items.isEmpty()) return; 33 | 34 | playRemoveOneSound(player); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/server/mc245394/RaidMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.server.mc245394; 2 | 3 | import net.minecraft.sound.SoundCategory; 4 | import net.minecraft.village.raid.Raid; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.ModifyArg; 8 | 9 | @Mixin(Raid.class) 10 | public class RaidMixin { 11 | 12 | @ModifyArg(method = "playRaidHorn(Lnet/minecraft/util/math/BlockPos;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/packet/s2c/play/PlaySoundS2CPacket;(Lnet/minecraft/registry/entry/RegistryEntry;Lnet/minecraft/sound/SoundCategory;DDDFFJ)V"), index = 1) 13 | private SoundCategory playRaidHornMakeSoundPacket(SoundCategory sound) { 14 | return SoundCategory.HOSTILE; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/server/mc252934/AbstractDecorationEntityMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.server.mc252934; 2 | 3 | import net.minecraft.entity.decoration.AbstractDecorationEntity; 4 | import org.slf4j.Logger; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Redirect; 8 | 9 | @Mixin(AbstractDecorationEntity.class) 10 | public class AbstractDecorationEntityMixin { 11 | 12 | // The position is corrected in the same tick the entity is spawned, no need to do it ourselves 13 | @Redirect(method= "readCustomDataFromNbt(Lnet/minecraft/nbt/NbtCompound;)V", at=@At(value="INVOKE", target="Lorg/slf4j/Logger;error(Ljava/lang/String;Ljava/lang/Object;)V")) 14 | public void readCustomDataCorrectBlockpos(Logger instance, String s, Object o) { 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/server/mc6431/PlayerManagerMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.server.mc6431; 2 | 3 | import net.minecraft.network.packet.s2c.play.EntityStatusEffectS2CPacket; 4 | import net.minecraft.server.PlayerManager; 5 | import net.minecraft.server.network.ServerPlayerEntity; 6 | import net.minecraft.server.world.ServerWorld; 7 | import net.minecraft.util.math.BlockPos; 8 | import net.minecraft.util.math.Vec3d; 9 | import net.minecraft.world.WorldProperties; 10 | import org.spongepowered.asm.mixin.Mixin; 11 | import org.spongepowered.asm.mixin.injection.At; 12 | import org.spongepowered.asm.mixin.injection.Inject; 13 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 14 | import org.spongepowered.asm.mixin.injection.callback.LocalCapture; 15 | 16 | import java.util.Optional; 17 | 18 | @Mixin(PlayerManager.class) 19 | public class PlayerManagerMixin { 20 | 21 | // Based on code analysis by PR0CESS: https://bugs.mojang.com/browse/MC-6431?focusedCommentId=1081896#comment-1081896 22 | @Inject(method = "respawnPlayer(Lnet/minecraft/server/network/ServerPlayerEntity;Z)Lnet/minecraft/server/network/ServerPlayerEntity;", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/PlayerManager;sendWorldInfo(Lnet/minecraft/server/network/ServerPlayerEntity;Lnet/minecraft/server/world/ServerWorld;)V", shift = At.Shift.BEFORE), locals = LocalCapture.CAPTURE_FAILHARD) 23 | private void respawnPlayerAddEffects(ServerPlayerEntity oldPlayer, boolean alive, CallbackInfoReturnable cir, BlockPos blockPos, float f, boolean bl, ServerWorld serverWorld, Optional optional, ServerWorld serverWorld2, ServerPlayerEntity newPlayer, boolean bl2, byte b, WorldProperties worldProperties) { 24 | newPlayer.getActiveStatusEffects().forEach((name, eff) -> newPlayer.networkHandler.sendPacket(new EntityStatusEffectS2CPacket(newPlayer.getId(), eff))); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/server/mc6431/ServerPlayerEntityMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.server.mc6431; 2 | 3 | import net.minecraft.server.network.ServerPlayerEntity; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.injection.At; 6 | import org.spongepowered.asm.mixin.injection.Inject; 7 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 8 | 9 | @Mixin(ServerPlayerEntity.class) 10 | public class ServerPlayerEntityMixin { 11 | 12 | // Based on code analysis by PR0CESS: https://bugs.mojang.com/browse/MC-6431?focusedCommentId=1081896#comment-1081896 13 | @Inject(method = "copyFrom(Lnet/minecraft/server/network/ServerPlayerEntity;Z)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayerEntity;setScore(I)V", shift = At.Shift.AFTER)) 14 | private void copyFromAddEffects(ServerPlayerEntity oldPlayer, boolean alive, CallbackInfo ci) { 15 | ((ServerPlayerEntity) (Object) this).getActiveStatusEffects().putAll(oldPlayer.getActiveStatusEffects()); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/server/mc69216/ServerPlayerEntityMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.server.mc69216; 2 | 3 | import net.minecraft.server.network.ServerPlayerEntity; 4 | import net.minecraft.world.GameMode; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 9 | 10 | @Mixin(ServerPlayerEntity.class) 11 | public class ServerPlayerEntityMixin { 12 | 13 | @Inject(method = "changeGameMode(Lnet/minecraft/world/GameMode;)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayerEntity;stopRiding()V", shift = At.Shift.AFTER)) 14 | private void changeGameModeRemoveFishingHook(GameMode gameMode, CallbackInfoReturnable cir) { 15 | ServerPlayerEntity me = (ServerPlayerEntity) (Object) this; 16 | if (me.fishHook != null) { 17 | me.fishHook.discard(); 18 | } 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/server/mc7569/RconCommandOutputMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.server.mc7569; 2 | 3 | import net.minecraft.server.rcon.RconCommandOutput; 4 | import net.minecraft.text.Text; 5 | import org.spongepowered.asm.mixin.Final; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.Shadow; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 11 | 12 | @Mixin(RconCommandOutput.class) 13 | public class RconCommandOutputMixin { 14 | 15 | @Final 16 | @Shadow 17 | private StringBuffer buffer; 18 | 19 | @Inject(method = "sendMessage(Lnet/minecraft/text/Text;)V", at = @At(value = "INVOKE", target = "Ljava/lang/StringBuffer;append(Ljava/lang/String;)Ljava/lang/StringBuffer;", shift = At.Shift.AFTER)) 20 | public void sendNewlineAfterMessage(Text message, CallbackInfo ci) { 21 | this.buffer.append("\n"); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/server/mc81773/ServerPlayerEntityMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.server.mc81773; 2 | 3 | import net.minecraft.server.network.ServerPlayerEntity; 4 | import net.minecraft.world.GameMode; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 9 | 10 | @Mixin(ServerPlayerEntity.class) 11 | public class ServerPlayerEntityMixin { 12 | 13 | // Also fixes MC-129909 and MC-206705 14 | @Inject(method = "changeGameMode(Lnet/minecraft/world/GameMode;)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayerEntity;stopRiding()V", shift = At.Shift.AFTER)) 15 | private void changeGameModeStopInteracting(GameMode gameMode, CallbackInfoReturnable cir) { 16 | ((ServerPlayerEntity) (Object) this).stopUsingItem(); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/server/mc84661/StatusEffectsMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.server.mc84661; 2 | 3 | import net.minecraft.entity.effect.StatusEffectCategory; 4 | import net.minecraft.entity.effect.StatusEffects; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.ModifyArg; 8 | 9 | @Mixin(StatusEffects.class) 10 | public class StatusEffectsMixin { 11 | 12 | @ModifyArg(method = "()V", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/effect/StatusEffect;(Lnet/minecraft/entity/effect/StatusEffectCategory;I)V", ordinal = 16), index = 0) 13 | private static StatusEffectCategory createGlowingEffectSetCategory(StatusEffectCategory category) { 14 | return StatusEffectCategory.HARMFUL; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/io/github/potassiummc/thorium/mixin/server/mc86252/ServerPlayerEntityMixin.java: -------------------------------------------------------------------------------- 1 | package io.github.potassiummc.thorium.mixin.server.mc86252; 2 | 3 | import net.minecraft.entity.Entity; 4 | import net.minecraft.server.network.ServerPlayerEntity; 5 | import net.minecraft.server.world.ServerWorld; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.injection.At; 8 | import org.spongepowered.asm.mixin.injection.Inject; 9 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 10 | 11 | @Mixin(ServerPlayerEntity.class) 12 | public class ServerPlayerEntityMixin { 13 | 14 | // Also fixes MC-195732 and MC-212926 15 | @Inject(method = "moveToWorld(Lnet/minecraft/server/world/ServerWorld;)Lnet/minecraft/entity/Entity;", at = @At("RETURN")) 16 | private void moveToWorldStopUsingItem(ServerWorld destination, CallbackInfoReturnable cir) { 17 | ((ServerPlayerEntity) (Object) this).stopUsingItem(); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/resources/assets/thorium/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PotassiumMC/thorium/3fbcf371965e6fcb7830eefe65b9f693c216403d/src/main/resources/assets/thorium/icon.png -------------------------------------------------------------------------------- /src/main/resources/assets/thorium/icon.svg: -------------------------------------------------------------------------------- 1 | 3 | 5 | 7 | 9 | 11 | 13 | 14 | -------------------------------------------------------------------------------- /src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "thorium", 4 | "version": "${version}", 5 | "name": "thorium", 6 | "description": "thorium is a fabric mod that fixes 50+ small bugs and annoyances in Minecraft.", 7 | "authors": [ 8 | "NoahvdAa" 9 | ], 10 | "contact": { 11 | "homepage": "https://github.com/PotassiumMC/thorium", 12 | "sources": "https://github.com/PotassiumMC/thorium", 13 | "issues": "https://github.com/PotassiumMC/thorium/issues", 14 | "discord": "https://discord.gg/bXG8H6PVuS", 15 | "irc": "irc://irc.esper.net:6667/potassium" 16 | }, 17 | "license": "LGPL-3.0-only", 18 | "icon": "assets/thorium/icon.png", 19 | "accessWidener": "thorium.accesswidener", 20 | "environment": "*", 21 | "entrypoints": { 22 | "main": [ 23 | "io.github.potassiummc.thorium.Thorium" 24 | ] 25 | }, 26 | "mixins": [ 27 | "thorium.mixins.json" 28 | ], 29 | "depends": { 30 | "fabricloader": ">=0.13.3", 31 | "minecraft": "1.19.3", 32 | "java": ">=17" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/resources/thorium.accesswidener: -------------------------------------------------------------------------------- 1 | accessWidener v1 named 2 | 3 | extendable class net/minecraft/client/gui/screen/StatsScreen$ItemStatsListWidget 4 | extendable class net/minecraft/client/gui/screen/StatsScreen$ItemStatsListWidget$Entry 5 | extendable class net/minecraft/client/gui/screen/option/LanguageOptionsScreen$LanguageSelectionListWidget 6 | accessible class net/minecraft/client/render/chunk/ChunkBuilder$BuiltChunk$RebuildTask 7 | accessible class net/minecraft/client/render/chunk/ChunkBuilder$BuiltChunk$RebuildTask$RenderData 8 | accessible class net/minecraft/client/texture/SpriteContents$Animation 9 | accessible class net/minecraft/client/texture/SpriteContents$AnimationFrame 10 | accessible class net/minecraft/client/texture/SpriteContents$AnimatorImpl 11 | -------------------------------------------------------------------------------- /src/main/resources/thorium.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.8", 4 | "package": "io.github.potassiummc.thorium.mixin", 5 | "compatibilityLevel": "JAVA_17", 6 | "plugin": "io.github.potassiummc.thorium.ThoriumMixinPlugin", 7 | "mixins": [ 8 | "access.EntityAccessor", 9 | "access.LivingEntityInvoker", 10 | "server.mc119417.ServerPlayerEntityMixin", 11 | "server.mc123450.ItemFrameEntityMixin", 12 | "server.mc123605.MinecraftServerMixin", 13 | "server.mc139041.FishingRodItemMixin", 14 | "server.mc147659.CatSpawnerMixin", 15 | "server.mc159283.EndIslandsMixin", 16 | "server.mc170462.StatusEffectsMixin", 17 | "server.mc175622.WolfEntityMixin", 18 | "server.mc176806.RespawnAnchorBlockMixin", 19 | "server.mc181412.JukeboxBlockMixin", 20 | "server.mc193343.ServerPlayerEntityMixin", 21 | "server.mc202637.LivingEntityMixin", 22 | "server.mc215530.ServerPlayerEntityMixin", 23 | "server.mc225364.ChorusFlowerBlockMixin", 24 | "server.mc227337.ShulkerBulletEntityMixin", 25 | "server.mc237843.ServerPlayNetworkHandlerMixin", 26 | "server.mc244948.BundleItemMixin", 27 | "server.mc245394.RaidMixin", 28 | "server.mc252934.AbstractDecorationEntityMixin", 29 | "server.mc6431.PlayerManagerMixin", 30 | "server.mc6431.ServerPlayerEntityMixin", 31 | "server.mc69216.ServerPlayerEntityMixin", 32 | "server.mc7569.RconCommandOutputMixin", 33 | "server.mc84661.StatusEffectsMixin", 34 | "server.mc86252.ServerPlayerEntityMixin" 35 | ], 36 | "client": [ 37 | "access.ClientPlayerEntityInvoker", 38 | "client.mc112730.RebuildTaskMixin", 39 | "client.mc115092.SquidEntityRendererMixin", 40 | "client.mc12062.ClientPlayNetworkHandlerMixin", 41 | "client.mc127970.HeldItemRendererMixin", 42 | "client.mc144761.InterpolationMixin", 43 | "client.mc147766.TextFieldWidgetMixin", 44 | "client.mc148993.ClientPlayerEntityMixin", 45 | "client.mc165595.GuardianEntityRendererMixin", 46 | "client.mc168016.PageTurnWidgetMixin", 47 | "client.mc184029.LanguageEntryMixin", 48 | "client.mc184029.LanguageSelectionListWidgetMixin", 49 | "client.mc201723.ItemStatsListWidgetMixin", 50 | "client.mc210318.BookEditScreenMixin", 51 | "client.mc215531.InGameHudMixin", 52 | "client.mc227169.PlayerEntityRendererMixin", 53 | "client.mc35361.MinecraftClientMixin", 54 | "client.mc4490.FishingBobberEntityRendererMixin", 55 | "client.mc46503.ClientPlayNetworkHandlerMixin", 56 | "client.mc46737.GameRendererMixin", 57 | "client.mc46766.MinecraftClientMixin", 58 | "client.mc55347.ClientPlayNetworkHandlerMixin", 59 | "client.mc62997.InGameHudMixin", 60 | "client.mc75721.BookScreenMixin" 61 | ] 62 | } 63 | --------------------------------------------------------------------------------