Compare commits

...
Author SHA1 Message Date
Raven Szewczyk 9a73dc9bfd Fix glMultMatrix using the wrong variable for multiplication (#444)
* Fix glMultMatrix using the wrong variable for multiplication

* Fix "conersion" typo
2024-04-27 18:46:35 +00:00
Darren Eberly f01cdfda4b Thread safe ISBRH compatibility with Extra Utilities 2 (#439)
* Initial ASM stuff for Extra Utils thread safety

* Thread safety for connected textures

* More thread-safe blocks

* Remove EU2 references, combine ASM transformers

* Remove unusued ModStatus check for Extra Utils
2024-04-25 12:56:24 -07:00
Caedis daa1405ba4 Only disable holoinventory when hudcaching is enabled 2024-04-25 08:14:24 -07:00
jss2a98aj 846d70f0c0 Fix NotFine Twilight Forest compat mixins builder 2024-04-19 11:35:56 -07:00
jss2a98aj e59e41bfdb Sync NotFine
Could scale and render distance NYI
2024-04-19 07:56:08 -07:00
George PatonandGeorge Paton eb8a826419 Fix render distance being capped at 20 (#428)
* Fix render distance being capped at 20 in singleplayer

* Clean up imports

---------

Co-authored-by: George Paton <[email protected]>
2024-04-19 12:58:33 +00:00
boubou19 efe7c16c50 remove donations as author has nothing to do with angelica 2024-04-17 12:49:21 +02:00
wahfl2 c4b4b79f6c Add more methods present in modern MatrixStack 2024-04-11 09:37:54 -07:00
Caedis 2e5ce0abdb Check if hudcaching is enabled before removing xaeros ASM (#419) 2024-04-10 19:36:49 -07:00
Caedis d317b05f5b Fix flickering of Xaero's Map Waypoints (#418)
* update bs

* Fix Xaero's Waypoints
2024-04-10 16:05:45 +00:00
Jason Mitchell cc51a464f1 Remove duplicate unimixins dependency 2024-04-04 10:23:50 -07:00
makamys 3e6aa461c6 Fix crash when Sodium is disabled 2024-03-27 09:06:48 -07:00
Moses Miller d236689e6a Allow the user to select more gui scales (#399) 2024-03-25 09:19:35 -07:00
Caedis d15bbb56ee Add void fog option (default false) (#398) 2024-03-24 19:48:09 -07:00
Jason Mitchell f4355bd4c4 More readable 2024-03-23 21:14:11 -07:00
makamys 5dbd244d72 Readme tweaks (#391)
* [skip ci] Add logo to readme

* [skip ci] README: add CurseForge and Modrinth links
2024-03-20 16:48:06 -07:00
Jason Mitchell 367c82a225 [ci skip] Add CF/MN project info 2024-03-18 08:19:07 -07:00
Jason Mitchell 852bcbb38b Check before casting.
Fixes https://github.com/GTNewHorizons/Angelica/issues/388
2024-03-16 11:24:38 -07:00
ah-OOG-ah 464af945b2 Fix AIOBE in debug screen and NPE on world join (#385)
* Fix AIIOBE

* Fix NPE

* Actually fix
2024-03-15 21:42:38 -04:00
makamys 996b3df9cb Use vanilla field to count number of chunk updates
Fixes D-Tools compat
2024-03-15 15:23:48 -07:00
makamys 22d28abce6 Use ByteBuffer overload when indirect buffer is in client memory
Fixes #373
2024-03-15 15:23:37 -07:00
Jason Mitchell 636b616f64 Stop blacklisting bartworks. (#369)
Needs https://github.com/GTNewHorizons/bartworks/commit/50dfbb44acdd28bc183dc58b9cd40d5ba5121685
2024-03-09 09:27:22 -08:00
Caedis 14b7178419 Initialize toggle keybind when registering (#366)
* Initialize toggle keybind when registering

* Add comment
2024-03-08 15:26:36 -08:00
Caedis 22bf48c093 Potential fix for splash screen crashes (#363)
* Move framebuffer static initializor to getter

* missed one

* Revert "missed one"

This reverts commit 97027c1372.

* Revert "Move framebuffer static initializor to getter"

This reverts commit 6ef65735ff.

* Initialize HudCaching on world join

* run it on the client only

* remove unused imports
2024-03-08 12:40:51 -06:00
Caedis 4600bca2d0 Mixin to override FOV multiplier instead of using the forge event (#361)
* Mixin to speed check instead of using fov event

* scratch that, override return value entirely

* Revert "scratch that, override return value entirely"

This reverts commit 20a379d766.

* Revert "Mixin to speed check instead of using fov event"

This reverts commit 22db36d677.

* Change to lowest priority event so it is ran last (hopefully)
2024-03-08 10:26:34 -06:00
Jason Mitchell fcb9536d93 Don't blacklist gregtech from the render thread (#356) 2024-03-03 15:20:04 -08:00
embeddedt 51a6a72ae5 Only track rendered sprites on specific RenderBlocks instances (#355)
* Only track rendered sprites on specific RenderBlocks instances
2024-03-03 10:10:47 -08:00
Jason Mitchell f41f27e706 Some misbehaving mods *cough GT5u cough* enjoy reallocating textures all the time, so try a normal hash set instead of a reference one... 2024-03-03 09:26:33 -08:00
ah-OOG-ah 346a305f1d Refactor Quad, BlockPos, and QuadProvider API
Also optimize static models
2024-02-29 21:17:46 -05:00
ah-OOG-ah da8f700068 Update LICENSE 2024-02-29 21:17:46 -05:00
ah-OOG-ah f2445fabba Minor patches + license rewording 2024-02-29 21:17:46 -05:00
makamys bc3ca5209f Clean up tags
Also fixes names of enum compound tags missing
2024-02-29 21:17:46 -05:00
makamys 00517079d2 Fix broken links 2024-02-29 21:17:46 -05:00
makamys 7b8a64ec94 Move model-spec.md to docs dir 2024-02-29 21:17:46 -05:00
ah-OOG-ah 794e59b6de Readd CapturingTesselator workaround 2024-02-29 21:17:46 -05:00
ah-OOG-ah 9710801cb1 Fix underwater lighting on QuadProviders 2024-02-29 21:17:46 -05:00
ah-OOG-ah c5bda3b19c Update JsonModel.java 2024-02-29 21:17:46 -05:00
ah-OOG-ah f9678a3793 Batch colorizing 2024-02-29 21:17:46 -05:00
ah-OOG-ah 091290b218 Clean all the things 2024-02-29 21:17:46 -05:00
ah-OOG-ah d991b55af7 Update ClientProxy.java 2024-02-29 21:17:46 -05:00
ah-OOG-ah 1530a8f6fe Clean up CubeModel 2024-02-29 21:17:46 -05:00
ah-OOG-ah 98156191fe Update Loader.java 2024-02-29 21:17:46 -05:00
ah-OOG-ah 956914efa3 Delete ModelHelper.java 2024-02-29 21:17:46 -05:00
ah-OOG-ah 51c3beea9e The purge continues 2024-02-29 21:17:46 -05:00
ah-OOG-ah 657ff921de Fix sided lighting on copied quads 2024-02-29 21:17:46 -05:00
ah-OOG-ah c9539faf44 Update JsonModel.java 2024-02-29 21:17:46 -05:00
ah-OOG-ah 2ca4d5338f Purge FRAPI code
Also use a baked stone model and fix a stupid in JSON
2024-02-29 21:17:46 -05:00
ah-OOG-ah 236a513705 FRAPI materials + NdQuadBuilder performance
Also speed up the offThreadSafety map
2024-02-29 21:17:46 -05:00
ah-OOG-ah 6d49e82a0c Revert "Set aside JSON model code for now"
This reverts commit 31fdf3383195b65a00e999a5634ed3ead8f060b2.
2024-02-29 21:17:46 -05:00
ah-OOG-ah 2fea614a45 Revert "Remove unready code, for now"
This reverts commit b626e3fa8f83013e5b4a68e787ffed9b75d8a679.
2024-02-29 21:17:46 -05:00
ah-OOG-ah 85ed121158 Remove unready code, for now 2024-02-29 21:17:46 -05:00
ah-OOG-ah 9316f42808 Set aside JSON model code for now
Item models my behated
2024-02-29 21:17:46 -05:00
ah-OOG-ah 74b66746eb Dual-license the model package for Fabric 2024-02-29 21:17:46 -05:00
ah-OOG-ah 5abeb9709e Credit FRAPI 2024-02-29 21:17:46 -05:00
ah-OOG-ah 5ec50f22d9 Remove Fabric license headers 2024-02-29 21:17:46 -05:00
ah-OOG-ah dfe3a4220b Add convenience methods 2024-02-29 21:17:46 -05:00
ah-OOG-ah 1e1e95f249 Variant handling 2024-02-29 21:17:46 -05:00
ah-OOG-ah 02b0d1b728 Update JsonModel.java
This fixes things and I don't know why
2024-02-29 21:17:46 -05:00
ah-OOG-ah 9c81c96bb3 Dang, BlockState is hard
YEET
2024-02-29 21:17:46 -05:00
ah-OOG-ah fff5b2cb01 Implement initial BlockState API 2024-02-29 21:17:46 -05:00
ah-OOG-ah 77f1e9b5a2 Support element rotation 2024-02-29 21:17:46 -05:00
ah-OOG-ah 3158a33a65 Texture loading 2024-02-29 21:17:46 -05:00
ah-OOG-ah f6f840235e Does everything but textures 2024-02-29 21:17:46 -05:00
ah-OOG-ah 793f668ef8 Copyright-clear model parsing 2024-02-29 21:17:46 -05:00
Jason Mitchell da01393799 Try an Int2ObjectMap instead of an ObjectList 2024-02-28 23:02:02 -08:00
Jason Mitchell 3030be32f4 Apparently some mods rely on ForgeHooksClient.getWorldRenderPass() (#347)
* Apparently some mods rely on ForgeHooksClient.getWorldRenderPass()
2024-02-28 19:00:26 +00:00
Caedis dbdeba9865 Up required gtnhlib version to 0.2.9 (#340)
* Update README.MD

* Update AngelicaMod.java
2024-02-27 16:49:23 +00:00
Caedis 80ff6af14e Replace config with gtnhlib's config (#337)
* Remove own config

* update bs + deps

* update gtnhlib

* Replace config with gtnhlib's config
2024-02-27 08:37:17 -08:00
Jason Mitchell c34290d182 Ignore the iris/mcpf configs, hardcode angelica-modules.cfg filename 2024-02-26 12:57:47 -08:00
Jason Mitchell 6e3235a985 Gate some advanced/beta features behind java properties 2024-02-26 10:31:54 -08:00
Caedis 419fa9f0c0 Add Dynamic FOV toggle (#331) 2024-02-26 09:19:32 -08:00
Raven Szewczyk c996e5e58c Use a RFB plugin for GLSM transforms when available (#329) 2024-02-25 12:58:19 -08:00
mts2200 6d28df74a6 Fix #320 (#325)
* Fix https://github.com/GTNewHorizons/Angelica/issues/320

* Fix tests on AMD
2024-02-25 01:00:32 -08:00
Jason Mitchell ce97ef876d Switch up the signature to take ints instead of a blockpos and stop allocating one (#324) 2024-02-21 21:29:56 -08:00
Jason Mitchell 8898a6f252 Switcharoo on detecting ThreadSafeISBRHFactory... (#318)
other method apparently wasn't working
2024-02-20 22:17:00 -08:00
Jason Mitchell 37f638ac34 scheduleRebuildOffThread (#316)
* scheduleRebuildOffThread
2024-02-20 08:58:03 -08:00
Jason Mitchell f73c698a5a Don't crash wit invalid lightquality/particalmode options 2024-02-17 22:46:31 -08:00
Jason Mitchell 029da0e7fa Fix glLoadMatrix and add a test for it
Fixes https://github.com/GTNewHorizons/Angelica/issues/299
2024-02-17 18:15:58 -08:00
Darren Eberly e40ee19ac8 Move JOML dependency to GTNHLib (#301)
* Move JOML dependency to GTNHLib

* Update GTNHLib version in README
2024-02-15 10:51:44 -08:00
jss2a98aj 33832fe547 Sync with NotFine (#296)
* Sync with NotFine

* Fix mistake in package name

* Re-separate stars mode and stars total settings
2024-02-15 10:20:13 -08:00
Jason Mitchell 671a776952 Test Matrix operations (#295)
* Test Matrix operations
2024-02-13 23:20:01 -08:00
Matthew William Noel 445b6a3e68 Partially fix entity shaders (#294)
* Partially fix entity shaders
2024-02-13 20:57:44 +00:00
270 changed files with 5410 additions and 2739 deletions

No files matched your search

+8 -2
View File
@@ -1,4 +1,7 @@
# Angelica
# Angelica<img src="img/logo-readme.png" align="right">
<sup>**[CurseForge](https://www.curseforge.com/minecraft/mc-mods/angelica) | [Modrinth](https://modrinth.com/mod/angelica)**</sup>
* The little Angle [sic] that supports shaders while saving your fps from a certain death -boubou
* Is it obtuse, or accute? -Caedis
* It's a cute angle -mitchej123
@@ -8,7 +11,7 @@
# Required Dependencies
* [UniMixins](https://github.com/LegacyModdingMC/UniMixins/releases) >= 0.1.14
* [GTNHLib](https://github.com/GTNewHorizons/GTNHLib/releases) >= 0.2.1
* [GTNHLib](https://github.com/GTNewHorizons/GTNHLib/releases) >= 0.2.9
* NOTE: Some mods are not required, but a specific version is required if present - see: `Permanent Incompatibilities` below.
# Known (temporary) Incompatibilities
@@ -59,3 +62,6 @@
* IMS, jss2a98aj, || dbp ||, roadhog360 for advice and moral support
* Forge 1.12+
* Some files have been taken from Minecraft Forge under the LGPL 2.1 license and are marked as such
* FRAPI and Indigo
* Model building API heavily inspired by/copied from Fabric's; upstream may use it under the original Apache 2.0
license, see LICENSE in `com.gtnewhorizons.angelica.models`
+11
View File
@@ -2,6 +2,10 @@ plugins {
id("com.gtnewhorizons.gtnhconvention")
}
minecraft {
extraRunJvmArguments.add("-Dangelica.enableTestBlocks=true")
}
tasks.test {
useJUnitPlatform()
testLogging {
@@ -14,6 +18,13 @@ tasks.test {
jvmArgs("-Djava.library.path=${tasks.extractNatives2.get().destinationFolder.asFile.get().path}")
}
tasks.processResources {
inputs.property("version", project.version.toString())
filesMatching("META-INF/rfb-plugin/*") {
expand("version" to project.version.toString())
}
}
tasks.register<Copy>("copyDependencies") {
group = "Angelica"
description = "Collect dependencies into the testDependencies folder"
+15 -11
View File
@@ -49,15 +49,16 @@ configurations {
}
dependencies {
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.4.4")
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.4.31")
compileOnly("org.projectlombok:lombok:1.18.22") {transitive = false }
compileOnly("com.gtnewhorizons.retrofuturabootstrap:RetroFuturaBootstrap:0.4.0") { transitive = false }
compileOnly("org.projectlombok:lombok:1.18.22") { transitive = false }
annotationProcessor("org.projectlombok:lombok:1.18.22")
// Iris Shaders
compileOnly('org.jetbrains:annotations:24.0.1')
api("com.github.GTNewHorizons:GTNHLib:0.2.1:dev")
shadowImplementation("org.joml:joml:1.10.5") // MIT
api("com.github.GTNewHorizons:GTNHLib:0.2.9:dev")
shadowImplementation("org.anarres:jcpp:1.4.14") // Apache 2.0
implementation("io.github.douira:glsl-transformer:1.0.0")
shadowImplementation("io.github.douira:glsl-transformer:1.0.0") { // glsl-transformer Noncommercial License 1.0.0
@@ -66,27 +67,30 @@ dependencies {
compileOnly "org.apache.ant:ant:1.8.2"
// Because who doesn't want NEI
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.4.9-GTNH:dev')
compileOnly('com.github.GTNewHorizons:CodeChickenCore:1.2.0:dev')
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.4.9-GTNH:dev')
devOnlyNonPublishable('com.github.GTNewHorizons:CodeChickenCore:1.2.0:dev')
// Notfine Deps
compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:Baubles:1.0.1.16:dev")
compileOnly("com.github.GTNewHorizons:twilightforest:2.5.1:dev") {transitive = false }
runtimeOnlyNonPublishable("com.github.GTNewHorizons:Baubles:1.0.4:dev")
compileOnly("com.github.GTNewHorizons:twilightforest:2.5.16:dev") { transitive = false }
compileOnly(rfg.deobf('curse.maven:witchery-69673:2234410'))
compileOnly("com.falsepattern:chunkapi-mc1.7.10:0.5.0:api")
compileOnly("com.falsepattern:endlessids-mc1.7.10:1.5-beta0002:dev")
compileOnly("com.falsepattern:chunkapi-mc1.7.10:0.5.0:api") { transitive = false }
compileOnly("com.falsepattern:endlessids-mc1.7.10:1.5-beta0002:dev") { transitive = false }
compileOnly(rfg.deobf("curse.maven:extrautils-225561:2264383"))
compileOnly(rfg.deobf("curse.maven:dynamiclights-227874:2337326"))
compileOnly("com.github.GTNewHorizons:NotEnoughIds:2.0.0:dev") // Mixin Version
compileOnly("com.github.GTNewHorizons:NotEnoughIds:2.0.3:dev") // Mixin Version
compileOnly("com.github.GTNewHorizons:NotEnoughIds-Legacy:1.4.7:dev") // ASM Version
compileOnly(rfg.deobf("curse.maven:campfirebackport-387444:4611675"))
// HMMMMM
compileOnly(rfg.deobf("curse.maven:journeymap-32274:2367915"))
compileOnly(rfg.deobf("curse.maven:xaeros-minimap-263420:5060684"))
compileOnly("com.github.GTNewHorizons:HoloInventory:2.4.4-GTNH:dev")
runtimeOnlyNonPublishable(rfg.deobf("CoreTweaks:CoreTweaks:0.3.3.2"))
+34
View File
@@ -0,0 +1,34 @@
# A specification for models
This is borrowed from [the unofficial Minecraft wiki](https://minecraft.wiki/w/Tutorials/Models) under the CC BY-NC-SA 3.0.
The folder `assets/<namespace>/models/block` holds the model files for all the specified variants. The names of the files can be changed, but must always correspond with the names used in the variant files.
* `[TAG_compound]` The root tag
* `[TAG_string]` **parent**: Loads a different model from the given path, in form of a [resource location](https://minecraft.wiki/w/Tutorials/Models#File_path). If both `"parent"` and `"elements"` are set, the `"elements"` tag overrides the `"elements"` tag from the previous model.
* Can be set to `"builtin/generated"` to use a model that is created out of the specified icon. Note that only the first layer is supported, and rotation can be achieved only by using block states files.
* `[TAG_byte]` **ambientocclusion**: Whether to use [ambient occlusion](http://en.wikipedia.org/wiki/Ambient_occlusion) (`true` - default), or not (`false`). Note:only works on Parent file
* `[TAG_object]` **display**: Holds the different places where item models are displayed.
* `[TAG_compound]` ***Position***: Named `thirdperson_righthand`, `thirdperson_lefthand`, `firstperson_righthand`, `firstperson_lefthand`, `gui`, `head`, `ground`, or `fixed`. Place where an item model is displayed. Holds its rotation, translation and scale for the specified situation. '''fixed''' refers to item frames, while the rest are as their name states. Note that translations are applied to the model before rotations.
* `[TAG_list]` **rotation**: Specifies the rotation of the model according to the scheme `[x, y, z]`.
* `[TAG_list]` **translation**: Specifies the position of the model according to the scheme `[x, y, z]`. The values are clamped between -80 and 80.
* `[TAG_list]` **scale**: Specifies the scale of the model according to the scheme `[x, y, z]`. If the value is greater than 4, it is displayed as 4.
* `[TAG_compound]` **textures**: Holds the textures of the model, in form of a [resource location](https://minecraft.wiki/w/Tutorials/Models#File_path) or can be another texture variable.
* `[TAG_string]` **particle**: What texture to load particles from. This texture is also used as an overlay if you are in a [nether portal](https://minecraft.wiki/w/Nether_portal), and used for [water](https://minecraft.wiki/w/water) and [lava](https://minecraft.wiki/w/Lava)'s still textures.<sup>[[1]](https://bugs.mojang.com/browse/MC-240042)</sup> This texture is also considered a texture variable that can be referenced as `"#particle"`. Note: All breaking particles from non-model blocks are hard-coded, such as for [barriers](https://minecraft.wiki/w/Barrier).
* `[TAG_string]` ***Texture variable***: Defines a texture variable with `name` and assigns it to a texture or another variable.
* `[TAG_list]` **elements**: Contains all the elements of the model. They can have only cubic forms. If both `"parent"` and `"elements"` are set, the `"elements"` tag overrides the `"elements"` tag from the previous model.
* `[TAG_compound]` An element.
* `[TAG_list]` **from**: Start point of a cuboid according to the scheme `[x, y, z]`. Values must be between -16 and 32.
* `[TAG_list]` **to**: Stop point of a cuboid according to the scheme `[x, y, z]`. Values must be between -16 and 32.
* `[TAG_compound]` **rotation**: Defines the rotation of an element.
* `[TAG_list]` **origin**: Sets the center of the rotation according to the scheme `[x, y, z]`.
* `[TAG_string]` **axis**: Specifies the direction of rotation, can be `"x"`, `"y"` or `"z"`.
* `[TAG_float]` **angle**: Specifies the angle of rotation. Can be 45 through -45 degrees in 22.5 degree increments.
* `[TAG_byte]` **rescale**: Specifies whether or not to scale the faces across the whole block. Can be true or false. Defaults to false.
* `[TAG_byte]` **shade**: Defines if shadows are rendered (`true` - default), not (`false`).
* `[TAG_compound]` **faces**: Holds all the faces of the cuboid. If a face is left out, it does not render.
* `[TAG_compound]` ***Face***: Named `down`, `up`, `north`, `south`, `west` or `east`. Contains the properties of the specified face.
* `[TAG_list]` **uv**: Defines the area of the texture to use according to the scheme `[x1, y1, x2, y2]`. The texture behavior is inconsistent if UV extends below 0 or above 16. If the numbers of `x1` and `x2` are swapped (e.g. from `0, 0, 16, 16` to `16, 0, 0, 16`), the texture flips. UV is optional, and if not supplied it automatically generates based on the element's position.
* `[TAG_string]` **texture**: Specifies the texture in form of the texture variable prepended with a `#`.
* `[TAG_string]` **cullface**: Specifies whether a face does not need to be rendered when there is a block touching it in the specified position. The position can be: `down`, `up`, `north`, `south`, `west`, or `east`. It also determines the side of the block to use the light level from for lighting the face, and if unset, defaults to the side.
* `[TAG_int]` **rotation**: Rotates the texture clockwise by the specified number of degrees. Can be 0, 90, 180, or 270. Defaults to 0. Rotation does not affect which part of the texture is used. Instead, it amounts to permutation of the selected texture vertexes (selected implicitly, or explicitly though `uv`).
* `[TAG_int]` **tintindex**: Determines whether to tint the texture using a hardcoded tint index. The default value, -1, indicates not to use the tint. Any other number is provided to BlockColors to get the tint value corresponding to that index. However, most blocks do not have a tint value defined (in which case white is used). Furthermore, no vanilla block currently uses multiple tint values, and thus the tint index value is ignored (as long as it is set to something other than -1); it could be used for modded blocks that need multiple distinct tint values in the same block though.
+5 -5
View File
@@ -117,7 +117,7 @@ minimizeShadowedDependencies = true
# If disabled, won't rename the shadowed classes.
relocateShadowedDependencies = true
# Adds the GTNH maven, CurseMaven, IC2/Player maven, and some more well-known 1.7.10 repositories.
# Adds the GTNH maven, CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
includeWellKnownRepositories = true
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
@@ -132,7 +132,7 @@ usesMavenPublishing = true
#
# The project's ID on Modrinth. Can be either the slug or the ID.
# Leave this empty if you don't want to publish to Modrinth.
modrinthProjectId =
modrinthProjectId = angelica
# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
# Syntax: scope1-type1:name1;scope2-type2:name2;...
@@ -141,13 +141,13 @@ modrinthProjectId =
# and the name is the Modrinth project or version slug/id of the other mod.
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
modrinthRelations =
modrinthRelations = required-project\:gtnhlib
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
#
# The project's numeric ID on CurseForge. You can find this in the About Project box.
# Leave this empty if you don't want to publish on CurseForge.
curseForgeProjectId =
curseForgeProjectId = 988067
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
# Syntax: type1:name1;type2:name2;...
@@ -155,7 +155,7 @@ curseForgeProjectId =
# and the name is the CurseForge project slug of the other mod.
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
curseForgeRelations =
curseForgeRelations = requiredDependency\:gtnhlib
# Optional parameter to customize the produced artifacts. Use this to preserve artifact naming when migrating older
# projects. New projects should not use this parameter.
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

+2
View File
@@ -0,0 +1,2 @@
#!/bin/bash
magick convert logo-1x.png -scale 200% \( +clone -background black -shadow 60x6+0+0 \) +swap -background none -layers merge logo-readme.png
+1 -1
View File
@@ -16,5 +16,5 @@ pluginManagement {
}
plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.13'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.21'
}
@@ -15,7 +15,7 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
name = "Angelica",
version = Tags.VERSION,
dependencies = " before:lwjgl3ify@[1.5.3,);" + " after:hodgepodge@[2.4.4,);" + " after:CodeChickenCore@[1.2.0,);"
+ " after:archaicfix@[0.7.0,);" + " required-after:gtnhlib@[0.2.1,);",
+ " after:archaicfix@[0.7.0,);" + " required-after:gtnhlib@[0.2.9,);",
acceptedMinecraftVersions = "[1.7.10]",
acceptableRemoteVersions = "*",
guiFactory = "com.gtnewhorizons.angelica.config.AngelicaGuiConfigFactory")
@@ -0,0 +1,49 @@
package com.gtnewhorizons.angelica.api;
import com.gtnewhorizons.angelica.compat.mojang.BlockPosImpl;
import net.minecraft.util.MathHelper;
import net.minecraftforge.common.util.ForgeDirection;
import java.math.RoundingMode;
import static com.google.common.math.IntMath.log2;
public interface BlockPos {
int SIZE_BITS_X = 1 + log2(MathHelper.roundUpToPowerOfTwo(30000000), RoundingMode.UNNECESSARY);
int SIZE_BITS_Z = SIZE_BITS_X;
int SIZE_BITS_Y = 64 - SIZE_BITS_X - SIZE_BITS_Z;
long BITS_X = (1L << SIZE_BITS_X) - 1L;
long BITS_Y = (1L << SIZE_BITS_Y) - 1L;
long BITS_Z = (1L << SIZE_BITS_Z) - 1L;
int BIT_SHIFT_Z = SIZE_BITS_Y;
int BIT_SHIFT_X = SIZE_BITS_Y + SIZE_BITS_Z;
int getX();
int getY();
int getZ();
BlockPosImpl offset(ForgeDirection d);
BlockPosImpl down();
BlockPosImpl up();
long asLong();
static long asLong(int x, int y, int z) {
long l = 0L;
l |= ((long) x & BITS_X) << BIT_SHIFT_X;
l |= ((long) y & BITS_Y) << 0;
l |= ((long) z & BITS_Z) << BIT_SHIFT_Z;
return l;
}
public static int unpackLongX(long packedPos) {
return (int)(packedPos << 64 - BIT_SHIFT_X - SIZE_BITS_X >> 64 - SIZE_BITS_X);
}
public static int unpackLongY(long packedPos) {
return (int)(packedPos << 64 - SIZE_BITS_Y >> 64 - SIZE_BITS_Y);
}
public static int unpackLongZ(long packedPos) {
return (int)(packedPos << 64 - BIT_SHIFT_Z - SIZE_BITS_Z >> 64 - SIZE_BITS_Z);
}
}
@@ -0,0 +1,8 @@
package com.gtnewhorizons.angelica.api;
public interface MutableBlockPos extends BlockPos {
MutableBlockPos set(int x, int y, int z);
MutableBlockPos set(long packedPos);
}
@@ -1,15 +1,43 @@
package com.gtnewhorizons.angelica.api;
import com.gtnewhorizons.angelica.compat.mojang.BlockPos;
import com.gtnewhorizons.angelica.compat.nd.Quad;
import com.gtnewhorizons.angelica.utils.ObjectPooler;
import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.util.ForgeDirection;
import java.util.List;
import java.util.Random;
import java.util.function.Supplier;
public interface QuadProvider {
List<Quad> getQuads(IBlockAccess world, BlockPos pos, Block block, int meta, ForgeDirection dir, Random random, ObjectPooler<Quad> quadPool);
int R_MASK = 0xFF << 16;
int G_MASK = 0xFF << 8;
int B_MASK = 0xFF;
/**
* Returns the color packed as ABGR. If you want to vary colors within a block, just ignore the color passed into
* {@link #getQuads} and use whatever you want. You might want to override this to return a constant if you're
* extending a block with an expensive color call, like leaves.
*/
default int getColor(IBlockAccess world, BlockPos pos, Block block, int meta, Random random) {
final int cin = block.colorMultiplier(world, pos.getX(), pos.getY(), pos.getZ());
return (0xFF << 24) | ((cin & B_MASK) << 16) | (cin & G_MASK) | ((cin & R_MASK) >>> 16);
}
/**
* If you need to allocate new quads, set this to true. If true, the quads returned by {@link #getQuads} are
* recycled, and you should not keep a reference to them. Example: stone can return a static list every time, but a
* modded block which adds or removes quads based on location would need dynamic quads.
*/
default boolean isDynamic() {
return false;
}
/**
* Provide quads to render. If you need new quads, they should be obtained with the passed supplier and
* {@link #isDynamic} overridden to return true. If so, all quads in the list are recycled and references to them
* should not be kept.
*/
List<QuadView> getQuads(IBlockAccess world, BlockPos pos, Block block, int meta, ForgeDirection dir, Random random, int color, Supplier<QuadView> quadPool);
}
@@ -0,0 +1,22 @@
package com.gtnewhorizons.angelica.api;
import me.jellysquid.mods.sodium.client.model.quad.ModelQuadViewMutable;
import me.jellysquid.mods.sodium.client.render.pipeline.BlockRenderer;
import net.minecraftforge.common.util.ForgeDirection;
import javax.annotation.Nullable;
public interface QuadView extends ModelQuadViewMutable {
boolean isShade();
boolean isDeleted();
ForgeDirection getFace();
void copyFrom(QuadView src);
void setRaw(int[] data, boolean shade, @Nullable ForgeDirection face, int colorIndex, int flags);
int[] getRawVertexes();
/**
* Present for compatibility with the Tesselator, not recommended for general use.
*/
void setState(int[] rawBuffer, int offset, BlockRenderer.Flags flags, int drawMode, float offsetX, float offsetY, float offsetZ);
}
@@ -1,8 +1,9 @@
package com.gtnewhorizons.angelica.client.renderer;
import com.gtnewhorizons.angelica.compat.mojang.BlockPos;
import com.gtnewhorizons.angelica.api.QuadView;
import com.gtnewhorizons.angelica.compat.mojang.BlockPosImpl;
import com.gtnewhorizons.angelica.compat.mojang.VertexFormat;
import com.gtnewhorizons.angelica.compat.nd.Quad;
import me.jellysquid.mods.sodium.client.model.quad.Quad;
import com.gtnewhorizons.angelica.glsm.stacks.Vector3dStack;
import com.gtnewhorizons.angelica.mixins.interfaces.ITessellatorInstance;
import com.gtnewhorizons.angelica.utils.ObjectPooler;
@@ -39,15 +40,15 @@ public class CapturingTessellator extends Tessellator implements ITessellatorIns
private static final MethodHandle sRawBufferSize;
private static final MethodHandle gRawBufferSize;
private final BlockRenderer.Flags FLAGS = new BlockRenderer.Flags(true, true, true, true);
private final ObjectPooler<Quad> quadBuf = new ObjectPooler<>(Quad::new);
private final List<Quad> collectedQuads = new ObjectArrayList<>();
private final ObjectPooler<QuadView> quadBuf = new ObjectPooler<>(Quad::new);
private final List<QuadView> collectedQuads = new ObjectArrayList<>();
// Any offset we need to the Tesselator's offset!
private final BlockPos offset = new BlockPos();
private final BlockPosImpl offset = new BlockPosImpl();
private final Vector3dStack storedTranslation = new Vector3dStack();
public void setOffset(BlockPos pos) {
public void setOffset(BlockPosImpl pos) {
this.offset.set(pos);
}
public void resetOffset() {
@@ -93,10 +94,10 @@ public class CapturingTessellator extends Tessellator implements ITessellatorIns
for(int quadI = 0; quadI < this.vertexCount / verticesPerPrimitive; quadI++) {
final Quad quad = quadBuf.getInstance();
final QuadView quad = quadBuf.getInstance();
quad.setState(this.rawBuffer, quadI * (verticesPerPrimitive * 8), FLAGS, this.drawMode, -offset.x, -offset.y, -offset.z);
if(quad.deleted) {
if(quad.isDeleted()) {
quadBuf.releaseInstance(quad);
} else {
this.collectedQuads.add(quad);
@@ -115,7 +116,7 @@ public class CapturingTessellator extends Tessellator implements ITessellatorIns
}
public List<Quad> getQuads() {
public List<QuadView> getQuads() {
return collectedQuads;
}
@@ -127,7 +128,7 @@ public class CapturingTessellator extends Tessellator implements ITessellatorIns
this.collectedQuads.clear();
}
public static ByteBuffer quadsToBuffer(List<Quad> quads, VertexFormat format) {
public static ByteBuffer quadsToBuffer(List<QuadView> quads, VertexFormat format) {
if(!format.canWriteQuads()) {
throw new IllegalStateException("Vertex format has no quad writer: " + format);
}
@@ -0,0 +1,102 @@
package com.gtnewhorizons.angelica.common;
import com.gtnewhorizons.angelica.api.BlockPos;
import com.gtnewhorizons.angelica.api.QuadProvider;
import com.gtnewhorizons.angelica.api.QuadView;
import com.gtnewhorizons.angelica.models.json.JsonModel;
import com.gtnewhorizons.angelica.models.json.Loader;
import com.gtnewhorizons.angelica.models.json.Variant;
import it.unimi.dsi.fastutil.objects.ObjectImmutableList;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import java.util.Random;
import java.util.function.Supplier;
public class BlockTest extends Block implements QuadProvider {
public static final Variant[] modelId = {
new Variant(
new ResourceLocation("blocks/lectern"),
0,
0,
false
),
new Variant(
new ResourceLocation("blocks/lectern"),
180,
0,
false
),
new Variant(
new ResourceLocation("blocks/lectern"),
90,
0,
false
),
new Variant(
new ResourceLocation("blocks/lectern"),
270,
0,
false
),
};
private static final List<QuadView> EMPTY = ObjectImmutableList.of();
private static final JsonModel[] model = new JsonModel[4];
public BlockTest() {
super(Material.rock);
}
public static void loadModel() {
for (int i = 0; i < 4; ++i)
model[i] = Loader.getModel(modelId[i]);
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public void registerBlockIcons(IIconRegister reg) {
reg.registerIcon("angelica:test_block");
reg.registerIcon("lectern_base");
reg.registerIcon("lectern_front");
reg.registerIcon("lectern_sides");
reg.registerIcon("lectern_top");
reg.registerIcon("oak_planks");
}
@Override
public List<QuadView> getQuads(IBlockAccess world, BlockPos pos, Block block, int meta, ForgeDirection dir, Random random, int color, Supplier<QuadView> quadPool) {
if (meta < 2 || meta > 5) meta = 2;
return (model[meta - 2] != null) ? model[meta - 2].getQuads(world, pos, block, meta, dir, random, color, quadPool) : EMPTY;
}
/**
* Called when a block is placed using its ItemBlock. Args: World, X, Y, Z, side, hitX, hitY, hitZ, block metadata
*/
@Override
public int onBlockPlaced(@NotNull World worldIn, int x, int y, int z, int side, float subX, float subY, float subZ, int meta) {
// Face NORTH if placed up or down
final ForgeDirection s = ForgeDirection.values()[side];
if (s == ForgeDirection.UP || s == ForgeDirection.DOWN)
return 2;
// Face the placed side
return side;
}
}
@@ -1,6 +1,10 @@
package com.gtnewhorizons.angelica.compat;
import com.gtnewhorizons.angelica.helpers.LoadControllerHelper;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.versioning.ArtifactVersion;
import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
import net.dries007.holoInventory.HoloInventory;
public class ModStatus {
/**
@@ -16,6 +20,8 @@ public class ModStatus {
public static boolean isLotrLoaded;
public static boolean isChunkAPILoaded;
public static boolean isEIDBiomeLoaded;
public static boolean isXaerosMinimapLoaded;
public static boolean isHoloInventoryLoaded;
public static void preInit(){
isNEIDLoaded = Loader.isModLoaded("neid");
@@ -23,6 +29,16 @@ public class ModStatus {
isLotrLoaded = Loader.isModLoaded("lotr");
isChunkAPILoaded = Loader.isModLoaded("chunkapi");
isEIDBiomeLoaded = Loader.isModLoaded("endlessids_biome");
isXaerosMinimapLoaded = Loader.isModLoaded("XaeroMinimap");
isHoloInventoryLoaded = Loader.isModLoaded("holoinventory");
if (isHoloInventoryLoaded){
isHoloInventoryLoaded = new DefaultArtifactVersion("2.4.4-GTNH")
.compareTo(
LoadControllerHelper.getOwningMod(HoloInventory.class).getProcessedVersion()
) <= 0;
}
isNEIDMetadataExtended = false;
if (isNEIDLoaded) {
@@ -1,6 +1,7 @@
package com.gtnewhorizons.angelica.compat.mojang;
import me.jellysquid.mods.sodium.client.model.quad.properties.ModelQuadFacing;
import net.minecraftforge.common.util.ForgeDirection;
public enum Axis {
X,
@@ -14,6 +15,37 @@ public enum Axis {
case WEST, EAST -> X;
case UNASSIGNED -> null;
};
}
public static Axis fromDirection(ForgeDirection dir) {
return switch (dir) {
case DOWN, UP -> Y;
case NORTH, SOUTH -> Z;
case WEST, EAST -> X;
case UNKNOWN -> null;
};
}
public static Axis fromName(String dir) {
return switch (dir) {
case "y" -> Y;
case "z" -> Z;
case "x" -> X;
default -> null;
};
}
public enum Direction {
POSITIVE,
NEGATIVE;
public static Direction fromDirection(ForgeDirection dir) {
return switch (dir) {
case DOWN, NORTH, WEST -> NEGATIVE;
case UP, SOUTH, EAST -> POSITIVE;
case UNKNOWN -> null;
};
}
}
}
@@ -1,102 +0,0 @@
package com.gtnewhorizons.angelica.compat.mojang;
import net.minecraft.util.MathHelper;
import net.minecraft.world.ChunkPosition;
import net.minecraftforge.common.util.ForgeDirection;
import org.joml.Vector3i;
import java.math.RoundingMode;
import static com.google.common.math.IntMath.log2;
// Should we keep this?
public class BlockPos extends Vector3i {
private static final int SIZE_BITS_X = 1 + log2(MathHelper.roundUpToPowerOfTwo(30000000), RoundingMode.UNNECESSARY);
private static final int SIZE_BITS_Z = SIZE_BITS_X;
private static final int SIZE_BITS_Y = 64 - SIZE_BITS_X - SIZE_BITS_Z;
private static final long BITS_X = (1L << SIZE_BITS_X) - 1L;
private static final long BITS_Y = (1L << SIZE_BITS_Y) - 1L;
private static final long BITS_Z = (1L << SIZE_BITS_Z) - 1L;
private static final int BIT_SHIFT_Z = SIZE_BITS_Y;
private static final int BIT_SHIFT_X = SIZE_BITS_Y + SIZE_BITS_Z;
public BlockPos() {
super();
}
public BlockPos(int x, int y, int z) {
super(x, y, z);
}
public BlockPos(ChunkPosition chunkPosition) {
super(chunkPosition.chunkPosX, chunkPosition.chunkPosY, chunkPosition.chunkPosZ);
}
public int getX() {
return this.x;
}
public int getY() {
return this.y;
}
public int getZ() {
return this.z;
}
public BlockPos set(int x, int y, int z) {
super.set(x, y, z);
return this;
}
/**
* This method does NOT mutate the BlockPos
*/
public BlockPos offset(ForgeDirection d) {
return new BlockPos(this.x + d.offsetX, this.y + d.offsetY, this.z + d.offsetZ);
}
/**
* This method does NOT mutate the BlockPos
*/
public BlockPos down() {
return offset(ForgeDirection.DOWN);
}
/**
* This method does NOT mutate the BlockPos
*/
public BlockPos up() {
return offset(ForgeDirection.UP);
}
public long asLong() {
return asLong(this.x, this.y, this.z);
}
public static long asLong(int x, int y, int z) {
long l = 0L;
l |= ((long)x & BITS_X) << BIT_SHIFT_X;
l |= ((long)y & BITS_Y) << 0;
l |= ((long)z & BITS_Z) << BIT_SHIFT_Z;
return l;
}
public BlockPos set(long packedPos) {
return set(unpackLongX(packedPos), unpackLongY(packedPos), unpackLongZ(packedPos));
}
public static int unpackLongX(long packedPos) {
return (int)(packedPos << 64 - BIT_SHIFT_X - SIZE_BITS_X >> 64 - SIZE_BITS_X);
}
public static int unpackLongY(long packedPos) {
return (int)(packedPos << 64 - SIZE_BITS_Y >> 64 - SIZE_BITS_Y);
}
public static int unpackLongZ(long packedPos) {
return (int)(packedPos << 64 - BIT_SHIFT_Z - SIZE_BITS_Z >> 64 - SIZE_BITS_Z);
}
public static class Mutable extends BlockPos {
}
}
@@ -0,0 +1,70 @@
package com.gtnewhorizons.angelica.compat.mojang;
import com.gtnewhorizons.angelica.api.BlockPos;
import com.gtnewhorizons.angelica.api.MutableBlockPos;
import net.minecraft.world.ChunkPosition;
import net.minecraftforge.common.util.ForgeDirection;
import org.joml.Vector3i;
import static com.gtnewhorizons.angelica.api.BlockPos.unpackLongX;
import static com.gtnewhorizons.angelica.api.BlockPos.unpackLongY;
import static com.gtnewhorizons.angelica.api.BlockPos.unpackLongZ;
// Should we keep this?
public class BlockPosImpl extends Vector3i implements MutableBlockPos {
public BlockPosImpl() {
super();
}
public BlockPosImpl(int x, int y, int z) {
super(x, y, z);
}
public BlockPosImpl(ChunkPosition chunkPosition) {
super(chunkPosition.chunkPosX, chunkPosition.chunkPosY, chunkPosition.chunkPosZ);
}
@Override
public int getX() {
return this.x;
}
@Override
public int getY() {
return this.y;
}
@Override
public int getZ() {
return this.z;
}
@Override
public BlockPosImpl offset(ForgeDirection d) {
return new BlockPosImpl(this.x + d.offsetX, this.y + d.offsetY, this.z + d.offsetZ);
}
@Override
public BlockPosImpl down() {
return offset(ForgeDirection.DOWN);
}
@Override
public BlockPosImpl up() {
return offset(ForgeDirection.UP);
}
@Override
public long asLong() {
return BlockPos.asLong(this.x, this.y, this.z);
}
@Override
public BlockPosImpl set(int x, int y, int z) {
super.set(x, y, z);
return this;
}
@Override
public BlockPosImpl set(long packedPos) {
return set(unpackLongX(packedPos), unpackLongY(packedPos), unpackLongZ(packedPos));
}
}
@@ -13,7 +13,7 @@ import org.joml.Vector4f;
@Getter
public class Camera {
final Vector3d pos = new Vector3d();
final BlockPos.Mutable blockPos = new BlockPos.Mutable();
final BlockPosImpl blockPos = new BlockPosImpl();
float pitch;
float yaw;
EntityLivingBase entity;
@@ -36,12 +36,12 @@ public class ChunkOcclusionDataBuilder {
}
private int openCount = 4096;
public void markClosed(BlockPos pos) {
public void markClosed(BlockPosImpl pos) {
this.closed.set(pack(pos), true);
--this.openCount;
}
private static int pack(BlockPos pos) {
private static int pack(BlockPosImpl pos) {
return pack(pos.getX() & 15, pos.getY() & 15, pos.getZ() & 15);
}
@@ -12,7 +12,7 @@ public class ChunkPos {
this.z = z;
}
public ChunkPos(BlockPos pos) {
public ChunkPos(BlockPosImpl pos) {
this.x = pos.getX() >> 4;
this.z = pos.getZ() >> 4;
}
@@ -19,7 +19,7 @@ public class ChunkSectionPos extends Vector3i {
return new ChunkSectionPos(x, y, z);
}
public static ChunkSectionPos from(BlockPos pos) {
public static ChunkSectionPos from(BlockPosImpl pos) {
return new ChunkSectionPos(getSectionCoord(pos.getX()), getSectionCoord(pos.getY()), getSectionCoord(pos.getZ()));
}
@@ -35,10 +35,10 @@ public class ChunkSectionPos extends Vector3i {
return coord & 15;
}
public static short packLocal(BlockPos pos) {
int i = getLocalCoord(pos.x);
int j = getLocalCoord(pos.y);
int k = getLocalCoord(pos.z);
public static short packLocal(int x, int y, int z) {
final int i = getLocalCoord(x);
final int j = getLocalCoord(y);
final int k = getLocalCoord(z);
return (short)(i << 8 | k << 4 | j << 0);
}
@@ -1,8 +1,8 @@
package com.gtnewhorizons.angelica.compat.mojang;
import com.google.common.collect.ImmutableList;
import com.gtnewhorizons.angelica.api.QuadView;
import com.gtnewhorizons.angelica.compat.nd.IWriteQuads;
import com.gtnewhorizons.angelica.compat.nd.Quad;
import it.unimi.dsi.fastutil.ints.IntArrayList;
import it.unimi.dsi.fastutil.ints.IntList;
import lombok.Getter;
@@ -79,7 +79,7 @@ public class VertexFormat {
return quadWriter != null;
}
public void writeQuad(Quad quad, ByteBuffer byteBuffer) {
public void writeQuad(QuadView quad, ByteBuffer byteBuffer) {
if(quadWriter == null) {
throw new IllegalStateException("No quad writer set");
}
@@ -24,8 +24,8 @@ public class VertexFormatElement {
this.byteSize = type.getSize() * count;
}
public void setupBufferState(long l, int i) {
this.usage.setupBufferState(this.count, this.type.getGlType(), i, l, this.index);
public void setupBufferState(long offset, int stride) {
this.usage.setupBufferState(this.count, this.type.getGlType(), stride, offset, this.index);
}
public void clearBufferState() {
@@ -33,32 +33,32 @@ public class VertexFormatElement {
}
public enum Usage {
POSITION("Position", (i, j, k, l, m) -> {
GL11.glVertexPointer(i, j, k, l);
POSITION("Position", (size, type, stride, pointer, index) -> {
GL11.glVertexPointer(size, type, stride, pointer);
GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
}, (i) -> GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY)),
NORMAL("Normal", (i, j, k, l, m) -> {
GL11.glNormalPointer(j, k, l);
}, index -> GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY)),
NORMAL("Normal", (size, type, stride, pointer, index) -> {
GL11.glNormalPointer(type, stride, pointer);
GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY);
}, (i) -> GL11.glDisableClientState(GL11.GL_NORMAL_ARRAY)),
COLOR("Vertex Color", (i, j, k, l, m) -> {
GL11.glColorPointer(i, j, k, l);
}, index -> GL11.glDisableClientState(GL11.GL_NORMAL_ARRAY)),
COLOR("Vertex Color", (size, type, stride, pointer, index) -> {
GL11.glColorPointer(size, type, stride, pointer);
GL11.glEnableClientState(GL11.GL_COLOR_ARRAY);
}, i -> GL11.glDisableClientState(GL11.GL_COLOR_ARRAY)),
UV("UV", (i, j, k, l, m) -> {
GL13.glClientActiveTexture(GL13.GL_TEXTURE0 + m);
GL11.glTexCoordPointer(i, j, k, l);
}, index -> GL11.glDisableClientState(GL11.GL_COLOR_ARRAY)),
UV("UV", (size, type, stride, pointer, index) -> {
GL13.glClientActiveTexture(GL13.GL_TEXTURE0 + index);
GL11.glTexCoordPointer(size, type, stride, pointer);
GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
GL13.glClientActiveTexture(GL13.GL_TEXTURE0);
}, i -> {
GL13.glClientActiveTexture(GL13.GL_TEXTURE0 + i);
}, index -> {
GL13.glClientActiveTexture(GL13.GL_TEXTURE0 + index);
GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
GL13.glClientActiveTexture(GL13.GL_TEXTURE0);
}),
PADDING("Padding", (i, j, k, l, m) -> {}, i-> {}),
GENERIC("Generic", (i, j, k, l, m) -> {
GL20.glEnableVertexAttribArray(m);
GL20.glVertexAttribPointer(m, i, j, false, k, l);
PADDING("Padding", (size, type, stride, pointer, index) -> {}, index-> {}),
GENERIC("Generic", (size, type, stride, pointer, index) -> {
GL20.glEnableVertexAttribArray(index);
GL20.glVertexAttribPointer(index, size, type, false, stride, pointer);
}, GL20::glDisableVertexAttribArray);
@Getter private final String name;
@@ -71,16 +71,16 @@ public class VertexFormatElement {
this.clearState = clearState;
}
private void setupBufferState(int i, int j, int k, long l, int m) {
this.setupState.setupBufferState(i, j, k, l, m);
private void setupBufferState(int size, int type, int stride, long pointer, int index) {
this.setupState.setupBufferState(size, type, stride, pointer, index);
}
public void clearBufferState(int i) {
this.clearState.accept(i);
public void clearBufferState(int index) {
this.clearState.accept(index);
}
interface SetupState {
void setupBufferState(int i, int j, int k, long l, int m);
void setupBufferState(int size, int type, int stride, long pointer, int index);
}
}
@@ -1,7 +1,9 @@
package com.gtnewhorizons.angelica.compat.nd;
import com.gtnewhorizons.angelica.api.QuadView;
import java.nio.ByteBuffer;
public interface IWriteQuads {
void writeQuad(Quad quad, ByteBuffer buf);
void writeQuad(QuadView quad, ByteBuffer buf);
}
@@ -1,187 +0,0 @@
package com.gtnewhorizons.angelica.compat.nd;
import lombok.Getter;
import me.jellysquid.mods.sodium.client.model.quad.ModelQuadView;
import me.jellysquid.mods.sodium.client.model.quad.properties.ModelQuadFacing;
import me.jellysquid.mods.sodium.client.model.quad.properties.ModelQuadFlags;
import me.jellysquid.mods.sodium.client.render.pipeline.BlockRenderer;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraftforge.common.util.ForgeDirection;
import org.joml.Vector3f;
import org.lwjgl.opengl.GL11;
import java.util.Locale;
public class Quad implements ModelQuadView {
// Adapted from Neodymium
private final static int DEFAULT_BRIGHTNESS = 15 << 20 | 15 << 4;
private final static int DEFAULT_COLOR = 0xFFFFFFFF;
public float[] xs = new float[4];
public float[] ys = new float[4];
public float[] zs = new float[4];
public float[] us = new float[4];
public float[] vs = new float[4];
public int[] cs = new int[4];
public int[] ns = new int[4];
public int[] bs = new int[4];
public boolean deleted;
public ModelQuadFacing normal;
private final Vector3f vectorA = new Vector3f(), vectorB = new Vector3f(), vectorC = new Vector3f();
private boolean hasColor;
private boolean hasShade;
private boolean hasNormals;
private int cachedFlags;
private ForgeDirection face;
private int colorIndex = -1;
public boolean hasColor() {
return this.hasColor;
}
public int[] getColors() {
return this.cs;
}
public boolean hasShade() {
return this.hasShade;
}
public boolean hasNormals() {
return this.hasNormals;
}
/** Returns the face, forced to take one of 6 directions to mirror the behavior of baked quads in 1.16.5. */
public ForgeDirection getCoercedFace() {
return this.face != ForgeDirection.UNKNOWN ? this.face : ForgeDirection.UP;
}
@Override
public float getX(int idx) {
return xs[idx];
}
@Override
public float getY(int idx) {
return ys[idx];
}
@Override
public float getZ(int idx) {
return zs[idx];
}
@Override
public int getColor(int idx) {
return cs[idx];
}
@Override
public float getTexU(int idx) {
return us[idx];
}
@Override
public float getTexV(int idx) {
return vs[idx];
}
@Override
public int getFlags() {
return this.cachedFlags;
}
@Override
public int getLight(int idx) {
return bs[idx];
}
@Override
public int getNormal(int idx) {
return ns[idx];
}
@Override
public int getColorIndex() {
return colorIndex;
}
@Override
public TextureAtlasSprite rubidium$getSprite() {
return null;
}
private void read(int[] rawBuffer, int offset, float offsetX, float offsetY, float offsetZ, int drawMode, BlockRenderer.Flags flags) {
final int vertices = drawMode == GL11.GL_TRIANGLES ? 3 : 4;
for(int vi = 0; vi < vertices; vi++) {
int i = offset + vi * 8;
xs[vi] = Float.intBitsToFloat(rawBuffer[i + 0]) + offsetX;
ys[vi] = Float.intBitsToFloat(rawBuffer[i + 1]) + offsetY;
zs[vi] = Float.intBitsToFloat(rawBuffer[i + 2]) + offsetZ;
us[vi] = Float.intBitsToFloat(rawBuffer[i + 3]);
vs[vi] = Float.intBitsToFloat(rawBuffer[i + 4]);
cs[vi] = flags.hasColor ? rawBuffer[i + 5] : DEFAULT_COLOR;
ns[vi] = flags.hasNormals ? rawBuffer[i + 6] : 0;
bs[vi] = flags.hasBrightness ? rawBuffer[i + 7] : DEFAULT_BRIGHTNESS;
this.hasColor = flags.hasColor;
this.hasShade = flags.hasBrightness;
this.hasNormals = flags.hasNormals;
i += 8;
}
if(vertices == 3) {
// Quadrangulate!
xs[3] = xs[2];
ys[3] = ys[2];
zs[3] = zs[2];
us[3] = us[2];
vs[3] = vs[2];
bs[3] = bs[2];
cs[3] = cs[2];
ns[3] = ns[2];
}
}
public void setState(int[] rawBuffer, int offset, BlockRenderer.Flags flags, int drawMode, float offsetX, float offsetY, float offsetZ) {
deleted = false;
read(rawBuffer, offset, offsetX, offsetY, offsetZ, drawMode, flags);
if(xs[0] == xs[1] && xs[1] == xs[2] && xs[2] == xs[3] && ys[0] == ys[1] && ys[1] == ys[2] && ys[2] == ys[3]) {
// ignore empty quads (e.g. alpha pass of EnderIO item conduits)
deleted = true;
return;
}
vectorA.set(xs[1] - xs[0], ys[1] - ys[0], zs[1] - zs[0]);
vectorB.set(xs[2] - xs[1], ys[2] - ys[1], zs[2] - zs[1]);
vectorA.cross(vectorB, vectorC);
normal = ModelQuadFacing.fromVector(vectorC);
this.face = ModelQuadFacing.toDirection(normal);
this.cachedFlags = ModelQuadFlags.getQuadFlags(this);
}
public static boolean isValid(Quad q) {
return q != null && !q.deleted;
}
@Override
public String toString() {
return String.format(Locale.ENGLISH, "%s[(%.1f, %.1f, %.1f), (%.1f, %.1f, %.1f), (%.1f, %.1f, %.1f), (%.1f, %.1f, %.1f)]", deleted ? "XXX " : "", xs[0], ys[0], zs[0], xs[1], ys[1], zs[1], xs[2], ys[2], zs[2], xs[3], ys[3], zs[3]);
}
}
@@ -1,7 +1,7 @@
package com.gtnewhorizons.angelica.compat.nd.writers;
import com.gtnewhorizons.angelica.api.QuadView;
import com.gtnewhorizons.angelica.compat.nd.IWriteQuads;
import com.gtnewhorizons.angelica.compat.nd.Quad;
import java.nio.ByteBuffer;
@@ -17,7 +17,7 @@ public class ItemVBOQuadWriter implements IWriteQuads {
this.direct = direct;
}
@Override
public void writeQuad(Quad quad, ByteBuffer buf) {
public void writeQuad(QuadView quad, ByteBuffer buf) {
if(direct) {
writeQuadDirect(quad, buf);
} else {
@@ -25,11 +25,11 @@ public class ItemVBOQuadWriter implements IWriteQuads {
}
}
protected void writeQuadDirect(Quad quad, ByteBuffer buf) {
protected void writeQuadDirect(QuadView quad, ByteBuffer buf) {
throw new UnsupportedOperationException("Direct mode not supported yet");
}
protected void writeQuadIndirect(Quad quad, ByteBuffer buf) {
protected void writeQuadIndirect(QuadView quad, ByteBuffer buf) {
for(int idx = 0; idx < 4; ++idx) {
// Position
buf.putFloat(quad.getX(idx));
@@ -1,7 +1,7 @@
package com.gtnewhorizons.angelica.compat.nd.writers;
import com.gtnewhorizons.angelica.api.QuadView;
import com.gtnewhorizons.angelica.compat.nd.IWriteQuads;
import com.gtnewhorizons.angelica.compat.nd.Quad;
import java.nio.ByteBuffer;
@@ -17,7 +17,7 @@ public class PositionColorTextureQuadWriter implements IWriteQuads {
this.direct = direct;
}
@Override
public void writeQuad(Quad quad, ByteBuffer buf) {
public void writeQuad(QuadView quad, ByteBuffer buf) {
if(direct) {
writeQuadDirect(quad, buf);
} else {
@@ -25,11 +25,11 @@ public class PositionColorTextureQuadWriter implements IWriteQuads {
}
}
protected void writeQuadDirect(Quad quad, ByteBuffer buf) {
protected void writeQuadDirect(QuadView quad, ByteBuffer buf) {
throw new UnsupportedOperationException("Direct mode not supported yet");
}
protected void writeQuadIndirect(Quad quad, ByteBuffer buf) {
protected void writeQuadIndirect(QuadView quad, ByteBuffer buf) {
for(int idx = 0; idx < 4; ++idx) {
// Position
buf.putFloat(quad.getX(idx));
@@ -1,7 +1,7 @@
package com.gtnewhorizons.angelica.compat.nd.writers;
import com.gtnewhorizons.angelica.api.QuadView;
import com.gtnewhorizons.angelica.compat.nd.IWriteQuads;
import com.gtnewhorizons.angelica.compat.nd.Quad;
import java.nio.ByteBuffer;
@@ -17,7 +17,7 @@ public class PositionQuadWriter implements IWriteQuads {
this.direct = direct;
}
@Override
public void writeQuad(Quad quad, ByteBuffer buf) {
public void writeQuad(QuadView quad, ByteBuffer buf) {
if(direct) {
writeQuadDirect(quad, buf);
} else {
@@ -25,11 +25,11 @@ public class PositionQuadWriter implements IWriteQuads {
}
}
protected void writeQuadDirect(Quad quad, ByteBuffer buf) {
protected void writeQuadDirect(QuadView quad, ByteBuffer buf) {
throw new UnsupportedOperationException("Direct mode not supported yet");
}
protected void writeQuadIndirect(Quad quad, ByteBuffer buf) {
protected void writeQuadIndirect(QuadView quad, ByteBuffer buf) {
for(int idx = 0; idx < 4; ++idx) {
// Position
buf.putFloat(quad.getX(idx));
@@ -1,7 +1,7 @@
package com.gtnewhorizons.angelica.compat.nd.writers;
import com.gtnewhorizons.angelica.api.QuadView;
import com.gtnewhorizons.angelica.compat.nd.IWriteQuads;
import com.gtnewhorizons.angelica.compat.nd.Quad;
import java.nio.ByteBuffer;
@@ -17,7 +17,7 @@ public class PositionTextureColorQuadWriter implements IWriteQuads {
this.direct = direct;
}
@Override
public void writeQuad(Quad quad, ByteBuffer buf) {
public void writeQuad(QuadView quad, ByteBuffer buf) {
if(direct) {
writeQuadDirect(quad, buf);
} else {
@@ -25,11 +25,11 @@ public class PositionTextureColorQuadWriter implements IWriteQuads {
}
}
protected void writeQuadDirect(Quad quad, ByteBuffer buf) {
protected void writeQuadDirect(QuadView quad, ByteBuffer buf) {
throw new UnsupportedOperationException("Direct mode not supported yet");
}
protected void writeQuadIndirect(Quad quad, ByteBuffer buf) {
protected void writeQuadIndirect(QuadView quad, ByteBuffer buf) {
for(int idx = 0; idx < 4; ++idx) {
// Position
buf.putFloat(quad.getX(idx));
@@ -1,7 +1,7 @@
package com.gtnewhorizons.angelica.compat.nd.writers;
import com.gtnewhorizons.angelica.api.QuadView;
import com.gtnewhorizons.angelica.compat.nd.IWriteQuads;
import com.gtnewhorizons.angelica.compat.nd.Quad;
import java.nio.ByteBuffer;
@@ -17,7 +17,7 @@ public class PositionTextureQuadWriter implements IWriteQuads {
this.direct = direct;
}
@Override
public void writeQuad(Quad quad, ByteBuffer buf) {
public void writeQuad(QuadView quad, ByteBuffer buf) {
if(direct) {
writeQuadDirect(quad, buf);
} else {
@@ -25,11 +25,11 @@ public class PositionTextureQuadWriter implements IWriteQuads {
}
}
protected void writeQuadDirect(Quad quad, ByteBuffer buf) {
protected void writeQuadDirect(QuadView quad, ByteBuffer buf) {
throw new UnsupportedOperationException("Direct mode not supported yet");
}
protected void writeQuadIndirect(Quad quad, ByteBuffer buf) {
protected void writeQuadIndirect(QuadView quad, ByteBuffer buf) {
for(int idx = 0; idx < 4; ++idx) {
// Position
buf.putFloat(quad.getX(idx));
@@ -3,6 +3,7 @@ package com.gtnewhorizons.angelica.compat.toremove;
import com.google.common.collect.Queues;
import org.joml.Matrix3f;
import org.joml.Matrix4f;
import org.joml.Quaternionf;
import java.util.Deque;
@@ -79,6 +80,27 @@ public class MatrixStack {
}
public void multiply(Quaternionf quaternion) {
MatrixStack.Entry entry = this.matrixStack.getLast();
entry.model.rotate(quaternion);
entry.normal.rotate(quaternion);
}
public void multiply(Quaternionf quaternion, float originX, float originY, float originZ) {
MatrixStack.Entry entry = this.matrixStack.getLast();
entry.model.rotateAround(quaternion, originX, originY, originZ);
entry.normal.rotate(quaternion);
}
public void loadIdentity() {
MatrixStack.Entry entry = this.matrixStack.getLast();
entry.model.identity();
entry.normal.identity();
}
public void multiplyPositionMatrix(Matrix4f matrix) {
this.matrixStack.getLast().model.mul(matrix);
}
private static float invSqrt(float x) {
float xhalf = 0.5f * x;
@@ -1,12 +1,18 @@
package com.gtnewhorizons.angelica.config;
@Config(modid = "angelica")
import com.gtnewhorizon.gtnhlib.config.Config;
@Config(modid = "angelica", filename = "angelica-modules")
public class AngelicaConfig {
@Config.Comment("Enable Sodium rendering")
@Config.DefaultBoolean(true)
@Config.RequiresMcRestart
public static boolean enableSodium;
@Config.Comment("Enable NotFine Options")
@Config.DefaultBoolean(false)
public static boolean enableNotFineOptions;
@Config.Comment("Enable Reese's Sodium Options")
@Config.DefaultBoolean(true)
public static boolean enableReesesSodiumOptions;
@@ -21,21 +27,23 @@ public class AngelicaConfig {
@Config.RequiresMcRestart
public static boolean injectQPRendering;
@Config.Comment("Enable Angelica's test blocks")
@Config.DefaultBoolean(false)
@Config.Ignore()
public static boolean enableTestBlocks;
@Config.Comment("Enable Iris Shaders [Requires Sodium]")
@Config.DefaultBoolean(false)
@Config.RequiresMcRestart
@Config.Ignore()
public static boolean enableIris;
@Config.Comment("Enable MCPatcherForge features, still in Alpha. Individual features are toggled in mcpatcher.json")
@Config.DefaultBoolean(false)
@Config.RequiresMcRestart
@Config.Ignore()
public static boolean enableMCPatcherForgeFeatures;
@Config.Comment("Enable NotFine optimizations")
@Config.DefaultBoolean(true)
@Config.RequiresMcRestart
public static boolean enableNotFineOptimizations;
@Config.Comment("Replace some vanilla render paths with more optimized versions. Disable if you encounter mixin conflicts.")
@Config.DefaultBoolean(true)
@Config.RequiresMcRestart
@@ -93,6 +101,11 @@ public class AngelicaConfig {
@Config.RequiresMcRestart
public static boolean fixLotrSodiumCompat;
@Config.Comment("Fix thread-safety in Extra Utilities rendering")
@Config.DefaultBoolean(true)
@Config.RequiresMcRestart
public static boolean fixExtraUtilsSodiumCompat;
@Config.Comment("Enable Debug Logging")
@Config.DefaultBoolean(false)
@Config.RequiresMcRestart
@@ -1,5 +1,7 @@
package com.gtnewhorizons.angelica.config;
import com.gtnewhorizon.gtnhlib.config.ConfigException;
import com.gtnewhorizon.gtnhlib.config.SimpleGuiConfig;
import net.minecraft.client.gui.GuiScreen;
public class AngelicaGuiConfig extends SimpleGuiConfig {
@@ -1,5 +1,6 @@
package com.gtnewhorizons.angelica.config;
import com.gtnewhorizon.gtnhlib.config.SimpleGuiFactory;
import net.minecraft.client.gui.GuiScreen;
public class AngelicaGuiConfigFactory implements SimpleGuiFactory {
@@ -1,113 +0,0 @@
package com.gtnewhorizons.angelica.config;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface Config {
/**
* The mod id that this configuration is associated with.
*/
String modid();
/**
* Root element category, defaults to "general". You must not specify an empty string.
*/
String category() default "general";
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.TYPE})
@interface LangKey {
String value();
}
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
@interface Comment {
String[] value();
}
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
@interface Ignore {
}
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
@interface DefaultBoolean {
boolean value();
}
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
@interface RangeInt {
int min() default Integer.MIN_VALUE;
int max() default Integer.MAX_VALUE;
}
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
@interface DefaultInt {
int value();
}
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
@interface RangeFloat {
float min() default Float.MIN_VALUE;
float max() default Float.MAX_VALUE;
}
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
@interface DefaultFloat {
float value();
}
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
@interface DefaultString {
String value();
}
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
@interface Pattern {
String value();
}
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
@interface DefaultEnum {
String value();
}
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
@interface DefaultStringList {
String[] value();
}
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
@interface Name {
String value();
}
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.TYPE})
@interface RequiresMcRestart {
}
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.TYPE})
@interface RequiresWorldRestart {
}
}
@@ -1,15 +0,0 @@
package com.gtnewhorizons.angelica.config;
/**
* A really basic wrapper for config to simplify handling them in external code.
*/
public class ConfigException extends Exception {
public ConfigException(String message) {
super(message);
}
public ConfigException(Throwable cause) {
super(cause);
}
}
@@ -1,267 +0,0 @@
package com.gtnewhorizons.angelica.config;
import cpw.mods.fml.client.config.IConfigElement;
import cpw.mods.fml.client.event.ConfigChangedEvent;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import lombok.SneakyThrows;
import lombok.val;
import net.minecraft.launchwrapper.Launch;
import net.minecraftforge.common.config.ConfigElement;
import net.minecraftforge.common.config.Configuration;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.File;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
* Class for controlling the loading of configuration files.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class ConfigurationManager {
private static final Logger LOGGER = LogManager.getLogger("ArchaicConfig");
private static final Map<String, Configuration> configs = new HashMap<>();
private static final Map<Configuration, Set<Class<?>>> configToClassMap = new HashMap<>();
private static final ConfigurationManager instance = new ConfigurationManager();
private static boolean initialized = false;
private static Path configDir;
/**
* Registers a configuration class to be loaded. This should be done in preInit.
*
* @param configClass The class to register.
*/
public static void registerConfig(Class<?> configClass) throws ConfigException {
init();
val cfg = Optional.ofNullable(configClass.getAnnotation(Config.class))
.orElseThrow(() -> new ConfigException(
"Class " + configClass.getName() + " does not have a @Config annotation!"));
val category = Optional.of(cfg.category().trim())
.map((cat) -> cat.length() == 0 ? null : cat)
.orElseThrow(() -> new ConfigException(
"Config class " + configClass.getName() + " has an empty category!"));
val rawConfig = configs.computeIfAbsent(cfg.modid(), (ignored) -> {
val c = new Configuration(configDir.resolve(cfg.modid() + ".cfg").toFile());
c.load();
return c;
});
configToClassMap.computeIfAbsent(rawConfig, (ignored) -> new HashSet<>()).add(configClass);
try {
processConfigInternal(configClass, category, rawConfig);
rawConfig.save();
} catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException | NoSuchFieldException e) {
throw new ConfigException(e);
}
}
private static void processConfigInternal(Class<?> configClass, String category, Configuration rawConfig)
throws IllegalAccessException, NoSuchMethodException, InvocationTargetException, NoSuchFieldException,
ConfigException {
val cat = rawConfig.getCategory(category);
for (val field : configClass.getDeclaredFields()) {
if (field.getAnnotation(Config.Ignore.class) != null) {
continue;
}
field.setAccessible(true);
val comment = Optional.ofNullable(field.getAnnotation(Config.Comment.class))
.map(Config.Comment::value)
.map((lines) -> String.join("\n", lines))
.orElse("");
val name = Optional.ofNullable(field.getAnnotation(Config.Name.class))
.map(Config.Name::value)
.orElse(field.getName());
val langKey = Optional.ofNullable(field.getAnnotation(Config.LangKey.class))
.map(Config.LangKey::value)
.orElse(name);
val fieldClass = field.getType();
var boxed = false;
if ((boxed = fieldClass.equals(Boolean.class)) || fieldClass.equals(boolean.class)) {
val defaultValue = Optional.ofNullable(field.getAnnotation(Config.DefaultBoolean.class))
.map(Config.DefaultBoolean::value)
.orElse(boxed ? (Boolean) field.get(null) : field.getBoolean(null));
field.setBoolean(null, rawConfig.getBoolean(name, category, defaultValue, comment, langKey));
} else if ((boxed = fieldClass.equals(Integer.class)) || fieldClass.equals(int.class)) {
val range = Optional.ofNullable(field.getAnnotation(Config.RangeInt.class));
val min = range.map(Config.RangeInt::min).orElse(Integer.MIN_VALUE);
val max = range.map(Config.RangeInt::max).orElse(Integer.MAX_VALUE);
val defaultValue = Optional.ofNullable(field.getAnnotation(Config.DefaultInt.class))
.map(Config.DefaultInt::value)
.orElse(boxed ? (Integer) field.get(null) : field.getInt(null));
field.setInt(null, rawConfig.getInt(name, category, defaultValue, min, max, comment, langKey));
} else if ((boxed = fieldClass.equals(Float.class)) || fieldClass.equals(float.class)) {
val range = Optional.ofNullable(field.getAnnotation(Config.RangeFloat.class));
val min = range.map(Config.RangeFloat::min).orElse(Float.MIN_VALUE);
val max = range.map(Config.RangeFloat::max).orElse(Float.MAX_VALUE);
val defaultValue = Optional.ofNullable(field.getAnnotation(Config.DefaultFloat.class))
.map(Config.DefaultFloat::value)
.orElse(boxed ? (Float) field.get(null) : field.getFloat(null));
field.setFloat(null, rawConfig.getFloat(name, category, defaultValue, min, max, comment, langKey));
} else if (fieldClass.equals(String.class)) {
val defaultValue = Optional.ofNullable(field.getAnnotation(Config.DefaultString.class))
.map(Config.DefaultString::value)
.orElse((String) field.get(null));
val pattern = Optional.ofNullable(field.getAnnotation(Config.Pattern.class))
.map(Config.Pattern::value)
.map(Pattern::compile)
.orElse(null);
field.set(null, rawConfig.getString(name, category, defaultValue, comment, langKey, pattern));
} else if (fieldClass.isEnum()) {
val enumValues = Arrays.stream((Object[]) fieldClass.getDeclaredMethod("values").invoke(null))
.map((obj) -> (Enum<?>) obj)
.collect(Collectors.toList());
val defaultValue = (Enum<?>) Optional.ofNullable(field.getAnnotation(Config.DefaultEnum.class))
.map(Config.DefaultEnum::value)
.map((defName) -> extractField(fieldClass, defName))
.map(ConfigurationManager::extractValue)
.orElse(field.get(null));
val possibleValues = enumValues.stream().map(Enum::name).toArray(String[]::new);
var value = rawConfig.getString(name,
category,
defaultValue.name(),
comment + "\nPossible values: " + Arrays.toString(possibleValues) +
"\n",
possibleValues,
langKey);
try {
if (!Arrays.asList(possibleValues).contains(value)) {
throw new NoSuchFieldException();
}
val enumField = fieldClass.getDeclaredField(value);
if (!enumField.isEnumConstant()) {
throw new NoSuchFieldException();
}
field.set(null, enumField.get(null));
} catch (NoSuchFieldException e) {
LOGGER
.warn("Invalid value " + value + " for enum configuration field " + field.getName() +
" of type " + fieldClass.getName() + " in config class " +
configClass.getName() + "! Using default value of " + defaultValue + "!");
field.set(null, defaultValue);
}
} else if (fieldClass.isArray() && fieldClass.getComponentType().equals(String.class)) {
val defaultValue = Optional.ofNullable(field.getAnnotation(Config.DefaultStringList.class)).map(Config.DefaultStringList::value).orElse((String[])field.get(null));
var value = rawConfig.getStringList(name, category, defaultValue, comment, null, langKey);
field.set(null, value);
} else {
throw new ConfigException("Illegal config field: " + field.getName() + " in " + configClass.getName() +
": Unsupported type " + fieldClass.getName() +
"! Did you forget an @Ignore annotation?");
}
if (field.isAnnotationPresent(Config.RequiresMcRestart.class)) {
cat.setRequiresMcRestart(true);
}
if (field.isAnnotationPresent(Config.RequiresWorldRestart.class)) {
cat.setRequiresWorldRestart(true);
}
}
}
@SneakyThrows
private static Field extractField(Class<?> clazz, String field) {
return clazz.getDeclaredField(field);
}
@SneakyThrows
private static Object extractValue(Field field) {
return field.get(null);
}
/**
* Process the configuration into a list of config elements usable in config GUI code.
*
* @param configClass The class to process.
*
* @return The configuration elements.
*/
@SuppressWarnings({"rawtypes", "unchecked"})
public static List<IConfigElement> getConfigElements(Class<?> configClass) throws ConfigException {
init();
val cfg = Optional.ofNullable(configClass.getAnnotation(Config.class))
.orElseThrow(() -> new ConfigException(
"Class " + configClass.getName() + " does not have a @Config annotation!"));
val rawConfig = Optional.ofNullable(configs.get(cfg.modid()))
.map((conf) -> Optional.ofNullable(configToClassMap.get(conf))
.map((l) -> l.contains(configClass))
.orElse(false) ? conf : null)
.orElseThrow(() -> new ConfigException(
"Tried to get config elements for non-registered config class!"));
val category = cfg.category();
val elements = new ConfigElement<>(rawConfig.getCategory(category)).getChildElements();
return elements.stream().map((element) -> new IConfigElementProxy(element, () -> {
try {
processConfigInternal(configClass, category, rawConfig);
rawConfig.save();
} catch (IllegalAccessException |
NoSuchMethodException |
InvocationTargetException |
NoSuchFieldException |
ConfigException e) {
e.printStackTrace();
}
})).collect(Collectors.toList());
}
private static File minecraftHome() {
return Launch.minecraftHome != null ? Launch.minecraftHome : new File(".");
}
private static void init() {
if (initialized) {
return;
}
configDir = minecraftHome().toPath().resolve("config");
initialized = true;
}
/**
* Internal, do not use.
*/
public static void registerBus() {
FMLCommonHandler.instance().bus().register(instance);
}
/**
* Internal, do not use.
*
* @param event The event.
*/
@SubscribeEvent
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) {
init();
val config = configs.get(event.modID);
if (config == null) {
return;
}
val configClasses = configToClassMap.get(config);
configClasses.forEach((configClass) -> {
try {
val category = Optional.ofNullable(configClass.getAnnotation(Config.class))
.map(Config::category)
.orElseThrow(() -> new ConfigException(
"Failed to get config category for class " + configClass.getName()));
processConfigInternal(configClass, category, config);
} catch (Exception e) {
e.printStackTrace();
}
});
}
}
@@ -1,158 +0,0 @@
package com.gtnewhorizons.angelica.config;
import cpw.mods.fml.client.config.ConfigGuiType;
import cpw.mods.fml.client.config.GuiConfigEntries;
import cpw.mods.fml.client.config.GuiEditArrayEntries;
import cpw.mods.fml.client.config.IConfigElement;
import java.util.List;
import java.util.regex.Pattern;
public class IConfigElementProxy<T> implements IConfigElement<T> {
private final IConfigElement<T> proxied;
private final Runnable onUpdate;
public IConfigElementProxy(IConfigElement<T> proxied, Runnable onUpdate) {
this.proxied = proxied;
this.onUpdate = onUpdate;
}
@Override
public boolean isProperty() {
return proxied.isProperty();
}
@SuppressWarnings("rawtypes")
@Override
public Class<? extends GuiConfigEntries.IConfigEntry> getConfigEntryClass() {
return proxied.getConfigEntryClass();
}
@Override
public Class<? extends GuiEditArrayEntries.IArrayEntry> getArrayEntryClass() {
return proxied.getArrayEntryClass();
}
@Override
public String getName() {
return proxied.getName();
}
@Override
public String getQualifiedName() {
return proxied.getQualifiedName();
}
@Override
public String getLanguageKey() {
return proxied.getLanguageKey();
}
@Override
public String getComment() {
return proxied.getComment();
}
@SuppressWarnings("rawtypes")
@Override
public List<IConfigElement> getChildElements() {
return proxied.getChildElements();
}
@Override
public ConfigGuiType getType() {
return proxied.getType();
}
@Override
public boolean isList() {
return proxied.isList();
}
@Override
public boolean isListLengthFixed() {
return proxied.isListLengthFixed();
}
@Override
public int getMaxListLength() {
return proxied.getMaxListLength();
}
@Override
public boolean isDefault() {
return proxied.isDefault();
}
@Override
public Object getDefault() {
return proxied.getDefault();
}
@Override
public Object[] getDefaults() {
return proxied.getDefaults();
}
@Override
public void setToDefault() {
proxied.setToDefault();
}
@Override
public boolean requiresWorldRestart() {
return proxied.requiresWorldRestart();
}
@Override
public boolean showInGui() {
return proxied.showInGui();
}
@Override
public boolean requiresMcRestart() {
return proxied.requiresMcRestart();
}
@Override
public Object get() {
return proxied.get();
}
@Override
public Object[] getList() {
return proxied.getList();
}
@Override
public void set(T value) {
proxied.set(value);
onUpdate.run();
}
@Override
public void set(T[] aVal) {
proxied.set(aVal);
onUpdate.run();
}
@Override
public String[] getValidValues() {
return proxied.getValidValues();
}
@Override
public T getMinValue() {
return proxied.getMinValue();
}
@Override
public T getMaxValue() {
return proxied.getMaxValue();
}
@Override
public Pattern getValidationPattern() {
return proxied.getValidationPattern();
}
}
@@ -1,13 +0,0 @@
package com.gtnewhorizons.angelica.config;
import cpw.mods.fml.client.config.GuiConfig;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.gui.GuiScreen;
@SideOnly(Side.CLIENT)
public class SimpleGuiConfig extends GuiConfig {
public SimpleGuiConfig(GuiScreen parent, Class<?> configClass, String modID, String modName) throws ConfigException {
super(parent, ConfigurationManager.getConfigElements(configClass), modID, false, false, modName + " Configuration");
}
}
@@ -1,26 +0,0 @@
package com.gtnewhorizons.angelica.config;
import cpw.mods.fml.client.IModGuiFactory;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import java.util.Set;
@SideOnly(Side.CLIENT)
public interface SimpleGuiFactory extends IModGuiFactory {
@Override
default void initialize(Minecraft minecraftInstance) {
}
@Override
default Set<RuntimeOptionCategoryElement> runtimeGuiCategories() {
return null;
}
@Override
default RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) {
return null;
}
}
@@ -847,7 +847,9 @@ public class GLStateManager {
public static void glDrawArrays(int mode, int first, int count) {
// Iris -- TODO: This doesn't seem to work and is related to matchPass()
Iris.getPipelineManager().getPipeline().ifPresent(WorldRenderingPipeline::syncProgram);
if(AngelicaConfig.enableIris) {
Iris.getPipelineManager().getPipeline().ifPresent(WorldRenderingPipeline::syncProgram);
}
GL11.glDrawArrays(mode, first, count);
}
@@ -1106,6 +1108,13 @@ public class GLStateManager {
public static void glLoadMatrix(FloatBuffer m) {
getMatrixStack().set(m);
GL11.glLoadMatrix(m);
}
public static void glLoadMatrix(DoubleBuffer m) {
conversionMatrix4d.set(m);
getMatrixStack().set(conversionMatrix4d);
GL11.glLoadMatrix(m);
}
public static Matrix4fStack getMatrixStack() {
@@ -1151,16 +1160,16 @@ public class GLStateManager {
public static void glMultMatrix(FloatBuffer floatBuffer) {
GL11.glMultMatrix(floatBuffer);
tempMatrix4f.set(floatBuffer);
getMatrixStack().mul(conersionMatrix4f);
getMatrixStack().mul(tempMatrix4f);
}
public static final Matrix4d conersionMatrix4d = new Matrix4d();
public static final Matrix4f conersionMatrix4f = new Matrix4f();
public static final Matrix4d conversionMatrix4d = new Matrix4d();
public static final Matrix4f conversionMatrix4f = new Matrix4f();
public static void glMultMatrix(DoubleBuffer matrix) {
GL11.glMultMatrix(matrix);
conersionMatrix4d.set(matrix);
conersionMatrix4f.set(conersionMatrix4d);
getMatrixStack().mul(conersionMatrix4f);
conversionMatrix4d.set(matrix);
conversionMatrix4f.set(conversionMatrix4d);
getMatrixStack().mul(conversionMatrix4f);
}
private static final Vector3f rotation = new Vector3f();
@@ -1,16 +1,15 @@
package com.gtnewhorizons.angelica.glsm;
import com.gtnewhorizons.angelica.api.QuadView;
import com.gtnewhorizons.angelica.client.renderer.CapturingTessellator;
import com.gtnewhorizons.angelica.compat.mojang.VertexBuffer;
import com.gtnewhorizons.angelica.compat.mojang.VertexFormat;
import com.gtnewhorizons.angelica.compat.nd.Quad;
import net.minecraft.client.renderer.Tessellator;
import org.lwjgl.opengl.GL11;
import java.nio.ByteBuffer;
import java.util.List;
import org.lwjgl.opengl.GL11;
@SuppressWarnings("unused")
public class TessellatorManager {
private static final ThreadLocal<CapturingTessellator> capturingTessellator = ThreadLocal.withInitial(CapturingTessellator::new);
@@ -51,7 +50,7 @@ public class TessellatorManager {
* Stop the CapturingTessellator and return the pooled quads. The quads are valid until clearQuads() is
* called on the CapturingTesselator, which must be done before starting capturing again.
*/
public static List<Quad> stopCapturingToPooledQuads() {
public static List<QuadView> stopCapturingToPooledQuads() {
if(!currentlyCapturing.get()) throw new IllegalStateException("Tried to stop capturing when not capturing!");
currentlyCapturing.set(false);
final CapturingTessellator tess = capturingTessellator.get();
@@ -59,7 +58,7 @@ public class TessellatorManager {
// Be sure we got all the quads
if(tess.isDrawing) tess.draw();
final List<Quad> quads = tess.getQuads();
final List<QuadView> quads = tess.getQuads();
tess.discard();
tess.restoreTranslation();
@@ -1,8 +1,8 @@
package com.gtnewhorizons.angelica.glsm;
import com.gtnewhorizons.angelica.compat.mojang.VertexBuffer;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import it.unimi.dsi.fastutil.objects.ObjectList;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
public class VBOManager {
// Not thread safe, only expected to be called from the main thread
@@ -13,7 +13,7 @@ public class VBOManager {
return nextDisplayList++;
}
private static ObjectList<VertexBuffer> vertexBuffers = new ObjectArrayList<>(1);
private static Int2ObjectMap<VertexBuffer> vertexBuffers = new Int2ObjectOpenHashMap<>();
/*
* Allocate a (range) of "display list IDs" that will refer to a VBO in the arraylist of vertex buffers.
@@ -33,16 +33,13 @@ public class VBOManager {
public static VertexBuffer registerVBO(int displayList, VertexBuffer vertexBuffer) {
if(displayList > 0) throw new IllegalArgumentException("Display list must be negative!");
displayList -= Integer.MIN_VALUE;
final int requestedSize = displayList + 1;
if(requestedSize + 1 > vertexBuffers.size()) {
vertexBuffers.size(requestedSize);
}
vertexBuffers.set(displayList, vertexBuffer);
vertexBuffers.put(displayList, vertexBuffer);
return vertexBuffer;
}
public static VertexBuffer get(int list) {
list -= Integer.MIN_VALUE;
return vertexBuffers.get(list);
return vertexBuffers.getOrDefault(list, null);
}
}
@@ -2,6 +2,7 @@ package com.gtnewhorizons.angelica.glsm.stacks;
import com.gtnewhorizons.angelica.glsm.GLStateManager;
import com.gtnewhorizons.angelica.glsm.states.BooleanState;
import org.lwjgl.opengl.GL11;
public class BooleanStateStack extends BooleanState implements IStateStack<BooleanStateStack> {
@@ -32,7 +33,9 @@ public class BooleanStateStack extends BooleanState implements IStateStack<Boole
}
set(stack[--pointer]);
this.setEnabled(this.enabled);
if (GLStateManager.isAMD() && glCap == GL11.GL_BLEND) {
setEnabled(enabled);
}
return this;
}
@@ -3,6 +3,12 @@ package com.gtnewhorizons.angelica.hudcaching;
import java.util.ArrayList;
import java.util.List;
import com.gtnewhorizons.angelica.compat.ModStatus;
import com.gtnewhorizons.angelica.mixins.early.angelica.hudcaching.RenderGameOverlayEventAccessor;
import cpw.mods.fml.common.eventhandler.EventPriority;
import net.dries007.holoInventory.client.Renderer;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.event.world.WorldEvent;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL30;
@@ -26,6 +32,9 @@ import net.minecraft.client.settings.KeyBinding;
import net.minecraft.client.shader.Framebuffer;
import net.minecraft.util.ChatComponentText;
import net.minecraftforge.client.GuiIngameForge;
import xaero.common.core.XaeroMinimapCore;
import static com.gtnewhorizons.angelica.loading.AngelicaTweaker.LOGGER;
// See LICENSE+HUDCaching.md for license information.
@@ -33,10 +42,6 @@ public class HUDCaching {
private static final Minecraft mc = Minecraft.getMinecraft();
public static Framebuffer framebuffer;
static {
framebuffer = new Framebuffer(0, 0, true);
framebuffer.setFramebufferColor(0, 0, 0, 0);
}
private static boolean dirty = true;
public static boolean renderingCacheOverride;
@@ -54,6 +59,8 @@ public class HUDCaching {
// Crosshairs need to be blended with the scene
public static boolean renderCrosshairsCaptured;
private static RenderGameOverlayEvent fakeHoloInventoryEvent = new RenderGameOverlayEvent.Pre(new RenderGameOverlayEvent(0, null, 0, 0), RenderGameOverlayEvent.ElementType.HELMET);
public static final HUDCaching INSTANCE = new HUDCaching();
@@ -63,9 +70,13 @@ public class HUDCaching {
private final List<Long> updateTimeList = new ArrayList<>(21);
private static boolean isEnabled = true;
private static final KeyBinding toggle = new KeyBinding("Toggle HUDCaching", 0, "Debug");
// moved initialization to when its registered to avoid an empty Debug category, which can cause crashes when
// opening the controls menu and hudcaching is disabled in the config
private static KeyBinding toggle;
public static void registerKeyBindings() {
toggle = new KeyBinding("Toggle HUDCaching", 0, "Debug");
ClientRegistry.registerKeyBinding(toggle);
}
@@ -86,7 +97,7 @@ public class HUDCaching {
@SubscribeEvent
public void onKeypress(InputEvent.KeyInputEvent event) {
if (toggle.isPressed()) {
if (toggle != null && toggle.isPressed()) {
isEnabled = !isEnabled;
final String msg = isEnabled ? "Enabled HUDCaching" : "Disabled HUDCaching";
if (mc.thePlayer != null) mc.thePlayer.addChatMessage(new ChatComponentText(msg));
@@ -102,10 +113,25 @@ public class HUDCaching {
}
}
// highest so it runs before the GLSM load event
@SubscribeEvent(priority = EventPriority.HIGH)
public void onJoinWorld(WorldEvent.Load event) {
if (event.world.isRemote){
LOGGER.info("World loaded - Initializing HUDCaching");
HUDCaching.framebuffer = new Framebuffer(0, 0, true);
HUDCaching.framebuffer.setFramebufferColor(0, 0, 0, 0);
}
}
@SuppressWarnings("unused")
public static void renderCachedHud(EntityRenderer renderer, GuiIngame ingame, float partialTicks, boolean hasScreen, int mouseX, int mouseY) {
if (!OpenGlHelper.isFramebufferEnabled() || !isEnabled) {
if (ModStatus.isXaerosMinimapLoaded && ingame instanceof GuiIngameForge) {
// this used to be called by asming into renderGameOverlay, but we removed it
XaeroMinimapCore.beforeIngameGuiRender(partialTicks);
}
if (!OpenGlHelper.isFramebufferEnabled() || !isEnabled || framebuffer == null) {
ingame.renderGameOverlay(partialTicks, hasScreen, mouseX, mouseY);
return;
}
@@ -138,11 +164,16 @@ public class HUDCaching {
} else {
GLStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
}
if (ingame instanceof GuiIngameForge) {
GuiIngameForgeAccessor guiForge = ((GuiIngameForgeAccessor) ingame);
if (renderHelmetCaptured) {
guiForge.callRenderHelmet(resolution, partialTicks, hasScreen, mouseX, mouseY);
if (ModStatus.isHoloInventoryLoaded){
Renderer.INSTANCE.angelicaOverride = false;
// only settings the partial ticks as mouseX and mouseY are not used in renderEvent
((RenderGameOverlayEventAccessor) fakeHoloInventoryEvent).setPartialTicks(partialTicks);
Renderer.INSTANCE.renderEvent(fakeHoloInventoryEvent);
}
}
if (renderPortalCapturedTicks > 0) {
guiForge.callRenderPortal(width, height, partialTicks);
@@ -150,6 +181,7 @@ public class HUDCaching {
if (renderCrosshairsCaptured) {
guiForge.callRenderCrosshairs(width, height);
}
} else {
if (renderHelmetCaptured)
{
@@ -213,4 +245,11 @@ public class HUDCaching {
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
}
// moved to here due to the method being called from a mixin
public static void disableHoloInventory() {
if (ModStatus.isHoloInventoryLoaded){
Renderer.INSTANCE.angelicaOverride = isEnabled;
}
}
}
@@ -1,16 +1,16 @@
package com.gtnewhorizons.angelica.loading;
import com.google.common.collect.ImmutableMap;
import com.gtnewhorizon.gtnhlib.config.ConfigException;
import com.gtnewhorizon.gtnhlib.config.ConfigurationManager;
import com.gtnewhorizon.gtnhmixins.IEarlyMixinLoader;
import com.gtnewhorizons.angelica.config.AngelicaConfig;
import com.gtnewhorizons.angelica.config.ConfigException;
import com.gtnewhorizons.angelica.config.ConfigurationManager;
import com.gtnewhorizons.angelica.mixins.Mixins;
import com.gtnewhorizons.angelica.mixins.TargetedMod;
import cpw.mods.fml.relauncher.FMLLaunchHandler;
import com.gtnewhorizons.angelica.transform.compat.CompatASMTransformers;
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
import mist475.mcpatcherforge.asm.AsmTransformers;
import mist475.mcpatcherforge.asm.mappings.Namer;
import jss.notfine.asm.AsmTransformers;
import jss.notfine.asm.mappings.Namer;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -21,7 +21,7 @@ import org.spongepowered.asm.launch.GlobalProperties;
import org.spongepowered.asm.service.mojang.MixinServiceLaunchWrapper;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -47,6 +47,15 @@ public class AngelicaTweaker implements IFMLLoadingPlugin, IEarlyMixinLoader {
loggerConfig.setLevel(Level.DEBUG);
}
ctx.updateLoggers();
// Too many bug reports because people refuse to read or just want to try it - so make these only able
// to be enabled by system properties for now.
AngelicaConfig.enableIris = Boolean.parseBoolean(System.getProperty("angelica.enableShaders", "false"));
AngelicaConfig.enableMCPatcherForgeFeatures = Boolean.parseBoolean(System.getProperty("angelica.enableMCPatcherForgeFeatures", "false"));
// Debug features
AngelicaConfig.enableTestBlocks = Boolean.parseBoolean(System.getProperty("angelica.enableTestBlocks", "false"));
} catch (ConfigException e) {
throw new RuntimeException(e);
}
@@ -61,10 +70,17 @@ public class AngelicaTweaker implements IFMLLoadingPlugin, IEarlyMixinLoader {
}
// Return any others here
if (transformerClasses == null) {
//Mod Compat transformers
List<String> transformers = new ArrayList<String>();
transformers.addAll(CompatASMTransformers.getTransformers());
//NotFine transformers
Namer.initNames();
transformerClasses = AsmTransformers.getTransformers();
transformers.addAll(Arrays.asList(AsmTransformers.getTransformers()));
transformerClasses = transformers.toArray(new String[0]);
}
return transformerClasses;
}
@@ -21,19 +21,42 @@ public class MixinCompatHackTweaker implements ITweaker {
@Override
public void acceptOptions(List<String> args, File gameDir, File assetsDir, String profile) {
verifyDependencies();
if(DISABLE_OPTIFINE_AND_FASTCRAFT) {
LOGGER.info("Disabling Optifine and Fastcraft (if present)");
disableOptifineAndFastcraft();
}
if (AngelicaConfig.enableHudCaching){
disableXaerosMinimapWaypointTransformer();
}
}
private void verifyDependencies() {
if(MixinCompatHackTweaker.class.getResource("/it/unimi/dsi/fastutil/ints/Int2ObjectMap.class") == null) {
throw new RuntimeException("Missing dependency: Angelica requires GTNHLib 0.2.1 or newer! Download: https://modrinth.com/mod/gtnhlib");
}
}
private void disableXaerosMinimapWaypointTransformer(){
try {
LaunchClassLoader lcl = Launch.classLoader;
Field xformersField = lcl.getClass().getDeclaredField("transformers");
xformersField.setAccessible(true);
@SuppressWarnings("unchecked")
List<IClassTransformer> xformers = (List<IClassTransformer>) xformersField.get(lcl);
for (int idx = xformers.size() - 1; idx >= 0; idx--) {
final String name = xformers.get(idx).getClass().getName();
if (name.startsWith("xaero.common.core.transformer.GuiIngameForgeTransformer")) {
LOGGER.info("Removing transformer " + name);
xformers.remove(idx);
}
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
private void disableOptifineAndFastcraft() {
// Remove Optifine and Fastcraft transformers & Mod Containers
try {
@@ -82,8 +105,12 @@ public class MixinCompatHackTweaker implements ITweaker {
@Override
public String[] getLaunchArguments() {
if (FMLLaunchHandler.side().isClient()) {
// Run after Mixins, but before LWJGl3ify
Launch.classLoader.registerTransformer(RedirectorTransformer.class.getName());
final boolean rfbLoaded = Launch.blackboard.getOrDefault("angelica.rfbPluginLoaded", Boolean.FALSE) == Boolean.TRUE;
if (!rfbLoaded) {
// Run after Mixins, but before LWJGl3ify
Launch.classLoader.registerTransformer(RedirectorTransformer.class.getName());
}
if(AngelicaConfig.enableSodium) {
Launch.classLoader.registerTransformer(BlockTransformer.class.getName());
}
@@ -0,0 +1,28 @@
package com.gtnewhorizons.angelica.loading.rfb;
import com.gtnewhorizons.retrofuturabootstrap.api.PluginContext;
import com.gtnewhorizons.retrofuturabootstrap.api.RetroFuturaBootstrap;
import com.gtnewhorizons.retrofuturabootstrap.api.RfbClassTransformer;
import com.gtnewhorizons.retrofuturabootstrap.api.RfbPlugin;
import net.minecraft.launchwrapper.Launch;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class AngelicaRfbPlugin implements RfbPlugin {
@Override
public void onConstruction(@NotNull PluginContext ctx) {
Launch.blackboard.put("angelica.rfbPluginLoaded", Boolean.TRUE);
}
@Override
public @NotNull RfbClassTransformer @Nullable [] makeTransformers() {
final boolean isServer = (null == RetroFuturaBootstrap.API.launchClassLoader().findClassMetadata("net.minecraft.client.main.Main"));
if (isServer) {
return null;
}
return new RfbClassTransformer[] {
new RedirectorTransformerWrapper()
};
}
}
@@ -0,0 +1,61 @@
package com.gtnewhorizons.angelica.loading.rfb;
import com.gtnewhorizons.angelica.transform.RedirectorTransformer;
import com.gtnewhorizons.retrofuturabootstrap.api.ClassNodeHandle;
import com.gtnewhorizons.retrofuturabootstrap.api.ExtensibleClassLoader;
import com.gtnewhorizons.retrofuturabootstrap.api.RfbClassTransformer;
import org.intellij.lang.annotations.Pattern;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.jar.Manifest;
/** RFB wrapper for {@link com.gtnewhorizons.angelica.transform.RedirectorTransformer} */
public class RedirectorTransformerWrapper implements RfbClassTransformer {
public final RedirectorTransformer inner = new RedirectorTransformer();
@Pattern("[a-z0-9-]+")
@Override
public @NotNull String id() {
return "redirector";
}
@Override
public @NotNull String @Nullable [] sortAfter() {
return new String[] {"*", "mixin:mixin"};
}
@Override
public @NotNull String @Nullable [] sortBefore() {
return new String[] {"lwjgl3ify:redirect"};
}
@Override
public @NotNull String @Nullable [] additionalExclusions() {
return RedirectorTransformer.getTransformerExclusions().toArray(new String[0]);
}
@Override
public boolean shouldTransformClass(@NotNull ExtensibleClassLoader classLoader,
@NotNull RfbClassTransformer.Context context, @Nullable Manifest manifest, @NotNull String className,
@NotNull ClassNodeHandle classNode) {
if (!classNode.isPresent()) {
return false;
}
if (!classNode.isOriginal()) {
// If a class is already a transformed ClassNode, conservatively continue processing.
return true;
}
return inner.shouldRfbTransform(classNode.getOriginalBytes());
}
@Override
public void transformClass(@NotNull ExtensibleClassLoader classLoader, @NotNull RfbClassTransformer.Context context,
@Nullable Manifest manifest, @NotNull String className, @NotNull ClassNodeHandle classNode) {
final boolean changed = inner.transformClassNode(className, classNode.getNode());
if (changed) {
classNode.computeMaxs();
}
}
}
@@ -1,10 +1,12 @@
package com.gtnewhorizons.angelica.mixins;
import com.gtnewhorizons.angelica.AngelicaMod;
import com.gtnewhorizons.angelica.compat.ModStatus;
import com.gtnewhorizons.angelica.config.AngelicaConfig;
import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
import cpw.mods.fml.relauncher.FMLLaunchHandler;
import mist475.mcpatcherforge.config.MCPatcherForgeConfig;
import jss.notfine.config.MCPatcherForgeConfig;
import jss.notfine.config.NotFineConfig;
import java.util.ArrayList;
import java.util.Arrays;
@@ -96,6 +98,7 @@ public enum Mixins {
,"sodium.MixinExtendedBlockStorage"
,"sodium.MixinEntityRenderer"
,"sodium.MixinFMLClientHandler"
,"sodium.MixinForgeHooksClient"
,"sodium.MixinGameSettings"
,"sodium.MixinFrustrum"
,"sodium.MixinMaterial"
@@ -106,19 +109,11 @@ public enum Mixins {
,"sodium.MixinWorldClient"
,"sodium.MixinTessellator"
,"sodium.MixinTileEntity"
,"sodium.MixinGuiIngameForge"
,"sodium.MixinEffectRenderer"
,"sodium.MixinTileEntityRendererDispatcher"
,"sodium.MixinLongHashMap"
,"sodium.MixinRender"
,"sodium.MixinRenderingRegistry"
)
),
SODIUM_DYN_SURROUND(new Builder("Sodium without Dynamic Surroundings").addTargetedMod(TargetedMod.VANILLA)
.addExcludedMod(TargetedMod.DYNAMIC_SURROUNDINGS_MIST).addExcludedMod(TargetedMod.DYNAMIC_SURROUNDINGS_ORIGINAL).setSide(Side.CLIENT)
.setPhase(Phase.EARLY).setApplyIf(() -> AngelicaConfig.enableSodium).addMixinClasses(
"sodium.MixinEntityRenderer$WeatherQuality"
,"sodium.MixinPlayerManager"
)
),
@@ -136,6 +131,7 @@ public enum Mixins {
,"shaders.MixinOpenGlHelper"
,"shaders.MixinRender"
,"shaders.MixinRenderGlobal"
,"shaders.MixinRenderManager"
)
),
@@ -161,6 +157,7 @@ public enum Mixins {
.setApplyIf(() -> AngelicaConfig.enableHudCaching).addMixinClasses(
"angelica.hudcaching.GuiIngameAccessor",
"angelica.hudcaching.GuiIngameForgeAccessor",
"angelica.hudcaching.RenderGameOverlayEventAccessor",
"angelica.hudcaching.MixinEntityRenderer_HUDCaching",
"angelica.hudcaching.MixinFramebuffer_HUDCaching",
"angelica.hudcaching.MixinGuiIngame_HUDCaching",
@@ -187,6 +184,14 @@ public enum Mixins {
"angelica.animation.MixinWorldRenderer",
"angelica.animation.MixinRenderItem")),
EXTRA_UTILITIES_THREAD_SAFETY(new Builder("Enable thread safety fixes in Extra Utilities").setPhase(Phase.LATE)
.addTargetedMod(TargetedMod.EXTRAUTILS).setSide(Side.CLIENT)
.setApplyIf(() -> AngelicaConfig.fixExtraUtilsSodiumCompat)
.addMixinClasses(
"client.extrautils.MixinRenderBlockConnectedTextures",
"client.extrautils.MixinRenderBlockConnectedTexturesEthereal",
"client.extrautils.MixinIconConnectedTexture")),
SPEEDUP_CAMPFIRE_BACKPORT_ANIMATIONS(new Builder("Add animation speedup support to Campfire Backport").setPhase(Phase.LATE)
.addTargetedMod(TargetedMod.CAMPFIRE_BACKPORT).setSide(Side.CLIENT)
.setApplyIf(() -> AngelicaConfig.speedupAnimations)
@@ -200,109 +205,134 @@ public enum Mixins {
.addMixinClasses("angelica.textures.MixinTextureUtil_OptimizeMipmap").addTargetedMod(TargetedMod.VANILLA)
.setApplyIf(() -> AngelicaConfig.optimizeTextureLoading).setSide(Side.CLIENT)),
NOTFINE_OPTIMIZATION(new Builder("NotFine Optimizations").addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT)
.setPhase(Phase.EARLY).setApplyIf(() -> AngelicaConfig.enableNotFineOptimizations).addMixinClasses(
"notfine.faceculling.MixinBlock"
,"notfine.faceculling.MixinBlockSlab"
,"notfine.faceculling.MixinBlockSnow"
,"notfine.faceculling.MixinBlockStairs"
)),
//From NotFine
NOTFINE_BASE_MOD(new Builder("NotFine")
.setSide(Side.CLIENT).setPhase(Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableNotFineFeatures)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses(addPrefix("notfine.",
"clouds.MixinEntityRenderer",
"clouds.MixinGameSettings",
//"clouds.MixinRenderGlobal",
"clouds.MixinWorldType",
NOTFINE_FEATURES(new Builder("NotFine Features").addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT)
.setPhase(Phase.EARLY).setApplyIf(() -> AngelicaConfig.enableNotFineFeatures).addMixinClasses(
//"notfine.clouds.MixinEntityRenderer"
//,"notfine.clouds.MixinGameSettings"
//,"notfine.clouds.MixinRenderGlobal"
//,"notfine.clouds.MixinWorldType"
"notfine.glint.MixinRenderBiped"
,"notfine.glint.MixinRenderItem"
,"notfine.glint.MixinRenderPlayer"
,"notfine.gui.MixinGuiSlot"
,"notfine.leaves.MixinBlockLeaves"
,"notfine.leaves.MixinBlockLeavesBase"
//,"notfine.particles.MixinBlockEnchantmentTable"
//,"notfine.particles.MixinEffectRenderer"
//,"notfine.particles.MixinWorldClient"
//,"notfine.particles.MixinWorldProvider"
,"notfine.renderer.MixinRenderGlobal"
,"notfine.settings.MixinGameSettings"
//,"notfine.toggle.MixinGuiIngame"
//,"notfine.toggle.MixinEntityRenderer"
//,"notfine.toggle.MixinRender" --> No Sodium below
//,"notfine.toggle.MixinRenderItem"
)),
"fix.MixinRenderItem",
NOTFINE_FEATURES_NO_SODIUM(new Builder("NotFine Features").addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT)
.setPhase(Phase.EARLY).setApplyIf(() -> AngelicaConfig.enableNotFineFeatures && !AngelicaConfig.enableSodium).addMixinClasses(
"notfine.toggle.MixinRender"
)),
"gui.MixinGuiSlot",
NOTFINE_FEATURES_NO_MCPF_CIT(new Builder("NotFine Features which clash with mcpf cit (compat handled in MCPF_NF mixin)").addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT)
.setPhase(Phase.EARLY).setApplyIf(() -> AngelicaConfig.enableNotFineFeatures &&
!(AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.instance().customItemTexturesEnabled)
).addMixinClasses(
"notfine.glint.MixinItemRenderer",
"notfine.glint.MixinRenderItemGlint"
)),
"glint.MixinRenderBiped",
"glint.MixinRenderPlayer",
NOTFINE_LATE_TWILIGHT_FOREST_LEAVES(new Builder("NotFine Mod Leaves").addTargetedMod(TargetedMod.TWILIGHT_FOREST).setSide(Side.CLIENT)
.setPhase(Phase.LATE).setApplyIf(() -> AngelicaConfig.enableNotFineFeatures).addMixinClasses(
"notfine.leaves.twilightforest.MixinBlockTFLeaves"
,"notfine.leaves.twilightforest.MixinBlockTFLeaves3"
"optimization.MixinRenderItemFrame",
"leaves.MixinBlockLeaves",
"leaves.MixinBlockLeavesBase",
"particles.MixinBlockEnchantmentTable",
"particles.MixinEffectRenderer",
"particles.MixinWorldClient",
"renderer.MixinRenderGlobal",
"toggle.MixinEntityRenderer",
"toggle.MixinGuiIngame",
"toggle.MixinRender",
"toggle.MixinRenderItem"
))
),
BETTER_FACE_CULLING(new Builder("Better face culling")
.setSide(Side.CLIENT).setPhase(Phase.EARLY)
.setApplyIf(() -> NotFineConfig.betterBlockFaceCulling)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses(addPrefix("notfine.faceculling.",
"MixinBlock",
"MixinBlockCactus",
"MixinBlockCarpet",
"MixinBlockFarmland",
"MixinBlockSlab",
"MixinBlockSnow",
"MixinBlockStairs",
"MixinRenderBlocks"
))
),
NOTFINE_NO_DYNAMIC_SURROUNDINGS(new Builder("NotFine no Dynamic Surroundings")
.setSide(Side.CLIENT).setPhase(Phase.EARLY)
.setApplyIf(() -> true)
.addTargetedMod(TargetedMod.VANILLA)
.addExcludedMod(TargetedMod.DYNAMIC_SURROUNDINGS_MIST)
.addExcludedMod(TargetedMod.DYNAMIC_SURROUNDINGS_ORIGINAL)
.addMixinClasses("notfine.toggle.MixinEntityRenderer$RenderRainSnow")
),
NOTFINE_NO_CUSTOM_ITEM_TEXTURES(new Builder("NotFine no Custom Item Textures")
.setSide(Side.CLIENT).setPhase(Phase.EARLY)
.setApplyIf(() -> !AngelicaConfig.enableMCPatcherForgeFeatures || !MCPatcherForgeConfig.instance().customItemTexturesEnabled)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses(addPrefix("notfine.glint.",
"MixinItemRenderer",
"MixinRenderItem"
))
),
NOTFINE_THAUMCRAFT(new Builder("NotFine Thaumcraft compat")
.setSide(Side.CLIENT).setPhase(Phase.LATE)
.setApplyIf(() -> AngelicaConfig.enableNotFineFeatures)
.addTargetedMod(TargetedMod.THAUMCRAFT)
.addMixinClasses("notfine.leaves.thaumcraft.MixinBlockMagicalLeaves")
),
THAUMCRAFT_BETTER_FACE_CULLING(new Builder("Better face culling Thaumcraft compat")
.setSide(Side.CLIENT).setPhase(Phase.LATE)
.setApplyIf(() -> NotFineConfig.betterBlockFaceCulling)
.addTargetedMod(TargetedMod.THAUMCRAFT)
.addMixinClasses(addPrefix("notfine.faceculling.thaumcraft.",
"MixinBlockWoodenDevice",
"MixinBlockStoneDevice",
"MixinBlockTable"
))
),
NOTFINE_WITCHERY(new Builder("NotFine Witchery compat")
.setSide(Side.CLIENT).setPhase(Phase.LATE)
.setApplyIf(() -> AngelicaConfig.enableNotFineFeatures)
.addTargetedMod(TargetedMod.WITCHERY)
.addMixinClasses("notfine.leaves.witchery.MixinBlockWitchLeaves")
),
NOTFINE_TWILIGHT_FOREST(new Builder("NotFine Twilight Forest compat")
.setSide(Side.CLIENT).setPhase(Phase.LATE)
.setApplyIf(() -> AngelicaConfig.enableNotFineFeatures)
.addTargetedMod(TargetedMod.TWILIGHT_FOREST)
.addMixinClasses(addPrefix("notfine.leaves.twilightforest.",
"MixinBlockTFLeaves",
"MixinBlockTFLeaves3",
// TODO: Verify 2.3.8.18 or later to support non NH builds?
,"notfine.leaves.twilightforest.MixinBlockTFMagicLeaves"
)),
NOTFINE_LATE_THAUMCRAFT_LEAVES(new Builder("NotFine Mod Leaves").addTargetedMod(TargetedMod.THAUMCRAFT).setSide(Side.CLIENT)
.setPhase(Phase.LATE).setApplyIf(() -> AngelicaConfig.enableNotFineFeatures).addMixinClasses(
"notfine.leaves.thaumcraft.MixinBlockMagicalLeaves"
)),
NOTFINE_LATE_WITCHERY_LEAVES(new Builder("NotFine Mod Leaves").addTargetedMod(TargetedMod.WITCHERY).setSide(Side.CLIENT)
.setPhase(Phase.LATE).setApplyIf(() -> AngelicaConfig.enableNotFineFeatures).addMixinClasses(
"notfine.leaves.witchery.MixinBlockWitchLeaves"
)),
MCPATCHERFORGE_NOTFINE_COMPAT(new Builder("Notfine features and MCPF features where the 2 would clash").addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT)
.setPhase(Phase.EARLY).setApplyIf(() -> AngelicaConfig.enableNotFineFeatures &&
AngelicaConfig.enableMCPatcherForgeFeatures &&
MCPatcherForgeConfig.instance().customItemTexturesEnabled)
.addMixinClasses(addPrefix(
"notfine_mcpf_compat.",
"MixinRenderItem",
"MixinItemRenderer"))),
MCPATCHERFORGE_BASE_MOD(new Builder("Base MCPatcher mixins").setSide(Side.CLIENT)
.setPhase(Phase.EARLY)
"MixinBlockTFMagicLeaves"
))
),
MCPATCHER_FORGE(new Builder("MCPatcher Forge")
.setSide(Side.CLIENT).setPhase(Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses(addPrefix(
"mcpatcherforge.",
.addMixinClasses(addPrefix("mcpatcherforge.",
"base.MixinBlockGrass",
"base.MixinBlockMycelium",
"base.MixinBlockMycelium",
"base.MixinAbstractTexture",
"base.MixinTextureAtlasSprite",
"base.MixinAbstractTexture",
"base.MixinTextureAtlasSprite",
"base.MixinSimpleReloadableResourceManager",
"base.MixinSimpleReloadableResourceManager",
"base.MixinMinecraft"
"base.MixinMinecraft"
// TODO merge renderpass changes into Sodium renderer
// "renderpass.MixinEntityRenderer",
// "renderpass.MixinRenderBlocks",
// "renderpass.MixinRenderGlobal",
// "renderpass.MixinWorldRenderer"
)
)),
MCPATCHERFORGE_CUSTOM_COLOURS(new Builder("Custom colors").setSide(Mixins.Side.CLIENT)
.setPhase(Mixins.Phase.EARLY)
// TODO merge renderpass changes into Sodium renderer
// "renderpass.MixinEntityRenderer",
// "renderpass.MixinRenderBlocks",
// "renderpass.MixinRenderGlobal",
// "renderpass.MixinWorldRenderer"
))
),
MCPATCHER_FORGE_CUSTOM_COLORS(new Builder("MCP:F Custom Colors")
.setSide(Mixins.Side.CLIENT).setPhase(Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.instance().customColorsEnabled)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses(
addPrefix(
"mcpatcherforge.cc.",
"block.material.MixinMapColor",
.addMixinClasses(addPrefix("mcpatcherforge.cc.",
"block.material.MixinMapColor",
"block.MixinBlock",
"block.MixinBlockDoublePlant",
@@ -350,55 +380,56 @@ public enum Mixins {
"world.MixinWorld",
"world.MixinWorldProvider",
"world.MixinWorldProviderEnd",
"world.MixinWorldProviderHell"))),
MCPATCHERFORGE_CUSTOM_ITEM_TEXTURES(new Mixins.Builder("Custom Item Textures").setSide(Mixins.Side.CLIENT)
.setPhase(Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.instance().customItemTexturesEnabled)
"world.MixinWorldProviderHell"
))
),
MCPATCHER_FORGE_CUSTOM_ITEM_TEXTURES(new Builder("MCP:F Custom Item Textures")
.setSide(Side.CLIENT).setPhase(Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableNotFineFeatures && MCPatcherForgeConfig.instance().customItemTexturesEnabled)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses(
addPrefix(
"mcpatcherforge.cit.",
.addMixinClasses(addPrefix("mcpatcherforge.cit.",
"client.renderer.entity.MixinRenderBiped",
"client.renderer.entity.MixinRenderEntityLiving",
"client.renderer.entity.MixinRenderItem",
"client.renderer.entity.MixinRenderPlayer",
"client.renderer.entity.MixinRenderSnowball",
"client.renderer.MixinItemRenderer",
"client.renderer.MixinRenderGlobal",
"entity.MixinEntityLivingBase",
"item.MixinItem",
"nbt.MixinNBTTagCompound",
"nbt.MixinNBTTagList"))),
MCPATCHERFORGE_CUSTOM_ITEM_TEXTURES_NO_NF(new Mixins.Builder("Custom Item Textures without notfine features").setSide(Mixins.Side.CLIENT)
.setPhase(Phase.EARLY)
.setApplyIf(() -> (AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.instance().customItemTexturesEnabled) && !AngelicaConfig.enableNotFineFeatures)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses(addPrefix(
"mcpatcherforge.cit.client.renderer.",
"entity.MixinRenderItemRenderDroppedItem",
"MixinItemRenderer_NO_NF"
))),
MCPATCHERFORGE_CONNECTED_TEXTURES(new Builder("Connected Textures").setSide(Side.CLIENT)
.setPhase(Mixins.Phase.EARLY)
"nbt.MixinNBTTagList",
"world.MixinWorld"
))
),
MCPATCHER_FORGE_CONNECTED_TEXTURES(new Builder("MCP:F Connected Textures")
.setSide(Side.CLIENT).setPhase(Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.instance().connectedTexturesEnabled)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses("mcpatcherforge.ctm.MixinRenderBlocks")),
MCPATCHERFORGE_EXTENDED_HD(new Builder("Extended hd").setSide(Side.CLIENT)
.setPhase(Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.instance().extendedHDEnabled)
.addMixinClasses("mcpatcherforge.ctm.MixinRenderBlocks")
),
MCPATCHER_FORGE_EXTENDED_HD(new Builder("MCP:F Extended hd")
.setSide(Side.CLIENT).setPhase(Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableNotFineFeatures && MCPatcherForgeConfig.instance().extendedHDEnabled)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses(
addPrefix("mcpatcherforge.hd.", "MixinFontRenderer", "MixinTextureClock", "MixinTextureCompass", "MixinTextureManager"))),
MCPATCHERFORGE_RANDOM_MOBS(new Builder("Random Mobs").setSide(Side.CLIENT)
.setPhase(Phase.EARLY)
.addMixinClasses(addPrefix("mcpatcherforge.hd.",
"MixinTextureClock",
"MixinTextureCompass",
"MixinTextureManager"
))
),
MCPATCHER_FORGE_EXTENDED_HD_FONT(new Builder("MCP:F Extended HD Font")
.setSide(Side.CLIENT).setPhase(Phase.EARLY)
.setApplyIf(() -> (AngelicaConfig.enableNotFineFeatures && MCPatcherForgeConfig.instance().extendedHDEnabled && MCPatcherForgeConfig.instance().hdFont))
.addTargetedMod(TargetedMod.VANILLA)
.addExcludedMod(TargetedMod.COFHCORE)
.addMixinClasses("mcpatcherforge.hd.MixinFontRenderer")
),
MCPATCHER_FORGE_RANDOM_MOBS(new Builder("MCP:F Random Mobs")
.setSide(Side.CLIENT).setPhase(Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.instance().randomMobsEnabled)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses(
addPrefix(
"mcpatcherforge.mob.",
.addMixinClasses(addPrefix("mcpatcherforge.mob.",
"MixinRender",
"MixinRenderEnderman",
"MixinRenderFish",
@@ -408,50 +439,51 @@ public enum Mixins {
"MixinRenderSnowMan",
"MixinRenderSpider",
"MixinRenderWolf",
"MixinEntityLivingBase"))),
MCPATCHERFORGE_SKY(new Builder("Sky").setSide(Side.CLIENT)
.setPhase(Phase.EARLY)
"MixinEntityLivingBase"
))
),
MCPATCHER_FORGE_SKY(new Builder("MCP:F Sky")
.setSide(Side.CLIENT).setPhase(Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.instance().betterSkiesEnabled)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses(addPrefix("mcpatcherforge.sky.", "MixinEffectRenderer", "MixinRenderGlobal"
))),
MCPATCHERFORGE_CC_NO_CTM(new Builder("Custom colors, no connected textures").setSide(Side.CLIENT)
.setPhase(Phase.EARLY)
.setApplyIf(
() -> AngelicaConfig.enableMCPatcherForgeFeatures
&& (!MCPatcherForgeConfig.instance().connectedTexturesEnabled
&& MCPatcherForgeConfig.instance().customColorsEnabled))
.addMixinClasses(addPrefix("mcpatcherforge.sky.",
"MixinEffectRenderer",
"MixinRenderGlobal"
))
),
MCPATCHER_FORGE_CC_NO_CTM(new Builder("MCP:F Custom Colors, no Connected Textures")
.setSide(Side.CLIENT).setPhase(Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures
&& !MCPatcherForgeConfig.instance().connectedTexturesEnabled
&& MCPatcherForgeConfig.instance().customColorsEnabled)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses("mcpatcherforge.ctm_cc.MixinRenderBlocksNoCTM")),
MCPATCHERFORGE_CTM_AND_CC(new Builder("Connected textures and Custom Colors enabled").setSide(Side.CLIENT)
.setPhase(Phase.EARLY)
.setApplyIf(
() -> AngelicaConfig.enableMCPatcherForgeFeatures
&& MCPatcherForgeConfig.instance().connectedTexturesEnabled
&& MCPatcherForgeConfig.instance().customColorsEnabled)
.addMixinClasses("mcpatcherforge.cc_ctm.MixinRenderBlocksNoCTM")
),
MCPATCHER_FORGE_CTM_NO_CC(new Builder("MCP:F Connected Textures, no Custom Colours")
.setSide(Side.CLIENT).setPhase(Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures
&& MCPatcherForgeConfig.instance().connectedTexturesEnabled
&& !MCPatcherForgeConfig.instance().customColorsEnabled)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses("mcpatcherforge.ctm_cc.MixinRenderBlocks")),
MCPATCHERFORGE_CTM_NO_CC(new Builder("Connected textures, no custom colours").setSide(Side.CLIENT)
.setPhase(Phase.EARLY)
.setApplyIf(
() -> AngelicaConfig.enableMCPatcherForgeFeatures
&& (MCPatcherForgeConfig.instance().connectedTexturesEnabled
&& !MCPatcherForgeConfig.instance().customColorsEnabled))
.addMixinClasses("mcpatcherforge.ctm_cc.MixinRenderBlocksNoCC")
),
MCPATCHER_FORGE_CTM_AND_CC(new Builder("MCP:F Connected Textures and Custom Colors")
.setSide(Side.CLIENT).setPhase(Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures
&& MCPatcherForgeConfig.instance().connectedTexturesEnabled
&& MCPatcherForgeConfig.instance().customColorsEnabled)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses("mcpatcherforge.ctm_cc.MixinRenderBlocksNoCC")),
MCPATCHERFORGE_CTM_OR_CC(new Builder("Connected textures or Custom Colors enabled").setSide(Side.CLIENT)
.setPhase(Phase.EARLY)
.setApplyIf(
() -> AngelicaConfig.enableMCPatcherForgeFeatures
&& (MCPatcherForgeConfig.instance().connectedTexturesEnabled
|| MCPatcherForgeConfig.instance().customColorsEnabled))
.addMixinClasses("mcpatcherforge.ctm_cc.MixinRenderBlocks")
),
MCPATCHER_FORGE_CTM_OR_CC(new Builder("MCP:F Connected Textures or Custom Colors")
.setSide(Side.CLIENT).setPhase(Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures
&& MCPatcherForgeConfig.instance().connectedTexturesEnabled
|| MCPatcherForgeConfig.instance().customColorsEnabled)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses("mcpatcherforge.ctm_cc.MixinTextureMap")),
.addMixinClasses("mcpatcherforge.ctm_cc.MixinTextureMap")
),
//End from NotFine
NOVIS_OCULIS(new Builder("Non-Tessellator Quad provider")
.setSide(Side.CLIENT)
@@ -489,6 +521,15 @@ public enum Mixins {
}
public static List<String> getEarlyMixins(Set<String> loadedCoreMods) {
NotFineConfig.loadSettings();
//These will probably break hard with Angelica.
//AdvancedOpenGL even breaks hard on its own.
NotFineConfig.allowAdvancedOpenGL = false;
NotFineConfig.allowToggleFBO = false;
//This may be possible to handle differently or fix.
if(loadedCoreMods.contains("cofh.asm.LoadingPlugin")) {
MCPatcherForgeConfig.instance().hdFont = false;
}
final List<String> mixins = new ArrayList<>();
final List<String> notLoading = new ArrayList<>();
for (Mixins mixin : Mixins.values()) {
@@ -22,4 +22,5 @@ public abstract class MixinEntityRenderer {
viewEntity.lastTickPosZ + (viewEntity.posZ - viewEntity.lastTickPosZ) * partialTicks
);
}
}
@@ -18,4 +18,9 @@ public class MixinChunkCache implements ITexturesCache {
public HashSet<IIcon> getRenderedTextures() {
return renderedIcons;
}
@Override
public void enableTextureTracking() {
}
}
@@ -28,6 +28,7 @@ public class MixinRenderBlocks implements ITexturesCache {
public IIcon overrideBlockTexture;
private Set<IIcon> renderedSprites = new ReferenceOpenHashSet<>();
private boolean enableSpriteTracking;
/**
* @author laetansky Here where things get very tricky. We can't just mark blocks textures for update because this
@@ -46,14 +47,17 @@ public class MixinRenderBlocks implements ITexturesCache {
AnimationsRenderUtils.markBlockTextureForUpdate(icon, blockAccess);
this.renderedSprites.add(icon);
if(this.enableSpriteTracking)
this.renderedSprites.add(icon);
}
@Inject(method = "renderBlockFire", at = @At("HEAD"))
public void angelica$markFireBlockAnimationForUpdate(BlockFire instance, int x, int y, int z,
CallbackInfoReturnable<Boolean> cir) {
this.renderedSprites.add(instance.getFireIcon(0));
this.renderedSprites.add(instance.getFireIcon(1));
if(this.enableSpriteTracking) {
this.renderedSprites.add(instance.getFireIcon(0));
this.renderedSprites.add(instance.getFireIcon(1));
}
AnimationsRenderUtils.markBlockTextureForUpdate(instance.getFireIcon(0), blockAccess);
AnimationsRenderUtils.markBlockTextureForUpdate(instance.getFireIcon(1), blockAccess);
}
@@ -62,21 +66,28 @@ public class MixinRenderBlocks implements ITexturesCache {
public IIcon angelica$markFluidAnimationForUpdate(IIcon icon) {
AnimationsRenderUtils.markBlockTextureForUpdate(icon, blockAccess);
this.renderedSprites.add(icon);
if(this.enableSpriteTracking)
this.renderedSprites.add(icon);
return icon;
}
@Inject(method = "drawCrossedSquares", at = @At("HEAD"))
public void angelica$markCrossedSquaresAnimationForUpdate(IIcon icon, double p_147765_2_, double p_147765_4_, double p_147765_6_, float p_147765_8_,
CallbackInfo ci) {
AnimationsRenderUtils.markBlockTextureForUpdate(icon, blockAccess);
this.renderedSprites.add(icon);
if(this.enableSpriteTracking)
this.renderedSprites.add(icon);
}
@Override
public Set<IIcon> getRenderedTextures() {
return renderedSprites;
}
@Override
public void enableTextureTracking() {
enableSpriteTracking = true;
}
}
@@ -26,6 +26,7 @@ public class MixinWorldRenderer implements ITexturesCache {
@ModifyArg(method = "updateRenderer", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/RenderBlocks;<init>(Lnet/minecraft/world/IBlockAccess;)V"))
private IBlockAccess angelica$onUpdateRenderer(IBlockAccess chunkCache) {
((ITexturesCache) chunkCache).enableTextureTracking();
renderedIcons = ((ITexturesCache) chunkCache).getRenderedTextures();
return chunkCache;
}
@@ -43,4 +44,9 @@ public class MixinWorldRenderer implements ITexturesCache {
public Set<IIcon> getRenderedTextures() {
return renderedIcons;
}
@Override
public void enableTextureTracking() {
}
}
@@ -1,5 +1,6 @@
package com.gtnewhorizons.angelica.mixins.early.angelica.hudcaching;
import net.minecraft.client.gui.ScaledResolution;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
@@ -21,7 +22,7 @@ public class MixinGuiIngameForge_HUDCaching {
HUDCaching.renderCrosshairsCaptured = false;
}
}
@Inject(method = "renderCrosshairs", at = @At("HEAD"), cancellable = true, remap = false)
private void angelica$captureRenderCrosshair(CallbackInfo ci) {
if (HUDCaching.renderingCacheOverride) {
@@ -30,15 +31,17 @@ public class MixinGuiIngameForge_HUDCaching {
ci.cancel();
}
}
@Inject(method = "renderHelmet", at = @At("HEAD"), cancellable = true, remap = false)
private void angelica$captureRenderHelmet(CallbackInfo ci) {
private void angelica$captureRenderHelmet(ScaledResolution res, float partialTicks, boolean hasScreen, int mouseX, int mouseY, CallbackInfo ci) {
if (HUDCaching.renderingCacheOverride) {
HUDCaching.renderHelmetCaptured = true;
ci.cancel();
}
HUDCaching.disableHoloInventory();
}
@Inject(method = "renderPortal", at = @At("HEAD"), cancellable = true, remap = false)
private void angelica$captureRenderPortal(int width, int height, float partialTicks, CallbackInfo ci) {
if (HUDCaching.renderingCacheOverride) {
@@ -46,7 +49,7 @@ public class MixinGuiIngameForge_HUDCaching {
ci.cancel();
}
}
@Inject(method = "renderBossHealth", at = @At("HEAD"))
private void angelica$bindBossHealthTexture(CallbackInfo ci) {
// boss health texture is bind in renderCrosshairs
@@ -0,0 +1,12 @@
package com.gtnewhorizons.angelica.mixins.early.angelica.hudcaching;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.event.terraingen.BiomeEvent;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
@Mixin(RenderGameOverlayEvent.class)
public interface RenderGameOverlayEventAccessor {
@Accessor(value = "partialTicks", remap = false)
void setPartialTicks(float value);
}
@@ -1,25 +1,28 @@
package com.gtnewhorizons.angelica.mixins.early.angelica.models;
import com.gtnewhorizons.angelica.compat.mojang.BlockPos;
import com.gtnewhorizons.angelica.compat.nd.Quad;
import com.gtnewhorizons.angelica.utils.ObjectPooler;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import it.unimi.dsi.fastutil.objects.ObjectImmutableList;
import java.util.List;
import java.util.Random;
import com.gtnewhorizons.angelica.api.BlockPos;
import com.gtnewhorizons.angelica.api.QuadProvider;
import com.gtnewhorizons.angelica.api.QuadView;
import it.unimi.dsi.fastutil.objects.ObjectImmutableList;
import net.minecraft.block.Block;
import net.minecraft.block.BlockAir;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.util.ForgeDirection;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import java.util.List;
import java.util.Random;
import java.util.function.Supplier;
@Mixin(BlockAir.class)
public abstract class MixinBlockAir implements QuadProvider {
private static List<Quad> quads = ObjectImmutableList.of();
@Unique
private static final List<QuadView> angelica$EMPTY = ObjectImmutableList.of();
public List<Quad> getQuads(IBlockAccess world, BlockPos pos, Block block, int meta, ForgeDirection dir, Random random, ObjectPooler<Quad> quadPool) {
return quads;
@Override
public List<QuadView> getQuads(IBlockAccess world, BlockPos pos, Block block, int meta, ForgeDirection dir, Random random, int color, Supplier<QuadView> quadPool) {
return angelica$EMPTY;
}
}
@@ -1,12 +1,8 @@
package com.gtnewhorizons.angelica.mixins.early.angelica.models;
import com.gtnewhorizons.angelica.compat.mojang.BlockPos;
import com.gtnewhorizons.angelica.compat.nd.Quad;
import com.gtnewhorizons.angelica.utils.ObjectPooler;
import java.util.List;
import java.util.Random;
import com.gtnewhorizons.angelica.models.CubeModel;
import com.gtnewhorizons.angelica.api.BlockPos;
import com.gtnewhorizons.angelica.api.QuadProvider;
import com.gtnewhorizons.angelica.api.QuadView;
import net.minecraft.block.Block;
import net.minecraft.block.BlockLeaves;
import net.minecraft.block.material.Material;
@@ -14,14 +10,23 @@ import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.util.ForgeDirection;
import org.spongepowered.asm.mixin.Mixin;
import java.util.List;
import java.util.Random;
import java.util.function.Supplier;
import static com.gtnewhorizons.angelica.models.CubeModel.INSTANCE;
@Mixin(BlockLeaves.class)
public abstract class MixinBlockLeaves extends Block implements QuadProvider {
// TODO: Use modern model API
private static final ThreadLocal<QuadProvider> model = ThreadLocal.withInitial(() -> new CubeModel(true));
@Override
public boolean isDynamic() {
return true;
}
public List<Quad> getQuads(IBlockAccess world, BlockPos pos, Block block, int meta, ForgeDirection dir, Random random, ObjectPooler<Quad> quadPool) {
return model.get().getQuads(world, pos, block, meta, dir, random, quadPool);
@Override
public List<QuadView> getQuads(IBlockAccess world, BlockPos pos, Block block, int meta, ForgeDirection dir, Random random, int color, Supplier<QuadView> quadPool) {
return INSTANCE.get().getQuads(world, pos, block, meta, dir, random, color, quadPool);
}
private MixinBlockLeaves(Material materialIn) {
@@ -1,23 +1,24 @@
package com.gtnewhorizons.angelica.mixins.early.angelica.models;
import com.gtnewhorizons.angelica.compat.mojang.BlockPos;
import com.gtnewhorizons.angelica.compat.nd.Quad;
import com.gtnewhorizons.angelica.utils.ObjectPooler;
import java.util.List;
import java.util.Random;
import com.gtnewhorizons.angelica.models.CubeModel;
import com.gtnewhorizons.angelica.api.BlockPos;
import com.gtnewhorizons.angelica.api.QuadProvider;
import com.gtnewhorizons.angelica.api.QuadView;
import com.gtnewhorizons.angelica.models.VanillaModels;
import net.minecraft.block.Block;
import net.minecraft.block.BlockStone;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.util.ForgeDirection;
import org.spongepowered.asm.mixin.Mixin;
import java.util.List;
import java.util.Random;
import java.util.function.Supplier;
@Mixin(BlockStone.class)
public abstract class MixinBlockStone implements QuadProvider {
// TODO: Use modern model API
public List<Quad> getQuads(IBlockAccess world, BlockPos pos, Block block, int meta, ForgeDirection dir, Random random, ObjectPooler<Quad> quadPool) {
return CubeModel.INSTANCE.get().getQuads(world, pos, block, meta, dir, random, quadPool);
@Override
public List<QuadView> getQuads(IBlockAccess world, BlockPos pos, Block block, int meta, ForgeDirection dir, Random random, int color, Supplier<QuadView> quadPool) {
return VanillaModels.stoneModel.getQuads(world, pos, block, meta, dir, random, color, quadPool);
}
}
@@ -1,23 +1,24 @@
package com.gtnewhorizons.angelica.mixins.early.angelica.models;
import com.gtnewhorizons.angelica.compat.mojang.BlockPos;
import com.gtnewhorizons.angelica.compat.nd.Quad;
import com.gtnewhorizons.angelica.utils.ObjectPooler;
import java.util.List;
import java.util.Random;
import com.gtnewhorizons.angelica.models.CubeModel;
import com.gtnewhorizons.angelica.api.BlockPos;
import com.gtnewhorizons.angelica.api.QuadProvider;
import com.gtnewhorizons.angelica.api.QuadView;
import com.gtnewhorizons.angelica.models.CubeModel;
import net.minecraft.block.Block;
import net.minecraft.block.BlockWorkbench;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.util.ForgeDirection;
import org.spongepowered.asm.mixin.Mixin;
import java.util.List;
import java.util.Random;
import java.util.function.Supplier;
@Mixin(BlockWorkbench.class)
public class MixinBlockWorkbench implements QuadProvider {
// TODO: Use modern model API
public List<Quad> getQuads(IBlockAccess world, BlockPos pos, Block block, int meta, ForgeDirection dir, Random random, ObjectPooler<Quad> quadPool) {
return CubeModel.INSTANCE.get().getQuads(world, pos, block, meta, dir, random, quadPool);
@Override
public List<QuadView> getQuads(IBlockAccess world, BlockPos pos, Block block, int meta, ForgeDirection dir, Random random, int color, Supplier<QuadView> quadPool) {
return CubeModel.INSTANCE.get().getQuads(world, pos, block, meta, dir, random, color, quadPool);
}
}
@@ -6,7 +6,7 @@ import org.lwjgl.opengl.GL11;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import com.gtnewhorizons.angelica.mixins.interfaces.AbstractTextureExpansion;
import jss.notfine.util.AbstractTextureExpansion;
@Mixin(AbstractTexture.class)
public abstract class MixinAbstractTexture implements AbstractTextureExpansion {
@@ -31,7 +31,7 @@ import com.prupe.mcpatcher.mal.resource.TexturePackChangeHandler;
import com.prupe.mcpatcher.mal.tile.TileLoader;
import com.prupe.mcpatcher.mob.MobRandomizer;
import mist475.mcpatcherforge.config.MCPatcherForgeConfig;
import jss.notfine.config.MCPatcherForgeConfig;
@Mixin(Minecraft.class)
public abstract class MixinMinecraft {
@@ -8,7 +8,7 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.gtnewhorizons.angelica.mixins.interfaces.MapColorExpansion;
import jss.notfine.util.MapColorExpansion;
@Mixin(MapColor.class)
public abstract class MixinMapColor implements MapColorExpansion {
@@ -9,7 +9,7 @@ import org.spongepowered.asm.mixin.Mixin;
import com.prupe.mcpatcher.cc.ColorizeEntity;
import com.prupe.mcpatcher.cc.Colorizer;
import com.gtnewhorizons.angelica.mixins.interfaces.EntityAuraFXExpansion;
import jss.notfine.util.EntityAuraFXExpansion;
@Mixin(EntityAuraFX.class)
public abstract class MixinEntityAuraFX extends EntityFX implements EntityAuraFXExpansion {
@@ -36,7 +36,7 @@ public abstract class MixinEntityDropParticleFX extends EntityFX {
at = @At("RETURN"))
private void modifyConstructor(World worldIn, double x, double y, double z, Material material, CallbackInfo ci) {
if (material == Material.water) {
if (ColorizeBlock.computeWaterColor(true, (int) this.posX, (int) this.posY, (int) this.posZ)) {
if (ColorizeBlock.computeWaterColor(false, (int) this.posX, (int) this.posY, (int) this.posZ)) {
this.particleRed = Colorizer.setColor[0];
this.particleGreen = Colorizer.setColor[1];
this.particleBlue = Colorizer.setColor[2];
@@ -45,10 +45,6 @@ public abstract class MixinEntityDropParticleFX extends EntityFX {
this.particleGreen = 0.3f;
this.particleBlue = 1.0f;
}
} else {
this.particleRed = 1.0F;
this.particleGreen = 0.0F;
this.particleBlue = 0.0F;
}
}
@@ -63,8 +59,8 @@ public abstract class MixinEntityDropParticleFX extends EntityFX {
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
// Patch start
if (this.materialType != Material.water) {
// Patch start
if (ColorizeEntity.computeLavaDropColor(40 - this.bobTimer)) {
this.particleRed = Colorizer.setColor[0];
this.particleGreen = Colorizer.setColor[1];
@@ -74,12 +70,8 @@ public abstract class MixinEntityDropParticleFX extends EntityFX {
this.particleGreen = 16.0f / (40 - this.bobTimer + 16);
this.particleBlue = 4.0f / (40 - this.bobTimer + 8);
}
// Patch end
} else {
this.particleRed = 1.0F;
this.particleGreen = 16.0F / (float) (40 - this.bobTimer + 16);
this.particleBlue = 4.0F / (float) (40 - this.bobTimer + 8);
}
// Patch end
this.motionY -= this.particleGravity;
@@ -26,6 +26,11 @@ public abstract class MixinEntitySplashFX extends EntityFX {
this.particleRed = Colorizer.setColor[0];
this.particleGreen = Colorizer.setColor[1];
this.particleBlue = Colorizer.setColor[2];
} else {
this.particleRed = 0.2f;
this.particleGreen = 0.3f;
this.particleBlue = 1.0f;
}
}
}
@@ -10,7 +10,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import com.prupe.mcpatcher.cc.ColorizeItem;
import com.gtnewhorizons.angelica.mixins.interfaces.PotionExpansion;
import jss.notfine.util.PotionExpansion;
@Mixin(Potion.class)
public abstract class MixinPotion implements PotionExpansion {
@@ -63,6 +63,7 @@ public abstract class MixinWorld {
}
return input;
}
@SuppressWarnings("InvalidInjectorMethodSignature")
@ModifyVariable(
method = "getSkyColorBody(Lnet/minecraft/entity/Entity;F)Lnet/minecraft/util/Vec3;",
@@ -1,22 +0,0 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cit.client.renderer;
import com.prupe.mcpatcher.cit.CITUtils;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(ItemRenderer.class)
public class MixinItemRenderer_NO_NF {
@Redirect(
method = "renderItem(Lnet/minecraft/entity/EntityLivingBase;Lnet/minecraft/item/ItemStack;ILnet/minecraftforge/client/IItemRenderer$ItemRenderType;)V",
at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;hasEffect(I)Z"),
remap = false)
private boolean modifyRenderItem3(ItemStack item, int pass, EntityLivingBase entity, ItemStack itemStack,
int renderPass) {
return !CITUtils.renderEnchantmentHeld(item, renderPass) && item.hasEffect(pass);
}
}
@@ -0,0 +1,51 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cit.client.renderer;
import com.prupe.mcpatcher.cit.CITUtils;
import jss.notfine.util.itembreakparticles.IRenderGlobalSpawnItemBreakParticle;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.particle.EntityBreakingFX;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.RenderGlobal;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@Mixin(value = RenderGlobal.class)
public abstract class MixinRenderGlobal implements IRenderGlobalSpawnItemBreakParticle {
public EntityFX spawnItemBreakParticle(ItemStack itemStack, final double x, final double y, final double z, double velocityX, double velocityY, double velocityZ) {
int i = mc.gameSettings.particleSetting;
if (i == 1 && theWorld.rand.nextInt(3) == 0) {
i = 2;
}
if (i > 1) {
return null;
}
double relX = this.mc.renderViewEntity.posX - x;
double relY = this.mc.renderViewEntity.posY - y;
double relZ = this.mc.renderViewEntity.posZ - z;
double distance = 16.0D;
if (relX * relX + relY * relY + relZ * relZ > distance * distance) {
return null;
}
Item item = itemStack.getItem();
int meta = itemStack.getItemDamage();
EntityFX entityfx = new EntityBreakingFX(theWorld, x, y, z, velocityX, velocityY, velocityZ, item, meta);
entityfx.particleIcon = CITUtils.getIcon(item.getIconFromDamage(meta), itemStack, 0);
mc.effectRenderer.addEffect(entityfx);
return entityfx;
}
@Shadow
private Minecraft mc;
@Shadow
private WorldClient theWorld;
}
@@ -0,0 +1,43 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cit.entity;
import jss.notfine.NotFine;
import jss.notfine.util.itembreakparticles.IWorldSpawnItemBreakParticle;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
@Mixin(value = EntityLivingBase.class)
public abstract class MixinEntityLivingBase extends Entity {
/**
* @author jss2a98aj
* @reason Fix item break particles
*/
@Overwrite
public void renderBrokenItemStack(ItemStack itemStack) {
playSound("random.break", 0.8F, 0.8F + this.worldObj.rand.nextFloat() * 0.4F);
for(int i = 0; i < 5; ++i) {
Vec3 vec3 = Vec3.createVectorHelper(((double)rand.nextFloat() - 0.5) * 0.1, Math.random() * 0.1 + 0.1, 0.0);
vec3.rotateAroundX(-rotationPitch * 3.1415927F / 180.0F);
vec3.rotateAroundY(-rotationYaw * 3.1415927F / 180.0F);
Vec3 vec31 = Vec3.createVectorHelper(((double)rand.nextFloat() - 0.5) * 0.3, (double)(-rand.nextFloat()) * 0.6 - 0.3, 0.6);
vec31.rotateAroundX(-rotationPitch * 3.1415927F / 180.0F);
vec31.rotateAroundY(-rotationYaw * 3.1415927F / 180.0F);
vec31 = vec31.addVector(posX, posY + (double)getEyeHeight(), posZ);
NotFine.logger.info("Item broken, calling IWorldSpawnItemBreakParticle spawnItemBreakParticle");
((IWorldSpawnItemBreakParticle)worldObj).spawnItemBreakParticle(itemStack,
"iconcrack_" + Item.getIdFromItem(itemStack.getItem()),
vec31.xCoord, vec31.yCoord, vec31.zCoord, vec3.xCoord, vec3.yCoord + 0.05, vec3.zCoord);
}
}
private MixinEntityLivingBase(World world) { super(world); }
}
@@ -9,7 +9,7 @@ import net.minecraft.nbt.NBTTagCompound;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import com.gtnewhorizons.angelica.mixins.interfaces.NBTTagCompoundExpansion;
import jss.notfine.util.NBTTagCompoundExpansion;
@Mixin(NBTTagCompound.class)
public abstract class MixinNBTTagCompound implements NBTTagCompoundExpansion {
@@ -8,7 +8,7 @@ import net.minecraft.nbt.NBTTagList;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import com.gtnewhorizons.angelica.mixins.interfaces.NBTTagListExpansion;
import jss.notfine.util.NBTTagListExpansion;
@Mixin(NBTTagList.class)
public class MixinNBTTagList implements NBTTagListExpansion {
@@ -0,0 +1,30 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cit.world;
import jss.notfine.util.itembreakparticles.IRenderGlobalSpawnItemBreakParticle;
import jss.notfine.util.itembreakparticles.IWorldSpawnItemBreakParticle;
import net.minecraft.item.ItemStack;
import net.minecraft.world.IWorldAccess;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import java.util.List;
@Mixin(value = World.class)
public abstract class MixinWorld implements IWorldSpawnItemBreakParticle {
public void spawnItemBreakParticle(ItemStack itemStack, String particleName, double x, double y, double z, double velocityX, double velocityY, double velocityZ) {
for (int i = 0; i < worldAccesses.size(); ++i) {
IWorldAccess access = (IWorldAccess)worldAccesses.get(i);
if (access instanceof IRenderGlobalSpawnItemBreakParticle) {
((IRenderGlobalSpawnItemBreakParticle)access).spawnItemBreakParticle(itemStack, x, y, z, velocityX, velocityY, velocityZ);
} else {
access.spawnParticle(particleName, x, y, z, velocityX, velocityY, velocityZ);
}
}
}
@Shadow
protected List worldAccesses;
}
@@ -67,11 +67,14 @@ public abstract class MixinRenderBlocks {
}
@Redirect(
method = { "renderBlockVine(Lnet/minecraft/block/Block;III)Z",
"renderBlockLilyPad(Lnet/minecraft/block/Block;III)Z", "renderBlockLadder(Lnet/minecraft/block/Block;III)Z",
method = {
"renderBlockVine(Lnet/minecraft/block/Block;III)Z",
"renderBlockLilyPad(Lnet/minecraft/block/Block;III)Z",
"renderBlockLadder(Lnet/minecraft/block/Block;III)Z",
"renderBlockTripWireSource(Lnet/minecraft/block/Block;III)Z",
"renderBlockLever(Lnet/minecraft/block/Block;III)Z",
"renderBlockTripWire(Lnet/minecraft/block/Block;III)Z", },
"renderBlockTripWire(Lnet/minecraft/block/Block;III)Z"
},
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/RenderBlocks;getBlockIconFromSide(Lnet/minecraft/block/Block;I)Lnet/minecraft/util/IIcon;"))
@@ -8,7 +8,6 @@ import net.minecraft.world.IBlockAccess;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@@ -33,18 +32,6 @@ public abstract class MixinRenderBlocks {
@Shadow
public abstract IIcon getBlockIconFromSideAndMetadata(Block block, int side, int meta);
@Unique
private int mcpatcherforge$neededSideRenderBlockLiquid;
@Unique
private float mcpatcherforge$neededFloat1;
@Unique
private float mcpatcherforge$neededFloat2;
@Unique
private float mcpatcherforge$neededFloat3;
// Redirect calls to this.getBlockIcon when possible
@Redirect(
@@ -12,6 +12,7 @@ import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(RenderBlocks.class)
public abstract class MixinRenderBlocksNoCC {
@Shadow
public IBlockAccess blockAccess;
@@ -25,7 +25,7 @@ import com.llamalad7.mixinextras.sugar.ref.LocalIntRef;
import com.prupe.mcpatcher.cc.ColorizeWorld;
import com.prupe.mcpatcher.hd.FontUtils;
import com.gtnewhorizons.angelica.mixins.interfaces.FontRendererExpansion;
import jss.notfine.util.FontRendererExpansion;
@Mixin(FontRenderer.class)
public abstract class MixinFontRenderer implements FontRendererExpansion {
@@ -39,7 +39,8 @@ public abstract class MixinEntityRenderer {
return RenderPass.setAmbientOcclusion(this.mc.gameSettings.ambientOcclusion != 0);
}
@WrapOperation(method = "renderWorld(FJ)V",
@WrapOperation(
method = "renderWorld(FJ)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/RenderGlobal;sortAndRender(Lnet/minecraft/entity/EntityLivingBase;ID)I",
@@ -58,5 +59,4 @@ public abstract class MixinEntityRenderer {
this.renderRainSnow(partialTickTime);
}
}
@@ -5,18 +5,14 @@ import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import com.prupe.mcpatcher.renderpass.RenderPass;
@Mixin(RenderBlocks.class)
@Mixin(value = RenderBlocks.class)
public abstract class MixinRenderBlocks {
@Shadow
public IBlockAccess blockAccess;
@Redirect(
method = { "renderBlockBed(Lnet/minecraft/block/Block;III)Z",
"renderStandardBlockWithAmbientOcclusion(Lnet/minecraft/block/Block;IIIFFF)Z",
@@ -31,5 +27,4 @@ public abstract class MixinRenderBlocks {
return RenderPass.shouldSideBeRendered(block, worldIn, x, y, z, side);
}
}
@@ -79,5 +79,4 @@ public abstract class MixinRenderGlobal implements IWorldAccess {
RenderPass.enableDisableLightmap(instance, partialTick);
}
}
@@ -10,7 +10,7 @@ public abstract class MixinGameSettings {
/**
* @author jss2a98aj
* @reason Make clouds drawScreen at any drawScreen distance.
* @reason Make clouds render at any render distance.
*/
@Overwrite
public boolean shouldRenderClouds() {
@@ -24,7 +24,7 @@ public abstract class MixinRenderGlobal {
/**
* @author jss2a98aj
* @reason Adjust how cloud drawScreen mode is selected.
* @reason Adjust how cloud render mode is selected.
*/
@Overwrite
public void renderClouds(float partialTicks) {
@@ -45,7 +45,7 @@ public abstract class MixinRenderGlobal {
/**
* @author jss2a98aj
* @reason Adjust fancy cloud drawScreen.
* @reason Adjust fancy cloud render.
*/
@Overwrite
public void renderCloudsFancy(float partialTicks) {
@@ -1,7 +1,5 @@
package com.gtnewhorizons.angelica.mixins.early.notfine.faceculling;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import jss.notfine.util.IFaceObstructionCheckHelper;
import net.minecraft.block.Block;
import net.minecraft.world.IBlockAccess;
@@ -17,7 +15,6 @@ public abstract class MixinBlock {
* @reason More accurate face culling.
*/
@Overwrite()
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess worldIn, int x, int y, int z, int side) {
//Check if side is touching another block
switch(side) {
@@ -0,0 +1,50 @@
package com.gtnewhorizons.angelica.mixins.early.notfine.faceculling;
import jss.notfine.util.IFaceObstructionCheckHelper;
import net.minecraft.block.Block;
import net.minecraft.block.BlockCactus;
import net.minecraft.block.material.Material;
import net.minecraft.world.IBlockAccess;
import org.spongepowered.asm.mixin.Mixin;
@Mixin(value = BlockCactus.class)
public abstract class MixinBlockCactus extends Block implements IFaceObstructionCheckHelper {
/**
* @author jss2a98aj
* @reason More accurate face culling.
*/
public boolean shouldSideBeRendered(IBlockAccess worldIn, int x, int y, int z, int side) {
//If is not top or bottom
if(side > 1) {
return true;
}
//Check if other block is solid
Block otherBlock = worldIn.getBlock(x, y, z);
if(otherBlock.isOpaqueCube()) {
return false;
}
//Check for IFaceObstructionCheckHelper
if(otherBlock instanceof IFaceObstructionCheckHelper target) {
return target.isFaceNonObstructing(worldIn, x, y, z, side, 0.0625F, 0.0F, 0.0625F, 0.9375F, 1.0F, 0.9375F);
}
//Default
return true;
}
@Override
public boolean isFaceNonObstructing(IBlockAccess worldIn, int x, int y, int z, int side, double otherMinX, double otherMinY, double otherMinZ, double otherMaxX, double otherMaxY, double otherMaxZ) {
if(getRenderBlockPass() == 1) {
return true;
}
if(side > 1) {
return true;
}
return otherMinX < 0.0625F || otherMinZ < 0.0625F || otherMaxX > 0.9375F || otherMaxZ > 0.9375F;
}
MixinBlockCactus(Material material) {
super(material);
}
}
@@ -0,0 +1,52 @@
package com.gtnewhorizons.angelica.mixins.early.notfine.faceculling;
import jss.notfine.util.IFaceObstructionCheckHelper;
import net.minecraft.block.Block;
import net.minecraft.block.BlockCarpet;
import net.minecraft.block.material.Material;
import net.minecraft.world.IBlockAccess;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
@Mixin(value = BlockCarpet.class)
public abstract class MixinBlockCarpet extends Block implements IFaceObstructionCheckHelper {
/**
* @author jss2a98aj
* @reason More accurate face culling.
*/
@Overwrite()
public boolean shouldSideBeRendered(IBlockAccess worldIn, int x, int y, int z, int side) {
//If this is the top
if(side == 1) {
return true;
}
//Check if other block is solid
Block otherBlock = worldIn.getBlock(x, y, z);
if(otherBlock.isOpaqueCube()) {
return false;
}
//Check for IFaceObstructionCheckHelper
if(otherBlock instanceof IFaceObstructionCheckHelper target) {
return target.isFaceNonObstructing(worldIn, x, y, z, side, 0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F);
}
//Default
return true;
}
@Override
public boolean isFaceNonObstructing(IBlockAccess worldIn, int x, int y, int z, int side, double otherMinX, double otherMinY, double otherMinZ, double otherMaxX, double otherMaxY, double otherMaxZ) {
if(getRenderBlockPass() == 1) {
return true;
}
if(side <= 1) {
return side == 0;
}
return otherMaxY > 0.0625F;
}
MixinBlockCarpet(Material material) {
super(material);
}
}
@@ -0,0 +1,50 @@
package com.gtnewhorizons.angelica.mixins.early.notfine.faceculling;
import jss.notfine.util.IFaceObstructionCheckHelper;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFarmland;
import net.minecraft.block.material.Material;
import net.minecraft.world.IBlockAccess;
import org.spongepowered.asm.mixin.Mixin;
@Mixin(value = BlockFarmland.class)
public abstract class MixinBlockFarmland extends Block implements IFaceObstructionCheckHelper {
/**
* @author jss2a98aj
* @reason More accurate face culling.
*/
public boolean shouldSideBeRendered(IBlockAccess worldIn, int x, int y, int z, int side) {
//If this is the top
if(side == 1) {
return true;
}
//Check if other block is solid
Block otherBlock = worldIn.getBlock(x, y, z);
if(otherBlock.isOpaqueCube()) {
return false;
}
//Check for IFaceObstructionCheckHelper
if(otherBlock instanceof IFaceObstructionCheckHelper target) {
return target.isFaceNonObstructing(worldIn, x, y, z, side, 0.0F, 0.0F, 0.0F, 1.0F, 0.9375F, 1.0F);
}
//Default
return true;
}
@Override
public boolean isFaceNonObstructing(IBlockAccess worldIn, int x, int y, int z, int side, double otherMinX, double otherMinY, double otherMinZ, double otherMaxX, double otherMaxY, double otherMaxZ) {
if(getRenderBlockPass() == 1) {
return true;
}
if(side <= 1) {
return side == 0;
}
return otherMaxY > 0.9375F;
}
MixinBlockFarmland(Material material) {
super(material);
}
}
@@ -20,7 +20,8 @@ public abstract class MixinBlockSlab extends Block implements IFaceObstructionCh
int thisX = x + Facing.offsetsXForSide[Facing.oppositeSide[side]];
int thisY = y + Facing.offsetsYForSide[Facing.oppositeSide[side]];
int thisZ = z + Facing.offsetsZForSide[Facing.oppositeSide[side]];
if((worldIn.getBlockMetadata(thisX, thisY, thisZ) & 8) != side) {
boolean isTop = (worldIn.getBlockMetadata(thisX, thisY, thisZ) & 8) != 0;
if(isTop && side == 0 || !isTop && side == 1) {
return true;
}
}
@@ -61,7 +62,9 @@ public abstract class MixinBlockSlab extends Block implements IFaceObstructionCh
};
}
MixinBlockSlab(Material material) { super(material); }
MixinBlockSlab(Material material) {
super(material);
}
@Shadow @Final protected boolean field_150004_a;
}
@@ -14,10 +14,6 @@ import net.minecraft.world.IBlockAccess;
@Mixin(value = BlockSnow.class)
public abstract class MixinBlockSnow extends Block implements IFaceObstructionCheckHelper {
MixinBlockSnow(Material material) {
super(material);
}
/**
* @author jss2a98aj
* @reason More accurate face culling.
@@ -56,5 +52,10 @@ public abstract class MixinBlockSnow extends Block implements IFaceObstructionCh
default -> otherMaxY > (float) (2 * (1 + meta)) * 0.0625f;
};
}
MixinBlockSnow(Material material) {
super(material);
}
}
@@ -25,7 +25,7 @@ public abstract class MixinBlockStairs extends Block implements IFaceObstruction
};
}
private MixinBlockStairs(Material materialIn) {
MixinBlockStairs(Material materialIn) {
super(materialIn);
}
@@ -0,0 +1,93 @@
package com.gtnewhorizons.angelica.mixins.early.notfine.faceculling;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFence;
import net.minecraft.block.BlockWall;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.init.Blocks;
import net.minecraft.world.IBlockAccess;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(value = RenderBlocks.class)
public abstract class MixinRenderBlocks {
/**
* @author jss2a98aj
* @reason Culling a few more faces
*/
@Overwrite
public boolean renderBlockFence(BlockFence fence, int x, int y, int z) {
float min = 0.375F;
float max = 0.625F;
setRenderBounds(min, 0.0D, min, max, 1.0D, max);
renderStandardBlock(fence, x, y, z);
boolean connectXNeg = fence.canConnectFenceTo(blockAccess, x - 1, y, z);
boolean connectXPos = fence.canConnectFenceTo(blockAccess, x + 1, y, z);
boolean connectZNeg = fence.canConnectFenceTo(blockAccess, x, y, z - 1);
boolean connectZPos = fence.canConnectFenceTo(blockAccess, x, y, z + 1);
boolean connectX = connectXNeg || connectXPos;
boolean connectZ = connectZNeg || connectZPos;
min = 0.4375F;
max = 0.5625F;
float minY = 0.75F;
float maxY = 0.9375F;
float minX = connectXNeg ? 0.0F : min;
float maxX = connectXPos ? 1.0F : max;
float minZ = connectZNeg ? 0.0F : min;
float maxZ = connectZPos ? 1.0F : max;
field_152631_f = true;
//Upper beam
if(connectX) {
setRenderBounds(minX, minY, min, maxX, maxY, max);
renderStandardBlock(fence, x, y, z);
}
if(connectZ) {
setRenderBounds(min, minY, minZ, max, maxY, maxZ);
renderStandardBlock(fence, x, y, z);
}
minY = 0.375F;
maxY = 0.5625F;
//Lower beam
if(connectX) {
setRenderBounds(minX, minY, min, maxX, maxY, max);
renderStandardBlock(fence, x, y, z);
}
if(connectZ) {
setRenderBounds(min, minY, minZ, max, maxY, maxZ);
renderStandardBlock(fence, x, y, z);
}
field_152631_f = false;
fence.setBlockBoundsBasedOnState(blockAccess, x, y, z);
return true;
}
/**
* @author jss2a98aj
* @reason Fix modded wall detection
*/
@Redirect(
method = "renderBlockFenceGate(Lnet/minecraft/block/BlockFenceGate;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/IBlockAccess;getBlock(III)Lnet/minecraft/block/Block;"
),
expect = 4
)
Block detectModdedWalls(IBlockAccess world, int x, int y, int z) {
return world.getBlock(x, y, z) instanceof BlockWall ? Blocks.cobblestone_wall : null;
}
@Shadow public IBlockAccess blockAccess;
@Shadow public boolean field_152631_f;
@Shadow public abstract void setRenderBounds(double minX, double minY, double minZ, double maxX, double maxY, double maxZ);
@Shadow public abstract boolean renderStandardBlock(Block blockType, int blockX, int blockY, int blockZ);
}
@@ -0,0 +1,66 @@
package com.gtnewhorizons.angelica.mixins.early.notfine.fix;
import jss.notfine.core.Settings;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(value = RenderItem.class)
public abstract class MixinRenderItem {
/**
* @author jss2a98aj
* @reason Makes renderGlint faster and fixes glBlendFunc being left with the wrong values.
*/
@Overwrite
private void renderGlint(int unused, int posX, int posY, int width, int height) {
if(!(boolean)Settings.MODE_GLINT_INV.option.getStore()) {
return;
}
final float timeUVSpeed = 0.00390625F;
final Tessellator tessellator = Tessellator.instance;
final long time = Minecraft.getSystemTime();
float layerUVNoise = 4.0F;
OpenGlHelper.glBlendFunc(772, 1, 0, 1);
//for(int layer = 0; layer < 2; ++layer) {
final int timeUVDenominator = 3000 /*+ layer * 1873*/;
final float timeUVNoise = (float)(time % (long)timeUVDenominator) / (float)timeUVDenominator * 256F;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(
posX, (posY + height), zLevel,
((timeUVNoise + (float)height * layerUVNoise) * timeUVSpeed), ((float)height * timeUVSpeed)
);
tessellator.addVertexWithUV(
(posX + width), (posY + height), zLevel,
((timeUVNoise + (float)width + (float)height * layerUVNoise) * timeUVSpeed), ((float)height * timeUVSpeed)
);
tessellator.addVertexWithUV(
(posX + width), posY, zLevel,
((timeUVNoise + (float)width) * timeUVSpeed), 0D
);
tessellator.addVertexWithUV(
posX, posY, zLevel,
(timeUVNoise * timeUVSpeed), 0D
);
tessellator.draw();
//layerUVNoise = -1.0F;
//}
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
}
@Shadow public float zLevel;
}
@@ -1,63 +1,25 @@
package com.gtnewhorizons.angelica.mixins.early.notfine.glint;
import jss.notfine.core.Settings;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(value = RenderItem.class)
public abstract class MixinRenderItem {
/**
* @author jss2a98aj
* @reason Makes renderGlint faster and fixes glBlendFunc being left with the wrong values.
*/
@Overwrite
private void renderGlint(int unused, int posX, int posY, int width, int height) {
if(!(boolean)Settings.MODE_GLINT_INV.option.getStore()) {
return;
}
final float timeUVSpeed = 0.00390625F;
final Tessellator tessellator = Tessellator.instance;
final long time = Minecraft.getSystemTime();
float layerUVNoise = 4.0F;
OpenGlHelper.glBlendFunc(772, 1, 0, 1);
//for(int layer = 0; layer < 2; ++layer) {
final int timeUVDenominator = 3000 /*+ layer * 1873*/;
final float timeUVNoise = (float)(time % (long)timeUVDenominator) / (float)timeUVDenominator * 256F;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(
posX, (posY + height), zLevel,
((timeUVNoise + (float)height * layerUVNoise) * timeUVSpeed), ((float)height * timeUVSpeed)
);
tessellator.addVertexWithUV(
(posX + width), (posY + height), zLevel,
((timeUVNoise + (float)width + (float)height * layerUVNoise) * timeUVSpeed), ((float)height * timeUVSpeed)
);
tessellator.addVertexWithUV(
(posX + width), posY, zLevel,
((timeUVNoise + (float)width) * timeUVSpeed), 0D
);
tessellator.addVertexWithUV(
posX, posY, zLevel,
(timeUVNoise * timeUVSpeed), 0D
);
tessellator.draw();
//layerUVNoise = -1.0F;
//}
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
@Redirect(
method = "renderDroppedItem(Lnet/minecraft/entity/item/EntityItem;Lnet/minecraft/util/IIcon;IFFFFI)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/item/ItemStack;hasEffect(I)Z"
),
remap = false
)
private boolean notFine$toggleGlint(ItemStack stack, int pass) {
return stack.hasEffect(pass) && (boolean)Settings.MODE_GLINT_WORLD.option.getStore();
}
@Shadow public float zLevel;
}
@@ -1,25 +0,0 @@
package com.gtnewhorizons.angelica.mixins.early.notfine.glint;
import jss.notfine.core.Settings;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
// Separated for compat with MCPF
@Mixin(RenderItem.class)
public class MixinRenderItemGlint {
@Redirect(
method = "renderDroppedItem(Lnet/minecraft/entity/item/EntityItem;Lnet/minecraft/util/IIcon;IFFFFI)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/item/ItemStack;hasEffect(I)Z"
),
remap = false
)
private boolean notFine$toggleGlint(ItemStack stack, int pass) {
return stack.hasEffect(pass) && (boolean) Settings.MODE_GLINT_WORLD.option.getStore();
}
}
@@ -0,0 +1,34 @@
package com.gtnewhorizons.angelica.mixins.early.notfine.optimization;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.tileentity.RenderItemFrame;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(value = RenderItemFrame.class)
public abstract class MixinRenderItemFrame extends Render {
private EntityItem cachedEntityItem;
@Redirect(
method = "func_82402_b(Lnet/minecraft/entity/item/EntityItemFrame;)V",
at = @At(
value = "NEW",
target = "(Lnet/minecraft/world/World;DDDLnet/minecraft/item/ItemStack;)Lnet/minecraft/entity/item/EntityItem;",
ordinal = 0
)
)
public EntityItem cacheEntityItem(World world, double x, double y, double z, ItemStack itemstack) {
if(cachedEntityItem == null) {
cachedEntityItem = new EntityItem(world, 0.0D, 0.0D, 0.0D, itemstack);
} else {
cachedEntityItem.setEntityItemStack(itemstack);
}
return cachedEntityItem;
}
}
@@ -10,7 +10,7 @@ public abstract class MixinEffectRenderer {
/**
* @author jss2a98aj
* @reason Makes most particles drawScreen with the expected depth.
* @reason Makes most particles render with the expected depth.
*/
@Redirect(
method = "renderParticles",
Loaded 100 of 270 files, more files were not shown because too many files have changed in this diff. Show more