Compare commits

...
Author SHA1 Message Date
ev chang 7e4292bdba Add HUDCaching FPS (from PolyPatcher) 2024-07-12 10:49:07 -07:00
Darren Eberly f79e112700 More GLSM Lighting Fixes (#554) 2024-07-11 15:16:15 -04:00
Darren Eberly ba46feb20b GLSM Lighting (#553) 2024-07-11 11:10:04 -04:00
Jason Mitchell 33804c67da Use gtnhlib for coordinate packing/unpacking (#550) 2024-07-07 22:48:58 -07:00
Caedis 3c9353e143 Update dynamic lights from beta branch (#534)
* move dynamic lights lang to angelica

* No light when in water

* update bs

* add battlegear2 compat

Can't add backhand compat since it shares api package path with
battlegear2 (mods/battlegear2/api/core/BattlegearUtils)

* Add backhand 1.4.1+ support
2024-06-26 05:39:26 -07:00
JL2210 77eb3ad46a Fix NPE from MineFactory Reloaded during lag spikes (#522)
* Fix NPE from MineFactory Reloaded during lag spikes

This is an ARR mod and hence cannot be forked.
I decided to put the fix here rather than e.g. Hodgepodge as this is only an
issue with Angelica and seems to be due to its thread safety patches.

* Rewrite as injector

IDE go brr
2024-06-24 17:45:37 -07:00
FalsePattern 8a56ab8ca1 fixed crash with EndlessIDs when joining a multiplayer server 2024-06-09 21:24:26 +08:00
Dakotah fe065803aa THIS ADDS FEATURE REQUEST ISSUE TO GITHUB (#514)
* Add feature request template

* Add feature request template

* Add labels to feature request template automatically

* switch labels to enhancement
2024-05-30 16:30:09 -07:00
ah-OOG-ah f94268c384 Add null check to FluidRenderer (#513)
* Add null check to FluidRenderer

* Update FluidRenderer.java
2024-05-30 17:56:32 -04:00
jss2a98aj f7a8b0f3bf Cloud scaling, distance, and some fixes 2024-05-24 22:16:41 -07:00
embeddedt 8893cf2291 Mark chunk graph as dirty when FOV changes (#506) 2024-05-24 15:59:46 -04:00
Jason Mitchell adc575c5ab remaps 2024-05-23 20:00:21 -07:00
Jason Mitchell 35a056b73b Patches vanilla getFlowDirection to not crash with a ClassCastException if another mod implements their own fluid renderer and calls getFlowDirection when COFH ASM is loaded 2024-05-23 20:00:21 -07:00
jss2a98aj fbbb0ed4f2 Various cleanup (IJK -> XYZ etc) 2024-05-23 19:49:49 -07:00
jss2a98aj bc148ba09c Updated file overlooked in previous sync 2024-05-23 19:49:49 -07:00
jss2a98aj 1db3932af0 Roll ITileOverride into TileOverride 2024-05-23 19:49:49 -07:00
jss2a98aj 0fd4611a97 Refactor glass pane mixins to solve compat issues 2024-05-23 19:49:49 -07:00
jss2a98aj 27243991b7 Add near fog distance percentage slider
Initial commit by MellowArpeggiation and George Paton
FOG_NEAR to FOG_NEAR_DISTANCE, minimum of 1% by jss2a98aj
2024-05-23 19:49:49 -07:00
jss2a98aj 956eec0366 Face culling for the Enchantment Table 2024-05-23 19:49:49 -07:00
jss2a98aj 9b06c5a210 Add interpolated icon support (Roadhog360) 2024-05-23 19:49:49 -07:00
jss2a98aj 5511759b6d Fix door smooth lighting, cull sides against solid blocks 2024-05-23 19:49:49 -07:00
jss2a98aj fb5aa81e01 Sandstone connected textures 2024-05-23 19:49:49 -07:00
jss2a98aj 6592e13e02 Improve Bookshelf connected textures 2024-05-23 19:49:49 -07:00
Jason Mitchell 31174dc35a Update README.MD 2024-05-23 17:57:46 -07:00
Caedis f0bd9de081 Disable Dynamic Lights video option when module is disabled (#491) 2024-05-17 20:18:23 +00:00
Jason Mitchell 75617a5456 More null checks 2024-05-14 23:23:01 -07:00
Jason Mitchell e158faada0 Only set/access texture info cache from the main thread 2024-05-14 22:35:21 -07:00
Raven Szewczyk f684bc0a1b Fix RenderBlockFluid reading the block type from the world access multiple times (#482)
* Fix RenderBlockFluid reading the block type from the world access multiple times

* Fix compiler warnings
2024-05-13 18:04:58 +01:00
Jason Mitchell 3d56b1c2fc Make TextureInfoCache safer 2024-05-12 09:35:43 -07:00
Jason Mitchell 6e60f671b5 Neuter FML optifine detection/reporting 2024-05-11 10:33:45 -07:00
Caedis 323d2e726c Adjust dynamic lights in World#getLightBrightnessForSkyBlocks as well (#466)
This can be called when rendering is done on the main there as
WorldSlice is only used outside the main thread.
2024-05-06 08:50:25 -07:00
88d5030aa9 Add Dynamic Lights to Alpha (Module Off, Lights Off) (#465)
If a player is reading this and wants dynamic lights during alpha, please enable the module in the angelica-modules config file then the config option in the video settings will take effect.

* Implement Dynamic Lights (#360)

* inital dynamicLights

* continue work

* Add credit

* More implementations

* "Working"

* NotFine 0.2.2 sync (#462)

* Slight cleanup in ColorizeBlock

* Don't call System.gc

* Add toggle for Renderpass (forced to false)

* Dont rebuild the same chunk 8 times

* Use client pos

* Fully working + configs

* Clean up

* Fix readme and gradle properties

* Fix tooltip

* nit changes

---------

Co-authored-by: jss2a98aj <[email protected]>

* Might help if the dynamic lights mixins follow the config setting

* Fix shadows from showing on sides of blocks

* Set dynamic lights module to off for alpha

* Add missed enable checks

---------

Co-authored-by: jss2a98aj <[email protected]>
Co-authored-by: Jason Mitchell <[email protected]>
2024-05-06 00:19:50 +00:00
jss2a98aj 894b9573db Natura + Tinker's Construct berry bush leaf mode support 2024-05-05 13:42:36 -07:00
jss2a98aj d8d8cd93c5 Leaf render mode edge case handling 2024-05-05 13:42:36 -07:00
jss2a98aj 986f1bd6a1 NotFine 0.2.2 sync (#462)
* Slight cleanup in ColorizeBlock

* Don't call System.gc

* Add toggle for Renderpass (forced to false)
2024-05-03 23:54:02 -04:00
jss2a98aj e85ca85027 Small NotFine style settings menu fix (#457)
* Fix allowToggle3DAnaglyph

* Remove unused import
2024-05-01 07:26:18 -07:00
Raven Szewczyk d96023f36c Fix FontRenderer intel issue (#456) 2024-04-30 17:55:03 +00:00
Jason Mitchell 203b552993 Attempt at BetterCrashes Compat
- clean up the CapturingTessellator
- clean up GLStateManager
2024-04-29 10:50:56 -07:00
Jason Mitchell 96e2f42251 Update Mixins.java (#447)
Move some Notfine guarded mixins to enableMCPatcherForgeFeatures
2024-04-28 15:06:23 -07:00
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
226 changed files with 5360 additions and 2317 deletions

No files matched your search

@@ -0,0 +1,33 @@
name: Feature Request
description: "Request a feature."
labels: ["enhancement"]
body:
- type: markdown
attributes:
value: "Please use this form to request features. We ask you check if it was already requested though"
- type: input
id: discord
attributes:
label: Your GTNH Discord Username
description: Leave empty if you don't have one, but this will make it harder to contact you if we need additional info.
placeholder: "Example: Wumpus#1234"
- type: textarea
id: request
attributes:
label: Feature Request
description: "Relevant information, as well as relevant images"
placeholder: "Example: https://mclo.gs/ OR submit the file to github by dragging it to this textbox."
validations:
required: true
- type: checkboxes
id: final
attributes:
label: Final Checklist
description: Certify that you read things
options:
- label: "I have searched the issues and haven't found a similar issue."
required: true
- label: "I have read the known incompatibilities and this is not related to one of those."
required: true
- label: "This issue is not related to a feature that is disabed by default - Shaders, MCPF, etc. [They'll be enabled when they're ready for testing]"
required: true
+1
View File
@@ -1,6 +1,7 @@
.gradle
.settings
/.idea/
/.vs/
/.vscode/
/run/
/build/
+14 -6
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,16 +11,18 @@
# Required Dependencies
* [UniMixins](https://github.com/LegacyModdingMC/UniMixins/releases) >= 0.1.14
* [GTNHLib](https://github.com/GTNewHorizons/GTNHLib/releases) >= 0.2.9
* [GTNHLib](https://github.com/GTNewHorizons/GTNHLib/releases) >= 0.3.2
* NOTE: Some mods are not required, but a specific version is required if present - see: `Permanent Incompatibilities` below.
# Known (temporary) Incompatibilities
* Forge Relocation - Currently non Thread Safe; safe if not in use
* ProjectRed Frames - Currently non Thread Safe; safe if not in use
* EndlessIDs - Future compat planned
* FalseTweaks - Future compat planned
* SmoothFont - Future compat planned
* RPLE - Future compat planned
# Known - Incompatibilities
* EndlessIDs - Not currently planned (Looking for volunteers)
* FalseTweaks - Not currently planned (Looking for volunteers)
* SmoothFont - Not currently planned (Looking for volunteers)
* RPLE - Not currently planned (Looking for volunteers)
# Permanent Incompatibilities
* Optifine [Disabled, won't fix]
@@ -62,3 +67,6 @@
* 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`
* Dynamic Lights
* LambdAurora for [LambDynamicLights](https://github.com/LambdAurora/LambDynamicLights) under the MIT license, and the Forge port anthxnymc for [DynamicLightsReforged](https://github.com/anthxnymc/DynamicLightsReforged), also under the MIT license
+16 -3
View File
@@ -58,7 +58,7 @@ dependencies {
// Iris Shaders
compileOnly('org.jetbrains:annotations:24.0.1')
api("com.github.GTNewHorizons:GTNHLib:0.2.9:dev")
api("com.github.GTNewHorizons:GTNHLib:0.3.2: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
@@ -75,25 +75,38 @@ dependencies {
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.github.GTNewHorizons:TinkersConstruct:1.12.0-GTNH:dev")
compileOnly("com.github.GTNewHorizons:Natura:2.6.1: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("com.github.GTNewHorizons:Battlegear2:1.4.0:dev") { transitive = false }
compileOnly(rfg.deobf('maven.modrinth:backhand:1.4.1')) { transitive = false }
compileOnly("com.falsepattern:chunkapi-mc1.7.10:0.5.1:api") { transitive = false }
compileOnly("com.falsepattern:endlessids-mc1.7.10:1.5-beta0003:dev") { transitive = false }
compileOnly(rfg.deobf("curse.maven:extrautils-225561:2264383"))
compileOnly(rfg.deobf("curse.maven:dynamiclights-227874:2337326"))
compileOnly("curse.maven:minefactory-reloaded-66672:2277486")
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"))
// Hodgepodge
transformedMod("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev")
// Better Crashes
compileOnly("com.github.GTNewHorizons:BetterCrashes:1.4.0-GTNH:dev")
// Tests
testImplementation(platform('org.junit:junit-bom:5.9.2'))
+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.14'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.23'
}
@@ -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.9,);",
+ " after:archaicfix@[0.7.0,);" + " required-after:gtnhlib@[0.3.2,);",
acceptedMinecraftVersions = "[1.7.10]",
acceptableRemoteVersions = "*",
guiFactory = "com.gtnewhorizons.angelica.config.AngelicaGuiConfigFactory")
@@ -1,24 +1,10 @@
package com.gtnewhorizons.angelica.api;
import com.gtnewhorizon.gtnhlib.util.CoordinatePacker;
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();
@@ -28,22 +14,6 @@ public interface BlockPos {
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);
return CoordinatePacker.pack(x, y, z);
}
}
@@ -258,7 +258,6 @@ public class BatchingFontRenderer {
GLStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
GLStateManager.glShadeModel(GL_FLAT);
glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
glTexCoordPointer(2, 0, batchVtxTexCoords);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glColorPointer(4, GL_UNSIGNED_BYTE, 0, batchVtxColors);
@@ -289,7 +288,9 @@ public class BatchingFontRenderer {
glDrawElements(GL_TRIANGLES, batchIndices);
}
glPopClientAttrib();
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
if (isTextureEnabledBefore) {
GLStateManager.glEnable(GL11.GL_TEXTURE_2D);
@@ -1,6 +1,11 @@
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;
import xonin.backhand.Backhand;
public class ModStatus {
/**
@@ -12,17 +17,42 @@ public class ModStatus {
*/
public static boolean isOldNEIDLoaded;
public static boolean isBetterCrashesLoaded;
public static boolean isNEIDMetadataExtended;
public static boolean isLotrLoaded;
public static boolean isChunkAPILoaded;
public static boolean isEIDBiomeLoaded;
public static boolean isXaerosMinimapLoaded;
public static boolean isHoloInventoryLoaded;
public static boolean isBattlegearLoaded;
public static boolean isBackhandLoaded;
public static void preInit(){
isBetterCrashesLoaded = Loader.isModLoaded("bettercrashes");
isNEIDLoaded = Loader.isModLoaded("neid");
isOldNEIDLoaded = Loader.isModLoaded("notenoughIDs");
isLotrLoaded = Loader.isModLoaded("lotr");
isChunkAPILoaded = Loader.isModLoaded("chunkapi");
isEIDBiomeLoaded = Loader.isModLoaded("endlessids_biome");
isXaerosMinimapLoaded = Loader.isModLoaded("XaeroMinimap");
isHoloInventoryLoaded = Loader.isModLoaded("holoinventory");
isBattlegearLoaded = Loader.isModLoaded("battlegear2");
isBackhandLoaded = Loader.isModLoaded("backhand");
if (isHoloInventoryLoaded){
isHoloInventoryLoaded = new DefaultArtifactVersion("2.4.4-GTNH")
.compareTo(
LoadControllerHelper.getOwningMod(HoloInventory.class).getProcessedVersion()
) <= 0;
}
if (isBackhandLoaded){
isBackhandLoaded = new DefaultArtifactVersion("1.4.1")
.compareTo(
LoadControllerHelper.getOwningMod(Backhand.class).getProcessedVersion()
) <= 0;
}
isNEIDMetadataExtended = false;
if (isNEIDLoaded) {
@@ -0,0 +1,34 @@
package com.gtnewhorizons.angelica.compat.bettercrashes;
import com.gtnewhorizons.angelica.glsm.GLStateManager;
import com.gtnewhorizons.angelica.mixins.interfaces.IRenderGlobalExt;
import cpw.mods.fml.common.Optional;
import net.minecraft.client.Minecraft;
import vfyjxf.bettercrashes.utils.StateManager;
import static com.gtnewhorizons.angelica.loading.AngelicaTweaker.LOGGER;
@Optional.Interface(modid = "angelica", iface = "vfyjxf.bettercrashes.utils.StateManager.IResettable")
public class BetterCrashesCompat implements StateManager.IResettable {
private static BetterCrashesCompat INSTANCE;
public static void init() {
if (INSTANCE == null) {
INSTANCE = new BetterCrashesCompat();
}
}
public BetterCrashesCompat() {
LOGGER.info("BetterCrashesCompat initialized");
this.register();
}
@Override
public void resetState() {
LOGGER.info("Reloading SodiumRenderer");
((IRenderGlobalExt) Minecraft.getMinecraft().renderGlobal).reload();
LOGGER.info("Resetting GLStateManager");
GLStateManager.reset();
}
}
@@ -0,0 +1,37 @@
package com.gtnewhorizons.angelica.compat.endlessids;
import com.falsepattern.endlessids.mixin.helpers.ChunkBiomeHook;
import lombok.val;
import net.minecraft.world.chunk.Chunk;
import static com.falsepattern.endlessids.constants.ExtendedConstants.biomeIDMask;
import static com.falsepattern.endlessids.constants.ExtendedConstants.biomeIDNull;
public class EndlessIDsCompat {
public static void sodium$populateBiomes(Chunk chunk) {
if (!(chunk instanceof ChunkBiomeHook hook))
return;
val biomes = hook.getBiomeShortArray();
if (biomes == null)
return;
val cX = chunk.xPosition << 4;
val cZ = chunk.zPosition << 4;
val manager = chunk.worldObj.getWorldChunkManager();
for(var z = 0; z < 16; z++) {
for(var x = 0; x < 16; x++) {
val idx = (z << 4) + x;
val biome = biomes[idx] & biomeIDMask;
if(biome == biomeIDNull) {
val generated = manager.getBiomeGenAt(cX + x, cZ + z);
if (generated == null)
continue;
biomes[idx] = (short)(generated.biomeID & biomeIDMask);
}
}
}
}
}
@@ -1,14 +1,11 @@
package com.gtnewhorizons.angelica.compat.mojang;
import com.gtnewhorizons.angelica.api.BlockPos;
import com.gtnewhorizon.gtnhlib.util.CoordinatePacker;
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 {
@@ -54,7 +51,7 @@ public class BlockPosImpl extends Vector3i implements MutableBlockPos {
@Override
public long asLong() {
return BlockPos.asLong(this.x, this.y, this.z);
return CoordinatePacker.pack(this.x, this.y, this.z);
}
@Override
@@ -65,6 +62,7 @@ public class BlockPosImpl extends Vector3i implements MutableBlockPos {
@Override
public BlockPosImpl set(long packedPos) {
return set(unpackLongX(packedPos), unpackLongY(packedPos), unpackLongZ(packedPos));
CoordinatePacker.unpack(packedPos, this);
return this;
}
}
@@ -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);
}
}
@@ -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;
@@ -9,6 +9,10 @@ public class AngelicaConfig {
@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;
@@ -40,11 +44,6 @@ public class AngelicaConfig {
@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
@@ -71,17 +70,26 @@ public class AngelicaConfig {
@Config.DefaultBoolean(true)
public static boolean showSplashMemoryBar;
@Config.Comment("Renders the HUD elements once per tick and reuses the pixels to improve performance. [Experimental]")
@Config.Comment("Renders the HUD elements once per 20 frames (by default) and reuses the pixels to improve performance. [Experimental]")
@Config.DefaultBoolean(true)
@Config.RequiresMcRestart
public static boolean enableHudCaching;
@Config.Comment("The amount of frames to wait before updating the HUD elements. [Experimental]")
@Config.DefaultInt(20)
@Config.RangeInt(min = 1, max = 60)
public static int hudCachingFPS = 20;
@Config.Comment("Batch drawScreen fonts [Experimental]")
@Config.DefaultBoolean(true)
@Config.RequiresMcRestart
public static boolean enableFontRenderer;
@Config.Comment("Enable Dynamic Lights")
@Config.DefaultBoolean(false)
@Config.RequiresMcRestart
public static boolean enableDynamicLights;
@Config.Comment("Optimize world update light. [From Hodgepodge]")
@Config.DefaultBoolean(true)
@Config.RequiresMcRestart
@@ -102,6 +110,21 @@ 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("Fix thread-safety issues in MineFactory Reloaded")
@Config.DefaultBoolean(true)
@Config.RequiresMcRestart
public static boolean fixMineFactoryReloadedSodiumCompat;
@Config.Comment("Fix RenderBlockFluid reading the block type from the world access multiple times")
@Config.DefaultBoolean(true)
@Config.RequiresMcRestart
public static boolean fixFluidRendererCheckingBlockAgain;
@Config.Comment("Enable Debug Logging")
@Config.DefaultBoolean(false)
@Config.RequiresMcRestart
@@ -0,0 +1,390 @@
package com.gtnewhorizons.angelica.dynamiclights;
import com.gtnewhorizon.gtnhlib.util.CoordinatePacker;
import com.gtnewhorizons.angelica.compat.ModStatus;
import com.gtnewhorizons.angelica.compat.mojang.BlockPosImpl;
import com.gtnewhorizons.angelica.config.AngelicaConfig;
import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
import me.jellysquid.mods.sodium.client.render.SodiumWorldRenderer;
import mods.battlegear2.api.core.IBattlePlayer;
import mods.battlegear2.api.core.IInventoryPlayerBattle;
import net.irisshaders.iris.api.v0.IrisApi;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import xonin.backhand.api.core.BackhandUtils;
import xonin.backhand.api.core.IBackhandPlayer;
import java.util.Set;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.function.Predicate;
public class DynamicLights {
private static DynamicLights instance;
public static DynamicLightsMode Mode = DynamicLightsMode.OFF;
private static final double MAX_RADIUS = 7.75;
private static final double MAX_RADIUS_SQUARED = MAX_RADIUS * MAX_RADIUS;
private final Set<IDynamicLightSource> dynamicLightSources = new ObjectOpenHashSet<>();
private final ReentrantReadWriteLock lightSourcesLock = new ReentrantReadWriteLock();
private long lastUpdate = System.currentTimeMillis();
private int lastUpdateCount = 0;
public static DynamicLights get() {
if (instance == null)
instance = new DynamicLights();
return instance;
}
public static boolean isEnabled() {
return Mode.isEnabled() && AngelicaConfig.enableDynamicLights;
}
/**
* Updates all light sources.
*
* @param renderer the renderer
*/
public void updateAll(@NotNull SodiumWorldRenderer renderer) {
if (!isEnabled())
return;
long now = System.currentTimeMillis();
if (now >= this.lastUpdate + 50) {
this.lastUpdate = now;
this.lastUpdateCount = 0;
this.lightSourcesLock.readLock().lock();
for (var lightSource : this.dynamicLightSources) {
if (lightSource.angelica$updateDynamicLight(renderer))
this.lastUpdateCount++;
}
this.lightSourcesLock.readLock().unlock();
}
}
public int getLastUpdateCount() {
return this.lastUpdateCount;
}
public void addLightSource(IDynamicLightSource lightSource) {
this.lightSourcesLock.writeLock().lock();
this.dynamicLightSources.add(lightSource);
this.lightSourcesLock.writeLock().unlock();
}
/**
* Removes the light source from the tracked light sources.
*
* @param lightSource the light source to remove
*/
public void removeLightSource(@NotNull IDynamicLightSource lightSource) {
this.lightSourcesLock.writeLock().lock();
var dynamicLightSources = this.dynamicLightSources.iterator();
IDynamicLightSource it;
while (dynamicLightSources.hasNext()) {
it = dynamicLightSources.next();
if (it.equals(lightSource)) {
dynamicLightSources.remove();
if (SodiumWorldRenderer.getInstance() != null)
lightSource.angelica$scheduleTrackedChunksRebuild(SodiumWorldRenderer.getInstance());
break;
}
}
this.lightSourcesLock.writeLock().unlock();
}
/**
* Removes light sources if the filter matches.
*
* @param filter the removal filter
*/
public void removeLightSources(@NotNull Predicate<IDynamicLightSource> filter) {
this.lightSourcesLock.writeLock().lock();
var dynamicLightSources = this.dynamicLightSources.iterator();
IDynamicLightSource it;
while (dynamicLightSources.hasNext()) {
it = dynamicLightSources.next();
if (filter.test(it)) {
dynamicLightSources.remove();
if (SodiumWorldRenderer.getInstance() != null) {
if (it.angelica$getLuminance() > 0)
it.angelica$resetDynamicLight();
it.angelica$scheduleTrackedChunksRebuild(SodiumWorldRenderer.getInstance());
}
break;
}
}
this.lightSourcesLock.writeLock().unlock();
}
/**
* Clears light sources.
*/
public void clearLightSources() {
this.lightSourcesLock.writeLock().lock();
var dynamicLightSources = this.dynamicLightSources.iterator();
IDynamicLightSource it;
while (dynamicLightSources.hasNext()) {
it = dynamicLightSources.next();
dynamicLightSources.remove();
if (SodiumWorldRenderer.getInstance() != null) {
if (it.angelica$getLuminance() > 0)
it.angelica$resetDynamicLight();
it.angelica$scheduleTrackedChunksRebuild(SodiumWorldRenderer.getInstance());
}
}
this.lightSourcesLock.writeLock().unlock();
}
/**
* Returns whether the light source is tracked or not.
*
* @param lightSource the light source to check
* @return {@code true} if the light source is tracked, else {@code false}
*/
public boolean containsLightSource(@NotNull IDynamicLightSource lightSource) {
boolean result;
this.lightSourcesLock.readLock().lock();
result = this.dynamicLightSources.contains(lightSource);
this.lightSourcesLock.readLock().unlock();
return result;
}
/**
* Returns the number of dynamic light sources that currently emit lights.
*
* @return the number of dynamic light sources emitting light
*/
public int getLightSourcesCount() {
int result;
this.lightSourcesLock.readLock().lock();
result = this.dynamicLightSources.size();
this.lightSourcesLock.readLock().unlock();
return result;
}
public double getDynamicLightLevel(int x, int y, int z) {
double result = 0;
this.lightSourcesLock.readLock().lock();
for (var lightSource : this.dynamicLightSources) {
result = maxDynamicLightLevel(x, y, z, lightSource, result);
}
this.lightSourcesLock.readLock().unlock();
return MathHelper.clamp_double(result, 0, 15);
}
public double getDynamicLightLevel(@NotNull BlockPosImpl pos) {
return this.getDynamicLightLevel(pos.getX(), pos.getY(), pos.getZ());
}
public static double maxDynamicLightLevel(int x, int y, int z, @NotNull IDynamicLightSource lightSource, double currentLightLevel) {
int luminance = lightSource.angelica$getLuminance();
if (luminance > 0) {
// Can't use Entity#squaredDistanceTo because of eye Y coordinate.
double dx = x - lightSource.angelica$getDynamicLightX() + 0.5;
double dy = y - lightSource.angelica$getDynamicLightY() + 0.5;
double dz = z - lightSource.angelica$getDynamicLightZ() + 0.5;
double distanceSquared = dx * dx + dy * dy + dz * dz;
// 7.75 because else we would have to update more chunks and that's not a good idea.
// 15 (max range for blocks) would be too much and a bit cheaty.
if (distanceSquared <= MAX_RADIUS_SQUARED) {
double multiplier = 1.0 - Math.sqrt(distanceSquared) / MAX_RADIUS;
double lightLevel = multiplier * (double) luminance;
if (lightLevel > currentLightLevel) {
return lightLevel;
}
}
}
return currentLightLevel;
}
/**
* Returns the dynamic light level generated by the light source at the specified position.
*
* @param pos the position
* @param lightSource the light source
* @param currentLightLevel the current surrounding dynamic light level
* @return the dynamic light level at the specified position
*/
public static double maxDynamicLightLevel(@NotNull BlockPosImpl pos, @NotNull IDynamicLightSource lightSource, double currentLightLevel) {
return maxDynamicLightLevel(pos.getX(), pos.getY(), pos.getZ(), lightSource, currentLightLevel);
}
public int getLightmapWithDynamicLight(int x, int y, int z, int lightmap) {
return this.getLightmapWithDynamicLight(this.getDynamicLightLevel(x, y, z), lightmap);
}
/**
* Returns the lightmap with combined light levels.
*
* @param dynamicLightLevel the dynamic light level
* @param lightmap the vanilla lightmap coordinates
* @return the modified lightmap coordinates
*/
public int getLightmapWithDynamicLight(double dynamicLightLevel, int lightmap) {
if (dynamicLightLevel > 0) {
// lightmap is (skyLevel << 20 | blockLevel << 4)
// Get vanilla block light level.
int blockLevel = (lightmap & 0xFFFF) >> 4;
if (dynamicLightLevel > blockLevel) {
// Equivalent to a << 4 bitshift with a little quirk: this one ensure more precision (more decimals are saved).
int luminance = (int) (dynamicLightLevel * 16.0);
lightmap &= 0xfff00000;
lightmap |= luminance & 0x000fffff;
}
}
return lightmap;
}
/**
* Schedules a chunk rebuild at the specified chunk position.
*
* @param renderer the renderer
* @param chunkPos the chunk position
*/
public static void scheduleChunkRebuild(@NotNull SodiumWorldRenderer renderer, @NotNull BlockPosImpl chunkPos) {
scheduleChunkRebuild(renderer, chunkPos.getX(), chunkPos.getY(), chunkPos.getZ());
}
/**
* Schedules a chunk rebuild at the specified chunk position.
*
* @param renderer the renderer
* @param chunkPos the packed chunk position
*/
public static void scheduleChunkRebuild(@NotNull SodiumWorldRenderer renderer, long chunkPos) {
scheduleChunkRebuild(renderer, CoordinatePacker.unpackX(chunkPos), CoordinatePacker.unpackY(chunkPos), CoordinatePacker.unpackZ(chunkPos));
}
public static void scheduleChunkRebuild(@NotNull SodiumWorldRenderer renderer, int x, int y, int z) {
renderer.scheduleRebuildForChunk(x, y, z, false);
}
/**
* Updates the tracked chunk sets.
*
* @param chunkPos the packed chunk position
* @param old the set of old chunk coordinates to remove this chunk from it
* @param newPos the set of new chunk coordinates to add this chunk to it
*/
public static void updateTrackedChunks(@NotNull BlockPosImpl chunkPos, @Nullable LongOpenHashSet old, @Nullable LongOpenHashSet newPos) {
if (old != null || newPos != null) {
final long pos = chunkPos.asLong();
if (old != null)
old.remove(pos);
if (newPos != null)
newPos.add(pos);
}
}
/**
* Updates the dynamic lights tracking.
*
* @param lightSource the light source
*/
public static void updateTracking(@NotNull IDynamicLightSource lightSource) {
boolean enabled = lightSource.angelica$isDynamicLightEnabled();
int luminance = lightSource.angelica$getLuminance();
if (!enabled && luminance > 0) {
lightSource.angelica$setDynamicLightEnabled(true);
} else if (enabled && luminance < 1) {
lightSource.angelica$setDynamicLightEnabled(false);
}
}
/**
* Returns the luminance from an item stack.
*
* @param stack the item stack
* @param submergedInWater {@code true} if the stack is submerged in water, else {@code false}
* @return the luminance of the item
*/
public static int getLuminanceFromItemStack(@NotNull ItemStack stack, boolean submergedInWater) {
// TODO only have certain items not glow in water?
if (submergedInWater) return 0;
Item item = stack.getItem();
if (item instanceof ItemBlock itemBlock) {
Block block = itemBlock.field_150939_a;
if (block != null) {
return block.getLightValue();
}
}
if (item == Items.lava_bucket) return Blocks.lava.getLightValue();
return 0;
}
public static int getLuminanceFromEntity(@NotNull Entity entity) {
if (entity.fire > 0) return 15;
if (entity instanceof EntityItem item) {
return getLuminanceFromItemStack(item.getEntityItem(), item.isInsideOfMaterial(Material.water));
}
if (entity instanceof EntityLivingBase living) {
int luminance = 0;
boolean inWater = living.isInsideOfMaterial(Material.water);
// check equipment + hand for light (should work for all entities)
ItemStack itemStack;
for (int i = 0; i < 5; i++) {
if ((itemStack = living.getEquipmentInSlot(i)) != null) {
luminance = Math.max(luminance, getLuminanceFromItemStack(itemStack, inWater));
}
}
if (ModStatus.isBattlegearLoaded &&
living instanceof EntityPlayer player &&
player instanceof IBattlePlayer battlePlayer &&
battlePlayer.battlegear2$isBattlemode()
) {
ItemStack offhand = ((IInventoryPlayerBattle) player.inventory).battlegear2$getCurrentOffhandWeapon();
if (offhand != null) {
luminance = Math.max(luminance, getLuminanceFromItemStack(offhand, inWater));
}
}
else if (ModStatus.isBackhandLoaded && living instanceof EntityPlayer player){
ItemStack offhand = BackhandUtils.getOffhandItem(player);
if (offhand != null) {
luminance = Math.max(luminance, getLuminanceFromItemStack(offhand, inWater));
}
}
return luminance;
}
// TODO: Creepers? TNT? Dusts?
return 0;
}
}
@@ -0,0 +1,35 @@
package com.gtnewhorizons.angelica.dynamiclights;
import java.util.Objects;
public enum DynamicLightsMode
{
OFF("Off", 0),
FASTEST("Fastest", 500),
FAST("Fast", 250),
FANCY("Fancy", 0);
private final String name;
private final int delay;
public boolean hasDelay() {
return delay > 0;
}
public int getDelay(){
return delay;
}
public String getName() {
return name;
}
DynamicLightsMode(String name, int delay) {
this.name = name;
this.delay = delay;
}
public boolean isEnabled() {
return !Objects.equals(this, DynamicLightsMode.OFF);
}
}
@@ -0,0 +1,86 @@
package com.gtnewhorizons.angelica.dynamiclights;
import me.jellysquid.mods.sodium.client.render.SodiumWorldRenderer;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
public interface IDynamicLightSource {
/**
* Returns the dynamic light source X coordinate.
*
* @return the X coordinate
*/
double angelica$getDynamicLightX();
/**
* Returns the dynamic light source Y coordinate.
*
* @return the Y coordinate
*/
double angelica$getDynamicLightY();
/**
* Returns the dynamic light source Z coordinate.
*
* @return the Z coordinate
*/
double angelica$getDynamicLightZ();
/**
* Returns the dynamic light source world.
*
* @return the world instance
*/
SodiumWorldRenderer angelica$getDynamicLightWorld();
/**
* Returns whether the dynamic light is enabled or not.
*
* @return {@code true} if the dynamic light is enabled, else {@code false}
*/
default boolean angelica$isDynamicLightEnabled() {
return DynamicLights.isEnabled() && DynamicLights.get().containsLightSource(this);
}
/**
* Sets whether the dynamic light is enabled or not.
* <p>
* Note: please do not call this function in your mod or you will break things.
*
* @param enabled {@code true} if the dynamic light is enabled, else {@code false}
*/
@ApiStatus.Internal
default void angelica$setDynamicLightEnabled(boolean enabled) {
this.angelica$resetDynamicLight();
if (enabled)
DynamicLights.get().addLightSource(this);
else
DynamicLights.get().removeLightSource(this);
}
void angelica$resetDynamicLight();
/**
* Returns the luminance of the light source.
* The maximum is 15, below 1 values are ignored.
*
* @return the luminance of the light source
*/
int angelica$getLuminance();
/**
* Executed at each tick.
*/
void angelica$dynamicLightTick();
/**
* Returns whether this dynamic light source should update.
*
* @return {@code true} if this dynamic light source should update, else {@code false}
*/
boolean angelica$shouldUpdateDynamicLight();
boolean angelica$updateDynamicLight(@NotNull SodiumWorldRenderer renderer);
void angelica$scheduleTrackedChunksRebuild(@NotNull SodiumWorldRenderer renderer);
}
@@ -82,7 +82,14 @@ public class Feature {
, GLStateManager.depthTest // GL_DEPTH_TEST flag
// GL_DITHER flag
, GLStateManager.fogMode // GL_FOG flag
// GL_LIGHTi where 0 <= i < GL_MAX_LIGHTS
, GLStateManager.lightStates[0] // GL_LIGHT0
, GLStateManager.lightStates[1] // GL_LIGHT1
, GLStateManager.lightStates[2] // GL_LIGHT2
, GLStateManager.lightStates[3] // GL_LIGHT3
, GLStateManager.lightStates[4] // GL_LIGHT4
, GLStateManager.lightStates[5] // GL_LIGHT5
, GLStateManager.lightStates[6] // GL_LIGHT6
, GLStateManager.lightStates[7] // GL_LIGHT7
, GLStateManager.lightingState // GL_LIGHTING flag
// GL_LINE_SMOOTH flag
// GL_LINE_STIPPLE flag
@@ -149,9 +156,25 @@ public class Feature {
// GL_LIGHT_MODEL_TWO_SIDE setting
GLStateManager.lightingState // GL_LIGHTING enable bit
// Enable bit for each light
, GLStateManager.lightStates[0] // GL_LIGHT0
, GLStateManager.lightStates[1] // GL_LIGHT1
, GLStateManager.lightStates[2] // GL_LIGHT2
, GLStateManager.lightStates[3] // GL_LIGHT3
, GLStateManager.lightStates[4] // GL_LIGHT4
, GLStateManager.lightStates[5] // GL_LIGHT5
, GLStateManager.lightStates[6] // GL_LIGHT6
, GLStateManager.lightStates[7] // GL_LIGHT7
// Ambient, diffuse, and specular intensity for each light
// Direction, position, exponent, and cutoff angle for each light
// Constant, linear, and quadratic attenuation factors for each light
, GLStateManager.lightDataStates[0]
, GLStateManager.lightDataStates[1]
, GLStateManager.lightDataStates[2]
, GLStateManager.lightDataStates[3]
, GLStateManager.lightDataStates[4]
, GLStateManager.lightDataStates[5]
, GLStateManager.lightDataStates[6]
, GLStateManager.lightDataStates[7]
// Ambient, diffuse, specular, and emissive color for each material
// Ambient, diffuse, and specular color indices for each material
// Specular exponent for each material
@@ -11,6 +11,7 @@ import com.gtnewhorizons.angelica.glsm.stacks.DepthStateStack;
import com.gtnewhorizons.angelica.glsm.stacks.FogStateStack;
import com.gtnewhorizons.angelica.glsm.stacks.IStateStack;
import com.gtnewhorizons.angelica.glsm.stacks.IntegerStateStack;
import com.gtnewhorizons.angelica.glsm.stacks.LightStateStack;
import com.gtnewhorizons.angelica.glsm.stacks.MatrixModeStack;
import com.gtnewhorizons.angelica.glsm.stacks.ViewPortStateStack;
import com.gtnewhorizons.angelica.glsm.states.Color4;
@@ -59,6 +60,7 @@ import org.lwjgl.opengl.GL14;
import org.lwjgl.opengl.GL20;
import org.lwjgl.opengl.GLContext;
import java.lang.Math;
import java.nio.ByteBuffer;
import java.nio.DoubleBuffer;
import java.nio.FloatBuffer;
@@ -105,7 +107,6 @@ public class GLStateManager {
@Getter protected static final DepthStateStack depthState = new DepthStateStack();
@Getter protected static final BooleanStateStack depthTest = new BooleanStateStack(GL11.GL_DEPTH_TEST);
// @Getter private static final FogState fogState = new FogState();
@Getter protected static final FogStateStack fogState = new FogStateStack();
@Getter protected static final BooleanStateStack fogMode = new BooleanStateStack(GL11.GL_FOG);
@Getter protected static final Color4Stack color = new Color4Stack();
@@ -122,9 +123,30 @@ public class GLStateManager {
@Getter protected static final Matrix4fStack modelViewMatrix = new Matrix4fStack(MAX_MODELVIEW_STACK_DEPTH);
@Getter protected static final Matrix4fStack projectionMatrix = new Matrix4fStack(MAX_PROJECTION_STACK_DEPTH);
@Getter protected static final BooleanStateStack[] lightStates = new BooleanStateStack[8];
@Getter protected static final LightStateStack[] lightDataStates = new LightStateStack[8];
static {
for (int i = 0; i < lightStates.length; i ++) {
lightStates[i] = new BooleanStateStack(GL11.GL_LIGHT0 + i);
lightDataStates[i] = new LightStateStack(GL11.GL_LIGHT0 + i);
}
}
@Getter protected static final ViewPortStateStack viewportState = new ViewPortStateStack();
public static void reset() {
runningSplash = true;
while(!attribs.isEmpty()) {
attribs.popInt();
}
for(IStateStack<?> stack : Feature.maskToFeatures(GL11.GL_ALL_ATTRIB_BITS)) {
while(!stack.isEmpty()) {
stack.pop();
}
}
modelViewMatrix.clear();
projectionMatrix.clear();
}
// Iris Listeners
private static Runnable blendFuncListener = null;
@@ -224,6 +246,9 @@ public class GLStateManager {
}
public static boolean isMainThread() {
return Thread.currentThread() == MainThread;
}
public static void assertMainThread() {
if (Thread.currentThread() != CurrentThread && !runningSplash) {
@@ -244,6 +269,14 @@ public class GLStateManager {
case GL11.GL_DEPTH_TEST -> enableDepthTest();
case GL11.GL_FOG -> enableFog();
case GL11.GL_LIGHTING -> enableLighting();
case GL11.GL_LIGHT0 -> enableLight(0);
case GL11.GL_LIGHT1 -> enableLight(1);
case GL11.GL_LIGHT2 -> enableLight(2);
case GL11.GL_LIGHT3 -> enableLight(3);
case GL11.GL_LIGHT4 -> enableLight(4);
case GL11.GL_LIGHT5 -> enableLight(5);
case GL11.GL_LIGHT6 -> enableLight(6);
case GL11.GL_LIGHT7 -> enableLight(7);
case GL11.GL_SCISSOR_TEST -> enableScissorTest();
case GL11.GL_TEXTURE_2D -> enableTexture();
case GL12.GL_RESCALE_NORMAL -> enableRescaleNormal();
@@ -259,6 +292,14 @@ public class GLStateManager {
case GL11.GL_DEPTH_TEST -> disableDepthTest();
case GL11.GL_FOG -> disableFog();
case GL11.GL_LIGHTING -> disableLighting();
case GL11.GL_LIGHT0 -> disableLight(0);
case GL11.GL_LIGHT1 -> disableLight(1);
case GL11.GL_LIGHT2 -> disableLight(2);
case GL11.GL_LIGHT3 -> disableLight(3);
case GL11.GL_LIGHT4 -> disableLight(4);
case GL11.GL_LIGHT5 -> disableLight(5);
case GL11.GL_LIGHT6 -> disableLight(6);
case GL11.GL_LIGHT7 -> disableLight(7);
case GL11.GL_SCISSOR_TEST -> disableScissorTest();
case GL11.GL_TEXTURE_2D -> disableTexture();
case GL12.GL_RESCALE_NORMAL -> disableRescaleNormal();
@@ -277,6 +318,14 @@ public class GLStateManager {
case GL11.GL_DEPTH_TEST -> depthTest.isEnabled();
case GL11.GL_FOG -> fogMode.isEnabled();
case GL11.GL_LIGHTING -> lightingState.isEnabled();
case GL11.GL_LIGHT0 -> lightStates[0].isEnabled();
case GL11.GL_LIGHT1 -> lightStates[1].isEnabled();
case GL11.GL_LIGHT2 -> lightStates[2].isEnabled();
case GL11.GL_LIGHT3 -> lightStates[3].isEnabled();
case GL11.GL_LIGHT4 -> lightStates[4].isEnabled();
case GL11.GL_LIGHT5 -> lightStates[5].isEnabled();
case GL11.GL_LIGHT6 -> lightStates[6].isEnabled();
case GL11.GL_LIGHT7 -> lightStates[7].isEnabled();
case GL11.GL_SCISSOR_TEST -> scissorTest.isEnabled();
case GL11.GL_TEXTURE_2D -> textures.getTextureUnitStates(activeTextureUnit.getValue()).isEnabled();
case GL12.GL_RESCALE_NORMAL -> rescaleNormalState.isEnabled();
@@ -296,6 +345,14 @@ public class GLStateManager {
case GL11.GL_DEPTH_WRITEMASK -> depthState.isEnabled();
case GL11.GL_FOG -> fogMode.isEnabled();
case GL11.GL_LIGHTING -> lightingState.isEnabled();
case GL11.GL_LIGHT0 -> lightStates[0].isEnabled();
case GL11.GL_LIGHT1 -> lightStates[1].isEnabled();
case GL11.GL_LIGHT2 -> lightStates[2].isEnabled();
case GL11.GL_LIGHT3 -> lightStates[3].isEnabled();
case GL11.GL_LIGHT4 -> lightStates[4].isEnabled();
case GL11.GL_LIGHT5 -> lightStates[5].isEnabled();
case GL11.GL_LIGHT6 -> lightStates[6].isEnabled();
case GL11.GL_LIGHT7 -> lightStates[7].isEnabled();
case GL11.GL_SCISSOR_TEST -> scissorTest.isEnabled();
case GL11.GL_TEXTURE_2D -> textures.getTextureUnitStates(activeTextureUnit.getValue()).isEnabled();
case GL12.GL_RESCALE_NORMAL -> rescaleNormalState.isEnabled();
@@ -366,6 +423,24 @@ public class GLStateManager {
}
public static void glGetLight(int light, int pname, FloatBuffer params) {
if (shouldBypassCache()) {
GL11.glGetLight(light, pname, params);
return;
}
LightStateStack state = lightDataStates[light - GL11.GL_LIGHT0];
switch (pname) {
case GL11.GL_AMBIENT -> state.ambient.get(0, params);
case GL11.GL_DIFFUSE -> state.diffuse.get(0, params);
case GL11.GL_SPECULAR -> state.specular.get(0, params);
case GL11.GL_POSITION -> state.position.get(0, params);
case GL11.GL_SPOT_DIRECTION -> state.spotDirection.get(0, params);
case GL11.GL_SPOT_EXPONENT -> params.put(state.spotExponent);
case GL11.GL_SPOT_CUTOFF -> params.put(state.spotCutoff);
case GL11.GL_CONSTANT_ATTENUATION -> params.put(state.constantAttenuation);
case GL11.GL_LINEAR_ATTENUATION -> params.put(state.linearAttenuation);
case GL11.GL_QUADRATIC_ATTENUATION -> params.put(state.quadraticAttenuation);
}
GL11.glGetLight(light, pname, params);
}
@@ -580,6 +655,8 @@ public class GLStateManager {
return ((b - Byte.MIN_VALUE) & 0xFF) / 255.0F;
}
public static float i2f(int i) { return ((i - Integer.MIN_VALUE) & 0xFFFFFF) / 4294967295.0F; }
private static boolean changeColor(float red, float green, float blue, float alpha) {
// Helper function for glColor*
if (shouldBypassCache() || red != color.getRed() || green != color.getGreen() || blue != color.getBlue() || alpha != color.getAlpha()) {
@@ -885,10 +962,18 @@ public class GLStateManager {
lightingState.enable();
}
public static void enableLight(int light) {
lightStates[light].enable();
}
public static void disableLighting() {
lightingState.disable();
}
public static void disableLight(int light) {
lightStates[light].disable();
}
public static void enableRescaleNormal() {
rescaleNormalState.enable();
}
@@ -1112,8 +1197,8 @@ public class GLStateManager {
}
public static void glLoadMatrix(DoubleBuffer m) {
conersionMatrix4d.set(m);
getMatrixStack().set(conersionMatrix4d);
conversionMatrix4d.set(m);
getMatrixStack().set(conversionMatrix4d);
GL11.glLoadMatrix(m);
}
@@ -1132,6 +1217,10 @@ public class GLStateManager {
}
}
public static Matrix4f getModelviewMatrix() {
return modelViewMatrix;
}
public static void glLoadIdentity() {
GL11.glLoadIdentity();
getMatrixStack().identity();
@@ -1160,16 +1249,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();
@@ -1247,6 +1336,9 @@ public class GLStateManager {
return true;
}
final TextureInfo info = TextureInfoCache.INSTANCE.getInfo(texture);
if (info == null) {
return true;
}
switch (pname) {
case GL11.GL_TEXTURE_MIN_FILTER -> {
if(info.getMinFilter() == param && !shouldBypassCache()) return false;
@@ -1318,6 +1410,9 @@ public class GLStateManager {
return true;
}
final TextureInfo info = TextureInfoCache.INSTANCE.getInfo(texture);
if (info == null) {
return true;
}
switch (pname) {
case EXTTextureFilterAnisotropic.GL_TEXTURE_MAX_ANISOTROPY_EXT -> {
if(info.getMaxAnisotropy() == param && !shouldBypassCache()) return false;
@@ -1343,7 +1438,9 @@ public class GLStateManager {
public static int getTexParameterOrDefault(int texture, int pname, IntSupplier defaultSupplier) {
final TextureInfo info = TextureInfoCache.INSTANCE.getInfo(texture);
if (info == null) {
return defaultSupplier.getAsInt();
}
return switch (pname) {
case GL11.GL_TEXTURE_MIN_FILTER -> info.getMinFilter();
case GL11.GL_TEXTURE_MAG_FILTER -> info.getMagFilter();
@@ -1367,6 +1464,9 @@ public class GLStateManager {
return GL11.glGetTexParameterf(target, pname);
}
final TextureInfo info = TextureInfoCache.INSTANCE.getInfo(getBoundTexture());
if(info == null) {
return GL11.glGetTexParameterf(target, pname);
}
return switch (pname) {
case EXTTextureFilterAnisotropic.GL_TEXTURE_MAX_ANISOTROPY_EXT -> info.getMaxAnisotropy();
@@ -1380,7 +1480,9 @@ public class GLStateManager {
return GL11.glGetTexLevelParameteri(target, level, pname);
}
final TextureInfo info = TextureInfoCache.INSTANCE.getInfo(getBoundTexture());
if (info == null) {
return GL11.glGetTexLevelParameteri(target, level, pname);
}
return switch (pname) {
case GL11.GL_TEXTURE_WIDTH -> info.getWidth();
case GL11.GL_TEXTURE_HEIGHT -> info.getHeight();
@@ -1390,10 +1492,61 @@ public class GLStateManager {
}
public static void glLight(int light, int pname, FloatBuffer params) {
GL11.glLight(light, pname, params);
LightStateStack lightState = lightDataStates[light - GL11.GL_LIGHT0];
switch (pname) {
case GL11.GL_AMBIENT -> lightState.setAmbient(params);
case GL11.GL_DIFFUSE -> lightState.setDiffuse(params);
case GL11.GL_SPECULAR -> lightState.setSpecular(params);
case GL11.GL_POSITION -> lightState.setPosition(params);
case GL11.GL_SPOT_DIRECTION -> lightState.setSpotDirection(params);
case GL11.GL_SPOT_EXPONENT -> lightState.setSpotExponent(params);
case GL11.GL_SPOT_CUTOFF -> lightState.setSpotCutoff(params);
case GL11.GL_CONSTANT_ATTENUATION -> lightState.setConstantAttenuation(params);
case GL11.GL_LINEAR_ATTENUATION -> lightState.setLinearAttenuation(params);
case GL11.GL_QUADRATIC_ATTENUATION -> lightState.setQuadraticAttenuation(params);
default -> GL11.glLight(light, pname, params);
}
}
public static void glLight(int light, int pname, IntBuffer params) {
GL11.glLight(light, pname, params);
LightStateStack lightState = lightDataStates[light - GL11.GL_LIGHT0];
switch (pname) {
case GL11.GL_AMBIENT -> lightState.setAmbient(params);
case GL11.GL_DIFFUSE -> lightState.setDiffuse(params);
case GL11.GL_SPECULAR -> lightState.setSpecular(params);
case GL11.GL_POSITION -> lightState.setPosition(params);
case GL11.GL_SPOT_DIRECTION -> lightState.setSpotDirection(params);
case GL11.GL_SPOT_EXPONENT -> lightState.setSpotExponent(params);
case GL11.GL_SPOT_CUTOFF -> lightState.setSpotCutoff(params);
case GL11.GL_CONSTANT_ATTENUATION -> lightState.setConstantAttenuation(params);
case GL11.GL_LINEAR_ATTENUATION -> lightState.setLinearAttenuation(params);
case GL11.GL_QUADRATIC_ATTENUATION -> lightState.setQuadraticAttenuation(params);
default -> GL11.glLight(light, pname, params);
}
}
public static void glLightf(int light, int pname, float param) {
LightStateStack lightState = lightDataStates[light - GL11.GL_LIGHT0];
switch (pname) {
case GL11.GL_SPOT_EXPONENT -> lightState.setSpotExponent(param);
case GL11.GL_SPOT_CUTOFF -> lightState.setSpotCutoff(param);
case GL11.GL_CONSTANT_ATTENUATION -> lightState.setConstantAttenuation(param);
case GL11.GL_LINEAR_ATTENUATION -> lightState.setLinearAttenuation(param);
case GL11.GL_QUADRATIC_ATTENUATION -> lightState.setQuadraticAttenuation(param);
default -> GL11.glLightf(light, pname, param);
}
}
public static void glLighti(int light, int pname, int param) {
LightStateStack lightState = lightDataStates[light - GL11.GL_LIGHT0];
switch (pname) {
case GL11.GL_SPOT_EXPONENT -> lightState.setSpotExponent(param);
case GL11.GL_SPOT_CUTOFF -> lightState.setSpotCutoff(param);
case GL11.GL_CONSTANT_ATTENUATION -> lightState.setConstantAttenuation(param);
case GL11.GL_LINEAR_ATTENUATION -> lightState.setLinearAttenuation(param);
case GL11.GL_QUADRATIC_ATTENUATION -> lightState.setQuadraticAttenuation(param);
default -> GL11.glLighti(light, pname, param);
}
}
public static void glLightModel(int pname, FloatBuffer params) {
@@ -34,4 +34,7 @@ public class AlphaStateStack extends AlphaState implements IStateStack<AlphaStat
return this;
}
public boolean isEmpty() {
return pointer == 0;
}
}
@@ -34,4 +34,7 @@ public class BlendStateStack extends BlendState implements IStateStack<BlendStat
return this;
}
public boolean isEmpty() {
return pointer == 0;
}
}
@@ -39,4 +39,7 @@ public class BooleanStateStack extends BooleanState implements IStateStack<Boole
return this;
}
public boolean isEmpty() {
return pointer == 0;
}
}
@@ -39,4 +39,7 @@ public class Color4Stack extends Color4 implements IStateStack<Color4Stack> {
return this;
}
public boolean isEmpty() {
return pointer == 0;
}
}
@@ -34,4 +34,7 @@ public class ColorMaskStack extends ColorMask implements IStateStack<ColorMaskSt
return this;
}
public boolean isEmpty() {
return pointer == 0;
}
}
@@ -34,4 +34,7 @@ public class DepthStateStack extends DepthState implements IStateStack<DepthStat
return this;
}
public boolean isEmpty() {
return pointer == 0;
}
}
@@ -34,4 +34,7 @@ public class FogStateStack extends FogState implements IStateStack<FogStateStack
return this;
}
public boolean isEmpty() {
return pointer == 0;
}
}
@@ -6,4 +6,6 @@ public interface IStateStack<T>{
T pop();
boolean isEmpty();
}
@@ -39,4 +39,7 @@ public class IntegerStateStack extends IntegerState implements IStateStack<Integ
return this;
}
public boolean isEmpty() {
return pointer == 0;
}
}
@@ -0,0 +1,39 @@
package com.gtnewhorizons.angelica.glsm.stacks;
import com.gtnewhorizons.angelica.glsm.GLStateManager;
import com.gtnewhorizons.angelica.glsm.states.LightState;
public class LightStateStack extends LightState implements IStateStack<LightStateStack> {
protected final LightState[] stack;
protected int pointer;
public LightStateStack(int light) {
super(light);
stack = new LightState[GLStateManager.MAX_ATTRIB_STACK_DEPTH];
for (int i = 0; i < GLStateManager.MAX_ATTRIB_STACK_DEPTH; i++) {
stack[i] = new LightState(light);
}
}
public LightStateStack push() {
if (pointer == stack.length) {
throw new IllegalStateException("Stack overflow size " + (pointer + 1) + " reached");
}
stack[pointer++].set(this);
return this;
}
public LightStateStack pop() {
if (pointer == 0) {
throw new IllegalStateException("Stack underflow");
}
set(stack[--pointer]);
return this;
}
public boolean isEmpty() { return pointer == 0; }
}
@@ -34,4 +34,7 @@ public class MatrixModeStack extends MatrixMode implements IStateStack<MatrixMod
return this;
}
public boolean isEmpty() {
return pointer == 0;
}
}
@@ -37,4 +37,8 @@ public class TextureBindingStack extends TextureBinding implements IStateStack<T
public TextureBinding peek() {
return stack[pointer];
}
public boolean isEmpty() {
return pointer == 0;
}
}
@@ -32,4 +32,8 @@ public class Vector3dStack extends Vector3d implements IStateStack<Vector3dStack
set(stack[--pointer]);
return this;
}
public boolean isEmpty() {
return pointer == 0;
}
}
@@ -34,4 +34,7 @@ public class ViewPortStateStack extends ViewportState implements IStateStack<Vie
return this;
}
public boolean isEmpty() {
return pointer == 0;
}
}
@@ -0,0 +1,291 @@
package com.gtnewhorizons.angelica.glsm.states;
import com.gtnewhorizons.angelica.glsm.GLStateManager;
import org.joml.Matrix3f;
import org.joml.Vector3f;
import org.joml.Vector3i;
import org.joml.Vector4f;
import org.joml.Vector4i;
import org.lwjgl.opengl.GL11;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import static com.gtnewhorizons.angelica.glsm.GLStateManager.i2f;
public class LightState implements ISettableState<LightState> {
private static final Vector4i vector4i = new Vector4i();
private static final Vector4f vector4f = new Vector4f();
private static final Vector3i vector3i = new Vector3i();
private static final Vector3f vector3f = new Vector3f();
private static final Matrix3f matrix3f = new Matrix3f();
public int light;
public final Vector4f ambient;
public final Vector4f diffuse;
public final Vector4f specular;
public final Vector4f position;
public final Vector3f spotDirection;
public float spotExponent;
public float spotCutoff;
public float constantAttenuation;
public float linearAttenuation;
public float quadraticAttenuation;
public LightState(int light) {
this(
light,
new Vector4f(0F, 0F, 0F, 1F),
new Vector4f(0F, 0F, 0F, 1F),
new Vector4f(0F, 0F, 0F, 1F),
new Vector4f(0F, 0F, 1F, 0F),
new Vector3f(0F, 0F, -1F),
0F,
180F,
1.0F,
0.0F,
0.0F
);
if (light == GL11.GL_LIGHT0) {
this.diffuse.set(1F, 1F, 1F, 1F);
this.specular.set(1F, 1F, 1F, 1F);
}
}
public LightState(int light, Vector4f ambient, Vector4f diffuse, Vector4f specular, Vector4f position, Vector3f spotDirection, float spotExponent, float spotCutoff, float constantAttenuation, float linearAttenuation, float quadraticAttenuation) {
this.light = light;
this.ambient = ambient;
this.diffuse = diffuse;
this.specular = specular;
this.spotExponent = spotExponent;
this.spotCutoff = spotCutoff;
this.constantAttenuation = constantAttenuation;
this.linearAttenuation = linearAttenuation;
this.quadraticAttenuation = quadraticAttenuation;
this.position = position;
this.position.mul(GLStateManager.getModelviewMatrix());
this.spotDirection = spotDirection;
GLStateManager.getModelviewMatrix().get3x3(matrix3f);
this.spotDirection.mul(matrix3f);
}
public void setAmbient(FloatBuffer newBuffer) {
vector4f.set(newBuffer);
if (GLStateManager.shouldBypassCache() || !this.ambient.equals(vector4f)) {
this.ambient.set(vector4f);
GL11.glLight(this.light, GL11.GL_AMBIENT, newBuffer);
}
}
public void setAmbient(IntBuffer newBuffer) {
vector4i.set(newBuffer);
vector4f.set(i2f(vector4i.x), i2f(vector4i.y), i2f(vector4i.z), i2f(vector4i.w));
if (GLStateManager.shouldBypassCache() || !this.ambient.equals(vector4f)) {
this.ambient.set(vector4f);
GL11.glLight(this.light, GL11.GL_AMBIENT, newBuffer);
}
}
public void setDiffuse(FloatBuffer newBuffer) {
vector4f.set(newBuffer);
if (GLStateManager.shouldBypassCache() || !this.diffuse.equals(vector4f)) {
this.diffuse.set(vector4f);
GL11.glLight(this.light, GL11.GL_DIFFUSE, newBuffer);
}
}
public void setDiffuse(IntBuffer newBuffer) {
vector4i.set(newBuffer);
vector4f.set(i2f(vector4i.x), i2f(vector4i.y), i2f(vector4i.z), i2f(vector4i.w));
if (GLStateManager.shouldBypassCache() || !this.diffuse.equals(vector4f)) {
this.diffuse.set(vector4f);
GL11.glLight(this.light, GL11.GL_DIFFUSE, newBuffer);
}
}
public void setSpecular(FloatBuffer newBuffer) {
vector4f.set(newBuffer);
if (GLStateManager.shouldBypassCache() || !this.specular.equals(vector4f)) {
this.specular.set(vector4f);
GL11.glLight(this.light, GL11.GL_SPECULAR, newBuffer);
}
}
public void setSpecular(IntBuffer newBuffer) {
vector4i.set(newBuffer);
vector4f.set(i2f(vector4i.x), i2f(vector4i.y), i2f(vector4i.z), i2f(vector4i.w));
if (GLStateManager.shouldBypassCache() || !this.specular.equals(vector4f)) {
this.specular.set(vector4f);
GL11.glLight(this.light, GL11.GL_SPECULAR, newBuffer);
}
}
public void setPosition(FloatBuffer newBuffer) {
// We are bypassing cache everytime for position, because the necessary components to enable tracking the cache
// are big and probably more than just bypassing. We would need to track the modelview matrix it was transformed
// with and the untransformed coordinates in addition to the final transformation.
this.position.set(newBuffer);
this.position.mul(GLStateManager.getModelviewMatrix());
GL11.glLight(this.light, GL11.GL_POSITION, newBuffer);
}
public void setPosition(IntBuffer newBuffer) {
vector4i.set(newBuffer);
this.position.set((float) vector4i.x, (float) vector4i.y, (float) vector4i.z, (float) vector4i.w);
this.position.mul(GLStateManager.getModelviewMatrix());
GL11.glLight(this.light, GL11.GL_POSITION, newBuffer);
}
public void setSpotDirection(FloatBuffer newBuffer) {
// We are bypassing cache everytime for spot direction, because the necessary components to enable tracking the cache
// are big and probably more than just bypassing. We would need to track the modelview matrix it was transformed
// with and the untransformed coordinates in addition to the final transformation.
GLStateManager.getModelviewMatrix().get3x3(matrix3f);
this.spotDirection.set(newBuffer);
this.spotDirection.mul(matrix3f);
GL11.glLight(this.light, GL11.GL_SPOT_DIRECTION, newBuffer);
}
public void setSpotDirection(IntBuffer newBuffer) {
vector3i.set(newBuffer);
GLStateManager.getModelviewMatrix().get3x3(matrix3f);
this.spotDirection.set((float) vector3i.x, (float) vector3i.y, (float) vector3i.z);
this.spotDirection.mul(matrix3f);
GL11.glLight(this.light, GL11.GL_SPOT_DIRECTION, newBuffer);
}
public void setSpotExponent(FloatBuffer newBuffer) {
setSpotExponent(newBuffer.get());
}
public void setSpotExponent(IntBuffer newBuffer) {
setSpotExponent((float) newBuffer.get());
}
public void setSpotExponent(int i) {
setSpotExponent((float) i);
}
public void setSpotExponent(float f) {
if (GLStateManager.shouldBypassCache() || Float.compare(f, this.spotExponent) != 0) {
this.spotExponent = f;
GL11.glLightf(this.light, GL11.GL_SPOT_EXPONENT, f);
}
}
public void setSpotCutoff(FloatBuffer newBuffer) {
setSpotCutoff(newBuffer.get());
}
public void setSpotCutoff(IntBuffer newBuffer) {
setSpotCutoff((float) newBuffer.get());
}
public void setSpotCutoff(int i) {
setSpotCutoff((float) i);
}
public void setSpotCutoff(float f) {
if (GLStateManager.shouldBypassCache() || Float.compare(f, this.spotCutoff) != 0) {
this.spotCutoff = f;
GL11.glLightf(this.light, GL11.GL_SPOT_CUTOFF, f);
}
}
public void setConstantAttenuation(FloatBuffer newBuffer) {
setConstantAttenuation(newBuffer.get());
}
public void setConstantAttenuation(IntBuffer newBuffer) {
setConstantAttenuation((float) newBuffer.get());
}
public void setConstantAttenuation(int i) {
setConstantAttenuation((float) i);
}
public void setConstantAttenuation(float f) {
if (GLStateManager.shouldBypassCache() || Float.compare(f, this.constantAttenuation) != 0) {
this.constantAttenuation = f;
GL11.glLightf(this.light, GL11.GL_CONSTANT_ATTENUATION, f);
}
}
public void setLinearAttenuation(FloatBuffer newBuffer) {
setLinearAttenuation(newBuffer.get());
}
public void setLinearAttenuation(IntBuffer newBuffer) {
setLinearAttenuation((float) newBuffer.get());
}
public void setLinearAttenuation(int i) {
setLinearAttenuation((float) i);
}
public void setLinearAttenuation(float f) {
if (GLStateManager.shouldBypassCache() || Float.compare(f, this.linearAttenuation) != 0) {
this.linearAttenuation = f;
GL11.glLightf(this.light, GL11.GL_LINEAR_ATTENUATION, f);
}
}
public void setQuadraticAttenuation(FloatBuffer newBuffer) {
setQuadraticAttenuation(newBuffer.get());
}
public void setQuadraticAttenuation(IntBuffer newBuffer) {
setQuadraticAttenuation((float) newBuffer.get());
}
public void setQuadraticAttenuation(int i) {
setQuadraticAttenuation((float) i);
}
public void setQuadraticAttenuation(float f) {
if (GLStateManager.shouldBypassCache() || Float.compare(f, this.quadraticAttenuation) != 0) {
this.quadraticAttenuation = f;
GL11.glLightf(this.light, GL11.GL_QUADRATIC_ATTENUATION, f);
}
}
@Override
public LightState set(LightState state) {
this.ambient.set(state.ambient);
this.diffuse.set(state.diffuse);
this.specular.set(state.specular);
this.position.set(state.position);
this.spotDirection.set(state.spotDirection);
this.spotExponent = state.spotExponent;
this.spotCutoff = state.spotCutoff;
this.constantAttenuation = state.constantAttenuation;
this.linearAttenuation = state.linearAttenuation;
this.quadraticAttenuation = state.quadraticAttenuation;
return this;
}
@Override
public boolean sameAs(Object state) {
if (this == state) return true;
if (!(state instanceof LightState lightState)) return false;
return this.ambient.equals(lightState.ambient)
&& this.diffuse.equals(lightState.diffuse)
&& this.specular.equals(lightState.specular)
&& this.position.equals(lightState.position)
&& this.spotDirection.equals(lightState.spotDirection)
&& Float.compare(this.spotCutoff, lightState.spotCutoff) == 0
&& Float.compare(this.spotExponent, lightState.spotExponent) == 0
&& Float.compare(this.linearAttenuation, lightState.linearAttenuation) == 0
&& Float.compare(this.constantAttenuation, lightState.constantAttenuation) == 0
&& Float.compare(this.quadraticAttenuation, lightState.quadraticAttenuation) == 0;
}
@Override
public LightState copy() { return new LightState(this.light).set(this); }
}
@@ -21,20 +21,23 @@ public class TextureInfoCache {
}
public TextureInfo getInfo(int id) {
if(id < 0 || !GLStateManager.isMainThread()) return null;
return cache.computeIfAbsent(id, TextureInfo::new);
}
public void onTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, @Nullable IntBuffer pixels) {
if (level == 0) {
if (target == GL11.GL_TEXTURE_2D && level == 0) {
final TextureInfo info = getInfo(GLStateManager.getBoundTexture());
if(info == null) return;
info.internalFormat = internalformat;
info.width = width;
info.height = height;
}
}
public void onTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, long pixels_buffer_offset) {
if (level == 0) {
if (target == GL11.GL_TEXTURE_2D && level == 0) {
final TextureInfo info = getInfo(GLStateManager.getBoundTexture());
if(info == null) return;
info.internalFormat = internalformat;
info.width = width;
info.height = height;
@@ -42,7 +45,7 @@ public class TextureInfoCache {
}
public void onDeleteTexture(int id) {
cache.remove(id);
if(id >= 0 && GLStateManager.isMainThread()) cache.remove(id);
}
}
@@ -3,7 +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.config.AngelicaConfig;
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;
@@ -28,6 +33,7 @@ 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;
@@ -38,6 +44,7 @@ public class HUDCaching {
private static final Minecraft mc = Minecraft.getMinecraft();
public static Framebuffer framebuffer;
private static boolean dirty = true;
private static long nextHudRefresh;
public static boolean renderingCacheOverride;
@@ -54,6 +61,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();
@@ -99,13 +108,6 @@ public class HUDCaching {
/* TODO END REMOVE DEBUG STUFF */
@SubscribeEvent
public void onTick(TickEvent.ClientTickEvent event) {
if (event.phase == TickEvent.Phase.END) {
dirty = true;
}
}
// highest so it runs before the GLSM load event
@SubscribeEvent(priority = EventPriority.HIGH)
public void onJoinWorld(WorldEvent.Load event) {
@@ -119,13 +121,23 @@ public class HUDCaching {
@SuppressWarnings("unused")
public static void renderCachedHud(EntityRenderer renderer, GuiIngame ingame, float partialTicks, boolean hasScreen, int mouseX, int mouseY) {
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;
}
if (System.currentTimeMillis() > nextHudRefresh) {
dirty = true;
}
if (dirty) {
dirty = false;
nextHudRefresh = System.currentTimeMillis() + (1000 / AngelicaConfig.hudCachingFPS);
resetFramebuffer(mc.displayWidth, mc.displayHeight);
framebuffer.bindFramebuffer(false);
renderingCacheOverride = true;
@@ -152,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);
@@ -164,6 +181,7 @@ public class HUDCaching {
if (renderCrosshairsCaptured) {
guiForge.callRenderCrosshairs(width, height);
}
} else {
if (renderHelmetCaptured)
{
@@ -227,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;
}
}
}
@@ -7,9 +7,10 @@ import com.gtnewhorizon.gtnhmixins.IEarlyMixinLoader;
import com.gtnewhorizons.angelica.config.AngelicaConfig;
import com.gtnewhorizons.angelica.mixins.Mixins;
import com.gtnewhorizons.angelica.mixins.TargetedMod;
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;
@@ -19,6 +20,8 @@ import org.apache.logging.log4j.core.config.LoggerConfig;
import org.spongepowered.asm.launch.GlobalProperties;
import org.spongepowered.asm.service.mojang.MixinServiceLaunchWrapper;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -67,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;
}
@@ -26,6 +26,10 @@ public class MixinCompatHackTweaker implements ITweaker {
LOGGER.info("Disabling Optifine and Fastcraft (if present)");
disableOptifineAndFastcraft();
}
if (AngelicaConfig.enableHudCaching){
disableXaerosMinimapWaypointTransformer();
}
}
private void verifyDependencies() {
@@ -34,6 +38,25 @@ public class MixinCompatHackTweaker implements ITweaker {
}
}
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 {
@@ -4,7 +4,8 @@ import com.gtnewhorizons.angelica.AngelicaMod;
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;
@@ -27,6 +28,7 @@ public enum Mixins {
,"angelica.MixinEntityRenderer"
,"angelica.MixinMinecraft"
,"angelica.optimizations.MixinRendererLivingEntity"
,"angelica.MixinFMLClientHandler"
)
),
ANGELICA_VBO(
@@ -52,6 +54,20 @@ public enum Mixins {
,"angelica.debug.MixinTextureManager"
)
),
ANGELICA_DYNAMIC_LIGHTS(new Builder("Angelica Dynamic Lights").addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT)
.setPhase(Phase.EARLY).setApplyIf(() -> AngelicaConfig.enableDynamicLights).addMixinClasses(
"angelica.dynamiclights.MixinEntityRenderer"
,"angelica.dynamiclights.MixinEntity"
,"angelica.dynamiclights.MixinWorld"
,"angelica.dynamiclights.MixinItemRenderer"
)
),
ANGELICA_FIX_FLUID_RENDERER_CHECKING_BLOCK_AGAIN(
new Builder("Fix RenderBlockFluid reading the block type from the world access multiple times")
.setPhase(Phase.EARLY).addMixinClasses("angelica.bugfixes.MixinRenderBlockFluid").setSide(Side.BOTH)
.setApplyIf(() -> AngelicaConfig.fixFluidRendererCheckingBlockAgain)
.addTargetedMod(TargetedMod.VANILLA)),
// Not compatible with the lwjgl debug callbacks, so disable if that's enabled
ARCHAIC_SPLASH(new Builder("ArchaicFix Splash").addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT)
@@ -86,6 +102,7 @@ public enum Mixins {
.setPhase(Phase.EARLY).setApplyIf(() -> AngelicaConfig.enableSodium).addMixinClasses(
"sodium.MixinChunkProviderClient"
,"sodium.MixinBlock"
,"sodium.MixinBlockFluidBase"
,"sodium.AccessorBiomeColorEvent"
,"sodium.MixinBiomeGenBase"
,"sodium.MixinChunk"
@@ -107,19 +124,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"
)
),
@@ -163,6 +172,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",
@@ -189,6 +199,19 @@ 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")),
MFR_THREAD_SAFETY(new Builder("Enable thread safety fixes for MineFactory Reloaded").setPhase(Phase.LATE)
.addTargetedMod(TargetedMod.MINEFACTORY_RELOADED).setSide(Side.CLIENT)
.setApplyIf(() -> AngelicaConfig.fixMineFactoryReloadedSodiumCompat)
.addMixinClasses("client.minefactoryreloaded.MixinRedNetCableRenderer")),
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)
@@ -202,108 +225,157 @@ 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.fix.MixinRenderItem"
,"notfine.glint.MixinRenderBiped"
,"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.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.MixinRenderItem"
)),
"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",
"interpolatedtexturemap.MixinTextureMap"
))
),
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",
"MixinBlockEnchantmentTable",
"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_NATURA(new Builder("NotFine Natura compat")
.setSide(Side.CLIENT).setPhase(Phase.LATE)
.setApplyIf(() -> AngelicaConfig.enableNotFineFeatures)
.addTargetedMod(TargetedMod.NATURA)
.addMixinClasses(addPrefix("notfine.leaves.natura.",
"MixinBerryBush",
"MixinNetherBerryBush"
))
),
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_TINKERS_CONSTRUCT(new Builder("NotFine Tinker's Construct compat")
.setSide(Side.CLIENT).setPhase(Phase.LATE)
.setApplyIf(() -> AngelicaConfig.enableNotFineFeatures)
.addTargetedMod(TargetedMod.TINKERS_CONSTRUCT)
.addMixinClasses("notfine.leaves.tconstruct.MixinOreberryBush")
),
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"
// 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)
"base.MixinMinecraft"
))
),
MCPATCHER_FORGE_RENDERPASS(new Builder("MCPatcher Forge Renderpass")
.setPhase(Phase.EARLY)
.setApplyIf(() -> NotFineConfig.renderPass)
.addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses(addPrefix("mcpatcherforge.",
"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",
@@ -351,55 +423,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)
"world.MixinWorldProviderHell"
))
),
MCPATCHER_FORGE_CUSTOM_ITEM_TEXTURES(new Builder("MCP:F Custom Item Textures")
.setSide(Side.CLIENT).setPhase(Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && 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)
.addMixinClasses("mcpatcherforge.ctm.MixinRenderBlocks")
),
MCPATCHER_FORGE_EXTENDED_HD(new Builder("MCP:F Extended hd")
.setSide(Side.CLIENT).setPhase(Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && 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.enableMCPatcherForgeFeatures && 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",
@@ -409,50 +482,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)
@@ -490,6 +564,11 @@ public enum Mixins {
}
public static List<String> getEarlyMixins(Set<String> loadedCoreMods) {
NotFineConfig.loadSettings();
//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()) {
@@ -15,15 +15,18 @@ public enum TargetedMod {
, DYNAMIC_SURROUNDINGS_MIST("Dynamic Surroundings", "org.blockartistry.mod.DynSurround.mixinplugin.DynamicSurroundingsEarlyMixins", "dsurround")
, DYNAMIC_SURROUNDINGS_ORIGINAL("Dynamic Surroundings", "org.blockartistry.mod.DynSurround.asm.TransformLoader", "dsurround")
, EXTRAUTILS("ExtraUtilities", null, "ExtraUtilities")
, MINEFACTORY_RELOADED("MineFactory Reloaded", null, "MineFactoryReloaded")
, GTNHLIB("GTNHLib", "com.gtnewhorizon.gtnhlib.core.GTNHLibCore", "gtnhlib")
, IC2("IC2", "ic2.core.coremod.IC2core", "IC2")
, JABBA("JABBA", null, "JABBA")
, JOURNEYMAP("JourneyMap", null, "journeymap")
, LWJGL3IFY("lwjgl3ify", "me.eigenraven.lwjgl3ify.core.Lwjgl3ifyCoremod", "lwjgl3ify")
, MRTJPCORE("MrTJPCore", null, "MrTJPCoreMod")
, NATURA("Natura", null, "Natura")
, PROJECTRED_ILLUMINATION("ProjectRed Illumination", null, "ProjRed|Illumination")
, SMART_RENDER("Smart Render", null, "SmartRender")
, THAUMCRAFT("Thaumcraft", null, "Thaumcraft")
, TINKERS_CONSTRUCT("Tinker's Construct", null, "TConstruct")
, TWILIGHT_FOREST("TwilightForest", null, "TwilightForest")
, WITCHERY("Witchery", null, "witchery")
;
@@ -7,6 +7,7 @@ import net.minecraft.entity.EntityLivingBase;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyArg;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(EntityRenderer.class)
@@ -22,4 +23,10 @@ public abstract class MixinEntityRenderer {
viewEntity.lastTickPosZ + (viewEntity.posZ - viewEntity.lastTickPosZ) * partialTicks
);
}
@ModifyArg(method = "setupCameraTransform", at = @At(value = "INVOKE", target = "Lorg/lwjgl/util/glu/Project;gluPerspective(FFFF)V", ordinal = 0), index = 0)
private float captureFov(float fov) {
RenderingState.INSTANCE.setFov(fov);
return fov;
}
}
@@ -0,0 +1,27 @@
package com.gtnewhorizons.angelica.mixins.early.angelica;
import cpw.mods.fml.client.FMLClientHandler;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
@Mixin(value = FMLClientHandler.class, remap = false)
public class MixinFMLClientHandler {
/**
* @author mitchej123
* @reason Remove more traces of Optifine
*/
@Overwrite
private void detectOptifine() {
// Do nothing
}
/**
* @author mitchej123
* @reason Remove more traces of Optifine
*/
@Overwrite
public boolean hasOptifine() {
return false;
}
}
@@ -0,0 +1,24 @@
package com.gtnewhorizons.angelica.mixins.early.angelica.bugfixes;
import com.gtnewhorizons.angelica.mixins.hooks.FluidHooks;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.fluids.BlockFluidBase;
import net.minecraftforge.fluids.RenderBlockFluid;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import com.llamalad7.mixinextras.sugar.Local;
@Mixin(value = RenderBlockFluid.class, remap = false)
public class MixinRenderBlockFluid {
@Redirect(
method = "renderWorldBlock", at = @At(
value = "INVOKE",
target = "Lnet/minecraftforge/fluids/BlockFluidBase;getFlowDirection(Lnet/minecraft/world/IBlockAccess;III)D"))
double hodgepodge$directFlowDirectionCheck(IBlockAccess world, int x, int y, int z, @Local BlockFluidBase block) {
return FluidHooks.getFlowDirection(world, x, y, z, block);
}
}
@@ -0,0 +1,171 @@
package com.gtnewhorizons.angelica.mixins.early.angelica.dynamiclights;
import com.gtnewhorizons.angelica.compat.mojang.BlockPosImpl;
import com.gtnewhorizons.angelica.dynamiclights.DynamicLights;
import com.gtnewhorizons.angelica.dynamiclights.IDynamicLightSource;
import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
import me.jellysquid.mods.sodium.client.render.SodiumWorldRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import org.jetbrains.annotations.NotNull;
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.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(Entity.class)
public abstract class MixinEntity implements IDynamicLightSource {
@Shadow
public World worldObj;
@Shadow
public double posX;
@Shadow
public double posY;
@Shadow
public double posZ;
@Shadow
public int chunkCoordX;
@Shadow
public int chunkCoordZ;
@Shadow
public abstract float getEyeHeight();
@Shadow
public boolean isDead;
@Unique
protected int angelica$luminance = 0;
@Unique
private int angelica$lastLuminance = 0;
@Unique
private static long angelica$lastUpdate = 0;
@Unique
private double angelica$prevX;
@Unique
private double angelica$prevY;
@Unique
private double angelica$prevZ;
@Unique
private LongOpenHashSet angelica$trackedLitChunkPos = new LongOpenHashSet();
@Override
public double angelica$getDynamicLightX() {
return posX;
}
@Override
public double angelica$getDynamicLightY() {
return posY + getEyeHeight();
}
@Override
public double angelica$getDynamicLightZ() {
return posZ;
}
@Override
public void angelica$resetDynamicLight() {
this.angelica$lastLuminance = 0;
}
@Override
public boolean angelica$shouldUpdateDynamicLight() {
if (DynamicLights.Mode.hasDelay()) {
long currentTime = System.currentTimeMillis();
if (currentTime < angelica$lastUpdate + DynamicLights.Mode.getDelay())
return false;
angelica$lastUpdate = currentTime;
}
return true;
}
@Inject(method = "onEntityUpdate", at = @At("TAIL"))
public void angelica$onUpdate(CallbackInfo ci) {
if (worldObj != null && worldObj.isRemote) {
if (isDead) {
angelica$setDynamicLightEnabled(false);
} else {
angelica$dynamicLightTick();
DynamicLights.updateTracking(this);
}
}
}
@Override
public void angelica$dynamicLightTick() {
this.angelica$luminance = DynamicLights.getLuminanceFromEntity((Entity) (Object) this);
}
@Override
public int angelica$getLuminance() {
return this.angelica$luminance;
}
@Override
public boolean angelica$updateDynamicLight(@NotNull SodiumWorldRenderer renderer) {
if (!this.angelica$shouldUpdateDynamicLight())
return false;
double deltaX = this.posX - this.angelica$prevX;
double deltaY = this.posY - this.angelica$prevY;
double deltaZ = this.posZ - this.angelica$prevZ;
int luminance = this.angelica$getLuminance();
if (Math.abs(deltaX) > 0.1D || Math.abs(deltaY) > 0.1D || Math.abs(deltaZ) > 0.1D || luminance != this.angelica$lastLuminance) {
this.angelica$prevX = this.posX;
this.angelica$prevY = this.posY;
this.angelica$prevZ = this.posZ;
this.angelica$lastLuminance = luminance;
var newPos = new LongOpenHashSet();
if (luminance > 0) {
var chunkPos = new BlockPosImpl(chunkCoordX, MathHelper.floor_double(posY + getEyeHeight()) >> 4, chunkCoordZ);
DynamicLights.scheduleChunkRebuild(renderer, chunkPos);
DynamicLights.updateTrackedChunks(chunkPos, this.angelica$trackedLitChunkPos, newPos);
var directionX = ((MathHelper.floor_double(posX) & 15) >= 8) ? ForgeDirection.EAST : ForgeDirection.WEST;
var directionY = ((MathHelper.floor_double(posY + getEyeHeight()) & 15) >= 8) ? ForgeDirection.UP : ForgeDirection.DOWN;
var directionZ = ((MathHelper.floor_double(posZ) & 15) >= 8) ? ForgeDirection.SOUTH : ForgeDirection.NORTH;
for (int i = 0; i < 7; i++) {
if (i % 4 == 0) {
chunkPos = chunkPos.offset(directionX); // X
} else if (i % 4 == 1) {
chunkPos = chunkPos.offset(directionZ); // XZ
} else if (i % 4 == 2) {
chunkPos = chunkPos.offset(directionX.getOpposite()); // Z
} else {
chunkPos = chunkPos.offset(directionZ.getOpposite()); // origin
chunkPos = chunkPos.offset(directionY); // Y
}
DynamicLights.scheduleChunkRebuild(renderer, chunkPos);
DynamicLights.updateTrackedChunks(chunkPos, this.angelica$trackedLitChunkPos, newPos);
}
}
// Schedules the rebuild of removed chunks.
this.angelica$scheduleTrackedChunksRebuild(renderer);
// Update tracked lit chunks.
this.angelica$trackedLitChunkPos = newPos;
return true;
}
return false;
}
@Override
public void angelica$scheduleTrackedChunksRebuild(@NotNull SodiumWorldRenderer renderer) {
for (long pos : this.angelica$trackedLitChunkPos) {
DynamicLights.scheduleChunkRebuild(renderer, pos);
}
}
}
@@ -0,0 +1,23 @@
package com.gtnewhorizons.angelica.mixins.early.angelica.dynamiclights;
import com.gtnewhorizons.angelica.dynamiclights.DynamicLights;
import me.jellysquid.mods.sodium.client.render.SodiumWorldRenderer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.EntityRenderer;
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.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(EntityRenderer.class)
public class MixinEntityRenderer {
@Shadow
private Minecraft mc;
@Inject(method = "renderWorld", at = @At("HEAD"))
private void updateDynamicLights(float p_78471_1_, long p_78471_2_, CallbackInfo ci){
mc.mcProfiler.endStartSection("angelica_dynamic_lighting");
DynamicLights.get().updateAll(SodiumWorldRenderer.getInstance());
}
}
@@ -0,0 +1,23 @@
package com.gtnewhorizons.angelica.mixins.early.angelica.dynamiclights;
import com.gtnewhorizons.angelica.dynamiclights.DynamicLights;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.renderer.ItemRenderer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@Mixin(ItemRenderer.class)
public class MixinItemRenderer {
@WrapOperation(method = "renderItemInFirstPerson", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/WorldClient;getLightBrightnessForSkyBlocks(IIII)I"))
private int angelica$dynamiclights_renderItemInFirstPerson(WorldClient theWorld, int posX, int posY, int posZ, int p_72802_4_, Operation<Integer> original){
int lightmap = original.call(theWorld, posX, posY, posZ, p_72802_4_);
if (DynamicLights.isEnabled()){
lightmap = (int)DynamicLights.get().getLightmapWithDynamicLight(posX, posY, posZ, lightmap);
}
return lightmap;
}
}
@@ -0,0 +1,39 @@
package com.gtnewhorizons.angelica.mixins.early.angelica.dynamiclights;
import com.gtnewhorizons.angelica.dynamiclights.DynamicLights;
import com.gtnewhorizons.angelica.dynamiclights.IDynamicLightSource;
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.world.World;
import net.minecraft.world.WorldSettings;
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.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(World.class)
public abstract class MixinWorld {
@Shadow
protected abstract void initialize(WorldSettings p_72963_1_);
@Shadow
public abstract Block getBlock(int p_147439_1_, int p_147439_2_, int p_147439_3_);
@Inject(method = "onEntityRemoved", at = @At("HEAD"))
private void angelica$removeEntity(Entity entity, CallbackInfo ci){
if (entity instanceof IDynamicLightSource lightSource){
lightSource.angelica$setDynamicLightEnabled(false);
}
}
@ModifyReturnValue(method = "getLightBrightnessForSkyBlocks", at = @At(value = "RETURN"))
private int angelica$dynamiclights_getLightBrightnessForSkyBlocks(int lightmap, int p_72802_1_, int p_72802_2_, int p_72802_3_, int p_72802_4_){
if (DynamicLights.isEnabled()){
return DynamicLights.get().getLightmapWithDynamicLight(p_72802_1_, p_72802_2_, p_72802_3_, lightmap);
}
return lightmap;
}
}
@@ -103,7 +103,7 @@ public abstract class MixinFontRenderer implements FontRendererAccessor {
@Shadow
protected abstract String bidiReorder(String p_147647_1_);
@Shadow
@Shadow(remap = false)
protected abstract void bindTexture(ResourceLocation location);
@Unique
@@ -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);
}
@@ -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;
}
@@ -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);
}
}
@@ -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.BlockEnchantmentTable;
import net.minecraft.block.material.Material;
import net.minecraft.world.IBlockAccess;
import org.spongepowered.asm.mixin.Mixin;
@Mixin(value = BlockEnchantmentTable.class)
public abstract class MixinBlockEnchantmentTable 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.75F, 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.75F;
}
private MixinBlockEnchantmentTable(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,118 @@
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 Do not render fence arms unless actually required.
*/
@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 Cull faces against solid blocks, fix door smooth lighting
*/
@Overwrite
public boolean renderBlockDoor(Block block, int x, int y, int z) {
final int meta = blockAccess.getBlockMetadata(x, y, z);
if((meta & 8) != 0) {
if (blockAccess.getBlock(x, y - 1, z) != block) {
return false;
}
} else if (blockAccess.getBlock(x, y + 1, z) != block) {
return false;
}
if ((meta & 8) != 0) {
uvRotateTop = meta % 6;
}
boolean flag = renderStandardBlock(block, x, y, z);
uvRotateTop = 0;
return flag;
}
/**
* @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 int uvRotateTop;
@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,51 @@
package com.gtnewhorizons.angelica.mixins.early.notfine.interpolatedtexturemap;
import com.google.gson.JsonObject;
import jss.notfine.render.InterpolatedIcon;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.AbstractTexture;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.client.renderer.texture.ITickableTextureObject;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.resources.IResource;
import net.minecraft.client.resources.SimpleResource;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import org.spongepowered.asm.mixin.Final;
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.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import java.util.Map;
@Mixin(TextureMap.class)
public abstract class MixinTextureMap extends AbstractTexture implements ITickableTextureObject, IIconRegister {
@Shadow
@Final
private Map mapRegisteredSprites;
@Shadow
protected abstract ResourceLocation completeResourceLocation(ResourceLocation p_147634_1_, int p_147634_2_);
@Inject(method = "registerIcon", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;<init>(Ljava/lang/String;)V"), cancellable = true)
private void registerInterpolatedIcon(String textureName, CallbackInfoReturnable<IIcon> cir) {
try {
IResource resource = Minecraft.getMinecraft().getResourceManager().getResource(completeResourceLocation(new ResourceLocation(textureName), 0));
if (resource instanceof SimpleResource) {
//This returns IMetadataSections, which seems to already remove unused mcmeta fields in 1.7.10
//I'm just running this to populate the mcmetaJson field more easily; this does it for us
if (resource.getMetadata("animation") != null) {
JsonObject mcmetaJson = ((SimpleResource) resource).mcmetaJson;
if (mcmetaJson.getAsJsonObject("animation").getAsJsonPrimitive("interpolate").getAsBoolean()) {
InterpolatedIcon interpolatedIcon = new InterpolatedIcon(textureName);
mapRegisteredSprites.put(textureName, interpolatedIcon);
cir.setReturnValue(interpolatedIcon);
}
}
}
} catch (Exception ignored) {/*Should quietly fail, no need to fail hard*/}
}
}
@@ -1,5 +1,6 @@
package com.gtnewhorizons.angelica.mixins.early.notfine.leaves;
import jss.notfine.util.IFaceObstructionCheckHelper;
import jss.notfine.util.ILeafBlock;
import jss.notfine.util.LeafRenderUtil;
import net.minecraft.block.Block;
@@ -9,13 +10,18 @@ import net.minecraft.world.IBlockAccess;
import org.spongepowered.asm.mixin.Mixin;
@Mixin(value = BlockLeavesBase.class)
public abstract class MixinBlockLeavesBase extends Block implements ILeafBlock {
public abstract class MixinBlockLeavesBase extends Block implements IFaceObstructionCheckHelper, ILeafBlock {
@Override
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
return LeafRenderUtil.shouldSideBeRendered(world, x, y, z, side);
}
@Override()
public boolean isFaceNonObstructing(IBlockAccess world, int x, int y, int z, int side, double otherMinX, double otherMinY, double otherMinZ, double otherMaxX, double otherMaxY, double otherMaxZ) {
return LeafRenderUtil.isFaceNonObstructing(world, x, y, z);
}
private MixinBlockLeavesBase(Material material) {
super(material);
}
@@ -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;
}
}
@@ -2,6 +2,10 @@ package com.gtnewhorizons.angelica.mixins.early.notfine.particles;
import java.util.Random;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import jss.notfine.core.Settings;
import net.minecraft.world.WorldProvider;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@@ -16,9 +20,31 @@ public abstract class MixinWorldClient {
* @author jss2a98aj
* @reason Xoshiro256** is faster than Random.
*/
@Redirect(method = "doVoidFogParticles(III)V", at = @At(value = "NEW", target = "java/util/Random", ordinal = 0))
@Redirect(
method = "doVoidFogParticles(III)V",
at = @At(
value = "NEW",
target = "()Ljava/util/Random;",
ordinal = 0
)
)
private Random notFine$redirectDoVoidFogParticlesRandom() {
return new RandomXoshiro256StarStar();
}
/**
* @author jss2a98aj
* @reason Toggle void particles.
*/
@WrapOperation(
method = "doVoidFogParticles(III)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/WorldProvider;getWorldHasVoidParticles()Z"
)
)
private boolean notFine$toggleVoidParticles(WorldProvider provider, Operation<Boolean> original){
return ((boolean) Settings.PARTICLES_VOID.option.getStore()) ? original.call(provider) : false;
}
}
@@ -1,25 +0,0 @@
package com.gtnewhorizons.angelica.mixins.early.notfine.particles;
import jss.notfine.core.Settings;
import net.minecraft.world.WorldProvider;
import net.minecraft.world.WorldType;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
@Mixin(value = WorldProvider.class)
public class MixinWorldProvider {
/**
* @author jss2a98aj
* @reason Toggle void particles.
*/
@Overwrite
public boolean getWorldHasVoidParticles() {
return (boolean)Settings.PARTICLES_VOID.option.getStore() && terrainType.hasVoidParticles(hasNoSky);
}
@Shadow public WorldType terrainType;
@Shadow public boolean hasNoSky;
}
@@ -0,0 +1,35 @@
package com.gtnewhorizons.angelica.mixins.early.notfine.toggle;
import jss.notfine.core.SettingsManager;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.settings.GameSettings;
import org.spongepowered.asm.lib.Opcodes;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(EntityRenderer.class)
public abstract class MixinEntityRenderer$RenderRainSnow {
@Redirect(
method = "renderRainSnow(F)V",
at = @At(
value = "FIELD",
target = "Lnet/minecraft/client/settings/GameSettings;fancyGraphics:Z",
opcode = Opcodes.GETFIELD
)
)
private boolean notFine$bypassWeatherMode(GameSettings settings) {
return false;
}
@ModifyVariable(
method = "renderRainSnow(F)V",
at = @At("STORE"),
ordinal = 0
)
private byte notFine$weatherDistance(byte distance) {
return SettingsManager.downfallDistance;
}
}
@@ -1,15 +1,21 @@
package com.gtnewhorizons.angelica.mixins.early.notfine.toggle;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import jss.notfine.core.Settings;
import jss.notfine.core.SettingsManager;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.world.WorldProvider;
import org.spongepowered.asm.lib.Opcodes;
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.ModifyVariable;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.lwjgl.opengl.GL11;
@Mixin(EntityRenderer.class)
abstract public class MixinEntityRenderer {
@@ -22,29 +28,59 @@ abstract public class MixinEntityRenderer {
ordinal = 0
)
)
private boolean notFine$toggleWaterDetail(GameSettings settings) {
private boolean toggleWaterDetail(GameSettings settings) {
return SettingsManager.waterDetail;
}
@Redirect(
method = "renderRainSnow(F)V",
/**
* @author Caedis
* @reason Void fog toggle
*/
@WrapOperation(
method = "setupFog",
at = @At(
value = "FIELD",
target = "Lnet/minecraft/client/settings/GameSettings;fancyGraphics:Z",
opcode = Opcodes.GETFIELD
value = "INVOKE",
target = "Lnet/minecraft/world/WorldProvider;getWorldHasVoidParticles()Z"
)
)
private boolean notFine$bypassWeatherMode(GameSettings settings) {
return false;
private boolean notFine$toggleVoidFog(WorldProvider provider, Operation<Boolean> original){
return ((boolean)Settings.VOID_FOG.option.getStore()) ? original.call(provider) : false;
}
@ModifyVariable(
method = "renderRainSnow(F)V",
at = @At("STORE"),
ordinal = 0
@Redirect(
method = "setupFog",
at = @At(
value = "INVOKE",
target = "Lorg/lwjgl/opengl/GL11;glFogf(IF)V",
ordinal = 14
)
)
private byte notFine$weatherDistance(byte distance) {
return SettingsManager.downfallDistance;
private void notFine$nearFogDistance(int mode, float value) {
GL11.glFogf(mode, farPlaneDistance * (int)Settings.FOG_NEAR_DISTANCE.option.getStore() * 0.01F - 1F);
}
@Redirect(
method = "updateRenderer()V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/EntityRenderer;updateTorchFlicker()V"
)
)
private void notFine$toggleTorchFlicker(EntityRenderer instance) {
if((boolean)Settings.MODE_LIGHT_FLICKER.option.getStore()) {
updateTorchFlicker();
} else {
lightmapUpdateNeeded = true;
}
}
@Shadow
abstract void updateTorchFlicker();
@Shadow
private boolean lightmapUpdateNeeded;
@Shadow
private float farPlaneDistance;
}
@@ -1,25 +0,0 @@
package com.gtnewhorizons.angelica.mixins.early.notfine_mcpf_compat;
import com.prupe.mcpatcher.cit.CITUtils;
import jss.notfine.core.Settings;
import net.minecraft.client.renderer.ItemRenderer;
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 {
@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 notFine$toggleGlint(ItemStack stack, int pass) {
return (boolean) Settings.MODE_GLINT_WORLD.option.getStore() && stack.hasEffect(pass) && !CITUtils.renderEnchantmentHeld(stack, pass);
}
}
@@ -1,26 +0,0 @@
package com.gtnewhorizons.angelica.mixins.early.notfine_mcpf_compat;
import com.prupe.mcpatcher.cit.CITUtils;
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;
@Mixin(RenderItem.class)
public class MixinRenderItem {
@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) && !CITUtils.renderEnchantmentDropped(stack) && (boolean) Settings.MODE_GLINT_WORLD.option.getStore();
}
}
@@ -0,0 +1,24 @@
package com.gtnewhorizons.angelica.mixins.early.sodium;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.llamalad7.mixinextras.sugar.Local;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraftforge.fluids.BlockFluidBase;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@Mixin(value = BlockFluidBase.class, remap = false)
public class MixinBlockFluidBase {
@WrapOperation(method = "getFlowDirection", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/material/Material;isLiquid()Z"), remap = true)
private static boolean isLiquid(Material instance, Operation<Boolean> original, @Local Block block) {
if (block instanceof BlockFluidBase) {
return original.call(instance);
} else {
return false;
}
}
}
@@ -5,6 +5,9 @@ import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.WorldChunkManager;
import net.minecraft.world.chunk.Chunk;
import com.gtnewhorizons.angelica.compat.ModStatus;
import com.gtnewhorizons.angelica.compat.endlessids.EndlessIDsCompat;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@@ -29,14 +32,18 @@ public abstract class MixinChunk {
if(this.worldObj.isRemote && !Minecraft.getMinecraft().isSingleplayer()) {
// We are in multiplayer, the server might not have sent all biomes to the client.
// Populate them now while we're on the main thread.
WorldChunkManager manager = this.worldObj.getWorldChunkManager();
for(int z = 0; z < 16; z++) {
for(int x = 0; x < 16; x++) {
int idx = (z << 4) + x;
int biome = this.blockBiomeArray[idx] & 255;
if(biome == 255) {
BiomeGenBase generated = manager.getBiomeGenAt((this.xPosition << 4) + x, (this.zPosition << 4) + z);
this.blockBiomeArray[idx] = (byte)(generated.biomeID & 255);
if (ModStatus.isEIDBiomeLoaded) {
EndlessIDsCompat.sodium$populateBiomes((Chunk) (Object) this);
} else {
WorldChunkManager manager = this.worldObj.getWorldChunkManager();
for (int z = 0; z < 16; z++) {
for (int x = 0; x < 16; x++) {
int idx = (z << 4) + x;
int biome = this.blockBiomeArray[idx] & 255;
if (biome == 255) {
BiomeGenBase generated = manager.getBiomeGenAt((this.xPosition << 4) + x, (this.zPosition << 4) + z);
this.blockBiomeArray[idx] = (byte) (generated.biomeID & 255);
}
}
}
}
@@ -1,21 +0,0 @@
package com.gtnewhorizons.angelica.mixins.early.sodium;
import me.jellysquid.mods.sodium.client.SodiumClientMod;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.settings.GameSettings;
import org.spongepowered.asm.lib.Opcodes;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
/**
* Dynamic surroundings overwrites the method resulting in a clash
*/
@Mixin(EntityRenderer.class)
public abstract class MixinEntityRenderer$WeatherQuality {
@Redirect(method = "renderRainSnow(F)V", at = @At(value = "FIELD", target = "Lnet/minecraft/client/settings/GameSettings;fancyGraphics:Z", opcode = Opcodes.GETFIELD))
protected boolean redirectGetFancyWeather(GameSettings settings) {
return SodiumClientMod.options().quality.weatherQuality.isFancy();
}
}
@@ -1,17 +0,0 @@
package com.gtnewhorizons.angelica.mixins.early.sodium;
import me.jellysquid.mods.sodium.client.SodiumClientMod;
import net.minecraftforge.client.GuiIngameForge;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(GuiIngameForge.class)
public class MixinGuiIngameForge {
@Redirect(method = "renderGameOverlay(FZII)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;isFancyGraphicsEnabled()Z"))
private boolean checkVignette(float idk) {
return SodiumClientMod.options().quality.enableVignette.isFancy();
}
}
@@ -25,11 +25,6 @@ public class MixinMinecraft {
}
}
@Redirect(method="runGameLoop", at=@At(value="FIELD", target="Lnet/minecraft/client/renderer/WorldRenderer;chunksUpdated:I", ordinal=0))
private int sodium$chunksUpdated() {
return ((IRenderGlobalExt)this.renderGlobal).getChunksSubmitted();
}
@Redirect(method = "runGameLoop", at = @At(value = "FIELD", target = "Lnet/minecraft/client/settings/GameSettings;fancyGraphics:Z"))
private boolean sodium$overrideFancyGrass(GameSettings gameSettings) {
return SodiumClientMod.options().quality.grassQuality.isFancy();
Loaded 100 of 226 files, more files were not shown because too many files have changed in this diff. Show more