mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-17 11:05:04 +00:00
Compare commits
84
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
108db9031b | ||
|
|
d6d8a5dad6 | ||
|
|
ad2b73edf9 | ||
|
|
bb5526598e | ||
|
|
611bbf02c8 | ||
|
|
ca16036604 | ||
|
|
f118211257 | ||
|
|
81d03ea552 | ||
|
|
67c8628aeb | ||
|
|
f9b9873637 | ||
|
|
c66bf8658e | ||
|
|
052824017d | ||
|
|
6a5d914a43 | ||
|
|
208373deaa | ||
|
|
f22a3f612b | ||
|
|
9ff1015d19 | ||
|
|
0023fe3da2 | ||
|
|
7e2399714c | ||
|
|
9029182353 | ||
|
|
e6039691b5 | ||
|
|
5db1edba33 | ||
|
|
d450461726 | ||
|
|
95f8afc0f3 | ||
|
|
19635e20ec | ||
|
|
ead4e11376 | ||
|
|
b0ceb5306a | ||
|
|
99a81369f0 | ||
|
|
e2ee822948 | ||
|
|
9fe7e800f6 | ||
|
|
debfcdfda0 | ||
|
|
df662188f4 | ||
|
|
842916405f | ||
|
|
09afe81290 | ||
|
|
292809d8e8 | ||
|
|
47503ce254 | ||
|
|
f738adbdef | ||
|
|
70d15f2383 | ||
|
|
d66b5577f4 | ||
|
|
e293f12fb8 | ||
|
|
b69eca6749 | ||
|
|
03342f08c6 | ||
|
|
b85614f983 | ||
|
|
5afb5d8f5a | ||
|
|
c353c83cf3 | ||
|
|
78072236d2 | ||
|
|
350fdcd7e4 | ||
|
|
3d98e57178 | ||
|
|
55c1786811 | ||
|
|
356d826387 | ||
|
|
c34d8548a5 | ||
|
|
81a000af75 | ||
|
|
711c23c722 | ||
|
|
5aa1d504b0 | ||
|
|
60ab3b7900 | ||
|
|
912e0e83b8 | ||
|
|
104eda0b51 | ||
|
|
7fb8cde66d | ||
|
|
0e4421f2ce | ||
|
|
3cf3d096fd | ||
|
|
ffa1193dd2 | ||
|
|
d180023469 | ||
|
|
762275a6da | ||
|
|
0e66bcf42f | ||
|
|
979ad344a1 | ||
|
|
5f328e9b57 | ||
|
|
2dba62bf20 | ||
|
|
0fd4d457e2 | ||
|
|
b56e803622 | ||
|
|
3ab965ded7 | ||
|
|
538b38898c | ||
|
|
e43cd6f18e | ||
|
|
38285087c9 | ||
|
|
deb6c2b6e5 | ||
|
|
e11985a913 | ||
|
|
4bbf39eb4d | ||
|
|
8c90f79c17 | ||
|
|
e4e657846d | ||
|
|
2dace708b4 | ||
|
|
1df1ec3530 | ||
|
|
d96ac28043 | ||
|
|
72c13cff67 | ||
|
|
f233ba65e3 | ||
|
|
c0d636d4f7 | ||
|
|
bd5cd350c3 |
No files matched your search
@@ -18,6 +18,14 @@ body:
|
||||
placeholder: "Example: 1.0.0-alpha1"
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: report
|
||||
attributes:
|
||||
label: Bug Report
|
||||
description: "Relevant information, as well as relevant logs attached such as `logs/fml-client-latest.log."
|
||||
placeholder: "Example: https://mclo.gs/ OR submit the file to github by dragging it to this textbox."
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
id: java
|
||||
attributes:
|
||||
@@ -52,11 +60,10 @@ body:
|
||||
id: shaders
|
||||
attributes:
|
||||
label: Shaders
|
||||
description: Do you have Iris/Shaders enabled?
|
||||
description: Do you have a shaderpack enabled?
|
||||
options:
|
||||
- "No: Go ahead and create an issue"
|
||||
- "Yes: I will not create an issue"
|
||||
- "Yes: I don't read and shouldn't be creating an issue"
|
||||
- "No"
|
||||
- "Yes: Please put relevant information about shaderpack in the report(what shaderpack, any special settings of note, etc)"
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
@@ -70,14 +77,6 @@ body:
|
||||
- "Yes: I don't read and shouldn't be creating an issue"
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: report
|
||||
attributes:
|
||||
label: Bug Report
|
||||
description: "Relevant information, as well as relevant logs attached such as `logs/fml-client-latest.log."
|
||||
placeholder: "Example: https://mclo.gs/ OR submit the file to github by dragging it to this textbox."
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: modlist
|
||||
attributes:
|
||||
@@ -98,6 +97,5 @@ body:
|
||||
required: true
|
||||
- label: "I am running an officially released version. (Or, if I've compiled it myself I plan to fix the issue)"
|
||||
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
|
||||
|
||||
|
||||
|
||||
@@ -29,5 +29,5 @@ body:
|
||||
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
|
||||
- label: "This issue is not related to a feature that is disabed by default - MCPF, etc. [They'll be enabled when they're ready for testing]"
|
||||
required: true
|
||||
@@ -5,21 +5,22 @@
|
||||
* 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
|
||||
* It's the angel that pulls you out of OptiFine's hell -Roadhog360
|
||||
|
||||
## **Beta Quality - Here there be Dragons**
|
||||
* Shaders sneak preview - Please don't report issues yet, but please do submit fixes
|
||||
## **Beta Quality - Here there be Dragons**
|
||||
* Shaders - Beta
|
||||
* Complementary & BSL mostly function, but have some bugs
|
||||
* Sildurs, Seus, and any other shader probably doesn't work
|
||||
|
||||
|
||||
# Required Dependencies
|
||||
* [UniMixins](https://github.com/LegacyModdingMC/UniMixins/releases) >= 0.1.14
|
||||
* [GTNHLib](https://github.com/GTNewHorizons/GTNHLib/releases) >= 0.4.2
|
||||
* [UniMixins](https://github.com/LegacyModdingMC/UniMixins/releases) >= 0.1.19
|
||||
* [GTNHLib](https://github.com/GTNewHorizons/GTNHLib/releases) >= 0.6.6
|
||||
* 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'
|
||||
* ProjectRed Frames - Currently non Thread Safe; safe if not in use
|
||||
|
||||
# Potential Incompatibilities
|
||||
* EndlessIDs - Compat commits have been made, might work, might not - not fully tested
|
||||
@@ -33,10 +34,11 @@
|
||||
* OptiFine [Disabled, won't fix]
|
||||
* FastCraft [Disabled, won't fix]
|
||||
* BetterFPS [Disabled, won't fix]
|
||||
* OptimizationsAndTweaks [Disabled, won't fix]
|
||||
* [Amazing Trophies 1.2.1 and below](https://github.com/GTNewHorizons/Amazing-Trophies/releases) - use 1.2.2+
|
||||
* [LWJGL3ify 1.5.4 and below](https://github.com/GTNewHorizons/lwjgl3ify/releases/) - Use the latest version available, 1.5.7+
|
||||
* [ArchaicFix 0.6.2 and below](https://www.curseforge.com/minecraft/mc-mods/archaicfix/files/all?page=1&pageSize=20) - Use 0.7.0 or above
|
||||
* [Hodgepodge 2.4.3 and below](https://github.com/GTNewHorizons/Hodgepodge/releases) - Use 2.4.4 or above
|
||||
* [Hodgepodge 2.4.3 and below](https://github.com/GTNewHorizons/Hodgepodge/releases) - Use 0.4.5 or above
|
||||
* CodeChicken[Core](https://github.com/GTNewHorizons/CodeChickenCore/releases)/[Lib](https://github.com/GTNewHorizons/CodeChickenLib/releases) <1.2.0 - Threading issues, use 1.3.0+
|
||||
* Neodymium - Untested, but unlikely to be compatible. (Chunk Meshing is definitely incompatible, other features might work depending on config)
|
||||
|
||||
@@ -66,7 +68,7 @@
|
||||
* HUDCaching
|
||||
* Created by [Moulberry](https://github.com/Moulberry/MCHUDCaching), backported from [Patcher](https://github.com/Sk1erLLC/Patcher) mod by Alexdoru under the CC-BY-SA-NC 4.0 license
|
||||
* Angelica
|
||||
* mitchej123, Omni, Makamys, Embeddedt, NanoLive, Caedis, Cardinalstar, Alexdoru, Eigenraven, mist475, Clepto for helping get Angelica up and running!
|
||||
* mitchej123, Omni, Makamys, Embeddedt, NanoLive, Caedis, Cardinalstar, Alexdoru, Eigenraven, mist475, Clepto, kurrycat for helping get Angelica up and running!
|
||||
* IMS, jss2a98aj, || dbp ||, roadhog360 for advice and moral support
|
||||
* Forge 1.12+
|
||||
* Some files have been taken from Minecraft Forge under the LGPL 2.1 license and are marked as such
|
||||
@@ -75,4 +77,8 @@
|
||||
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
|
||||
|
||||
* Embeddedt and Ferri_Arnus for [glsl-transformation-lib](https://github.com/TauMC/glsl-transformation-lib)
|
||||
* Also for work on [Monocle](https://github.com/ferriarnus/Monocle) which was used as a reference for implementing glsl-transformation-lib
|
||||
* Code from both glsl-transformation-lib and Monocle taken under their respective LGPL 3.0 licenses
|
||||
* FalseTweaks
|
||||
* FalsePattern for [FalseTweaks](https://github.com/falsepattern/falsetweaks) - Item Rendering Optimizations taken from FalseTweaks under the LGPL 3.0 license
|
||||
+19
-22
@@ -49,42 +49,42 @@ configurations {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.5.71")
|
||||
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.6.27")
|
||||
|
||||
compileOnly("com.gtnewhorizons.retrofuturabootstrap:RetroFuturaBootstrap:0.4.0") { transitive = false }
|
||||
compileOnly("com.gtnewhorizons.retrofuturabootstrap:RetroFuturaBootstrap:1.0.7") { transitive = false }
|
||||
|
||||
compileOnly("org.projectlombok:lombok:1.18.22") { transitive = false }
|
||||
annotationProcessor("org.projectlombok:lombok:1.18.22")
|
||||
compileOnly("org.projectlombok:lombok:1.18.34") { transitive = false }
|
||||
annotationProcessor("org.projectlombok:lombok:1.18.34")
|
||||
|
||||
// Use modern models+textures to inject QuadProviders
|
||||
devOnlyNonPublishable('com.github.GTNewHorizons:TX-Loader:1.7.1:dev')
|
||||
devOnlyNonPublishable('com.github.GTNewHorizons:TX-Loader:1.8.0:dev')
|
||||
|
||||
// Iris Shaders
|
||||
compileOnly('org.jetbrains:annotations:24.0.1')
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.5.12:dev")
|
||||
compileOnly('org.jetbrains:annotations:26.0.2')
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.6.11: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
|
||||
shadowImplementation("org.taumc:glsl-transformation-lib:0.2.0-4.g6b42bca") {
|
||||
exclude module: "antlr4" // we only want to shadow the runtime module
|
||||
}
|
||||
shadowImplementation("org.antlr:antlr4-runtime:4.13.2")
|
||||
compileOnly "org.apache.ant:ant:1.8.2"
|
||||
|
||||
// Because who doesn't want NEI
|
||||
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.6.39-GTNH:dev')
|
||||
devOnlyNonPublishable('com.github.GTNewHorizons:CodeChickenCore:1.3.7:dev')
|
||||
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.7.29-GTNH:dev')
|
||||
devOnlyNonPublishable('com.github.GTNewHorizons:CodeChickenCore:1.4.1:dev')
|
||||
|
||||
// Notfine Deps
|
||||
compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev")
|
||||
devOnlyNonPublishable("com.github.GTNewHorizons:Baubles:1.0.4:dev")
|
||||
compileOnly("com.github.GTNewHorizons:twilightforest:2.6.34:dev") { transitive = false }
|
||||
compileOnly("com.github.GTNewHorizons:twilightforest:2.7.5:dev") { transitive = false }
|
||||
compileOnly(rfg.deobf('curse.maven:witchery-69673:2234410'))
|
||||
compileOnly("com.github.GTNewHorizons:TinkersConstruct:1.12.10-GTNH:dev") { transitive = false }
|
||||
compileOnly("com.github.GTNewHorizons:Natura:2.7.3:dev")
|
||||
compileOnly("com.github.GTNewHorizons:TinkersConstruct:1.13.9-GTNH:dev") { transitive = false }
|
||||
compileOnly("com.github.GTNewHorizons:Natura:2.8.2:dev")
|
||||
|
||||
compileOnly("com.github.GTNewHorizons:ThaumicHorizons:1.6.3:dev")
|
||||
compileOnly("com.github.GTNewHorizons:ThaumicHorizons:1.7.1:dev")
|
||||
|
||||
compileOnly("com.github.GTNewHorizons:Battlegear2:1.4.1:dev") { transitive = false }
|
||||
compileOnly(rfg.deobf('maven.modrinth:backhand:1.4.1')) { transitive = false }
|
||||
compileOnly("com.github.GTNewHorizons:Battlegear2:1.4.2:dev") { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:Backhand:1.6.11') { 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 }
|
||||
@@ -98,11 +98,9 @@ dependencies {
|
||||
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.12-GTNH:dev")
|
||||
compileOnly("com.github.GTNewHorizons:HoloInventory:2.5.0-GTNH:dev")
|
||||
|
||||
runtimeOnlyNonPublishable(rfg.deobf("CoreTweaks:CoreTweaks:0.3.3.2"))
|
||||
|
||||
@@ -112,9 +110,8 @@ dependencies {
|
||||
// Better Crashes
|
||||
compileOnly("com.github.GTNewHorizons:BetterCrashes:1.4.0-GTNH:dev")
|
||||
|
||||
|
||||
// Tests
|
||||
testImplementation(platform('org.junit:junit-bom:5.9.2'))
|
||||
testImplementation(platform('org.junit:junit-bom:5.11.4'))
|
||||
testImplementation('org.junit.jupiter:junit-jupiter')
|
||||
testImplementation("org.mockito:mockito-core:3.+")
|
||||
testImplementation("org.lwjgl.lwjgl:lwjgl:2.9.4-nightly-20150209")
|
||||
|
||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
@@ -55,7 +57,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@@ -84,7 +86,7 @@ done
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
Vendored
+2
@@ -13,6 +13,8 @@
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
|
||||
@@ -25,5 +25,12 @@ repositories {
|
||||
includeGroup('CoreTweaks')
|
||||
}
|
||||
}
|
||||
maven {
|
||||
name = 'taumc'
|
||||
url = 'https://maven.taumc.org/releases'
|
||||
content {
|
||||
includeGroup 'org.taumc'
|
||||
}
|
||||
}
|
||||
mavenLocal()
|
||||
}
|
||||
+1
-1
@@ -16,5 +16,5 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.27'
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.36'
|
||||
}
|
||||
@@ -16,7 +16,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.4.2,);",
|
||||
+ " after:archaicfix@[0.7.0,);" + " required-after:gtnhlib@[0.6.6,);",
|
||||
acceptedMinecraftVersions = "[1.7.10]",
|
||||
acceptableRemoteVersions = "*",
|
||||
guiFactory = "com.gtnewhorizons.angelica.config.AngelicaGuiConfigFactory")
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.gtnewhorizons.angelica.api;
|
||||
|
||||
import com.gtnewhorizons.angelica.mixins.interfaces.IPatchedTextureAtlasSprite;
|
||||
import com.gtnewhorizons.angelica.mixins.interfaces.ITexturesCache;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
/**
|
||||
* Exposes a method to the API that allow mods to add texture update compat
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public class TextureServices {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public static void updateBlockTextureAnimation(IIcon icon, RenderBlocks renderBlocks) {
|
||||
if (renderBlocks instanceof ITexturesCache texturesCache) {
|
||||
texturesCache.getRenderedTextures().add(icon);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public static void updateTextureAnimation(IIcon icon) {
|
||||
if(icon instanceof IPatchedTextureAtlasSprite patchedSprite) {
|
||||
patchedSprite.markNeedsAnimationUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.gtnewhorizons.angelica.client.font;
|
||||
|
||||
import com.gtnewhorizons.angelica.compat.lwjgl.CompatMemoryUtil;
|
||||
import static com.gtnewhorizon.gtnhlib.bytebuf.MemoryUtilities.*;
|
||||
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import com.gtnewhorizons.angelica.mixins.interfaces.FontRendererAccessor;
|
||||
import it.unimi.dsi.fastutil.chars.Char2ShortOpenHashMap;
|
||||
@@ -10,7 +11,6 @@ import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
@@ -42,8 +42,6 @@ public class BatchingFontRenderer {
|
||||
private int[] colorCode;
|
||||
/** Location of the primary font atlas to bind. */
|
||||
protected final ResourceLocation locationFontTexture;
|
||||
/** The RenderEngine used to load and setup glyph textures. */
|
||||
private final TextureManager renderEngine;
|
||||
private final RandomXoshiro256StarStar fontRandom = new RandomXoshiro256StarStar();
|
||||
|
||||
/** The full list of characters present in the default Minecraft font, excluding the Unicode font */
|
||||
@@ -74,14 +72,13 @@ public class BatchingFontRenderer {
|
||||
}
|
||||
|
||||
public BatchingFontRenderer(FontRenderer underlying, ResourceLocation[] unicodePageLocations, int[] charWidth,
|
||||
byte[] glyphWidth, int[] colorCode, ResourceLocation locationFontTexture, TextureManager renderEngine) {
|
||||
byte[] glyphWidth, int[] colorCode, ResourceLocation locationFontTexture) {
|
||||
this.underlying = underlying;
|
||||
this.unicodePageLocations = unicodePageLocations;
|
||||
this.charWidth = charWidth;
|
||||
this.glyphWidth = glyphWidth;
|
||||
this.colorCode = colorCode;
|
||||
this.locationFontTexture = locationFontTexture;
|
||||
this.renderEngine = renderEngine;
|
||||
|
||||
for (int i = 0; i < 64; i++) {
|
||||
batchCommandPool.add(new FontDrawCmd());
|
||||
@@ -97,10 +94,10 @@ public class BatchingFontRenderer {
|
||||
private static final int INITIAL_BATCH_SIZE = 256;
|
||||
private static final ResourceLocation DUMMY_RESOURCE_LOCATION = new ResourceLocation("angelica$dummy",
|
||||
"this is invalid!");
|
||||
private FloatBuffer batchVtxPositions = BufferUtils.createFloatBuffer(INITIAL_BATCH_SIZE * 2);
|
||||
private ByteBuffer batchVtxColors = BufferUtils.createByteBuffer(INITIAL_BATCH_SIZE * 4);
|
||||
private FloatBuffer batchVtxTexCoords = BufferUtils.createFloatBuffer(INITIAL_BATCH_SIZE * 2);
|
||||
private IntBuffer batchIndices = BufferUtils.createIntBuffer(INITIAL_BATCH_SIZE / 2 * 3);
|
||||
private FloatBuffer batchVtxPositions = memAllocFloat(INITIAL_BATCH_SIZE * 2);
|
||||
private ByteBuffer batchVtxColors = memAlloc(INITIAL_BATCH_SIZE * 4);
|
||||
private FloatBuffer batchVtxTexCoords = memAllocFloat(INITIAL_BATCH_SIZE * 2);
|
||||
private IntBuffer batchIndices = memAllocInt(INITIAL_BATCH_SIZE / 2 * 3);
|
||||
private final ObjectArrayList<FontDrawCmd> batchCommands = ObjectArrayList.wrap(new FontDrawCmd[64], 0);
|
||||
private final ObjectArrayList<FontDrawCmd> batchCommandPool = ObjectArrayList.wrap(new FontDrawCmd[64], 0);
|
||||
|
||||
@@ -109,12 +106,12 @@ public class BatchingFontRenderer {
|
||||
final int oldCap = batchVtxPositions.capacity() / 2;
|
||||
if (vtxWriterIndex >= oldCap) {
|
||||
final int newCap = oldCap * 2;
|
||||
batchVtxPositions = CompatMemoryUtil.memReallocDirect(batchVtxPositions, newCap * 2);
|
||||
batchVtxColors = CompatMemoryUtil.memReallocDirect(batchVtxColors, newCap * 4);
|
||||
batchVtxTexCoords = CompatMemoryUtil.memReallocDirect(batchVtxTexCoords, newCap * 2);
|
||||
batchVtxPositions = memRealloc(batchVtxPositions, newCap * 2);
|
||||
batchVtxColors = memRealloc(batchVtxColors, newCap * 4);
|
||||
batchVtxTexCoords = memRealloc(batchVtxTexCoords, newCap * 2);
|
||||
final int oldIdxCap = batchIndices.capacity();
|
||||
final int newIdxCap = oldIdxCap * 2;
|
||||
batchIndices = CompatMemoryUtil.memReallocDirect(batchIndices, newIdxCap);
|
||||
batchIndices = memRealloc(batchIndices, newIdxCap);
|
||||
}
|
||||
final int idx = vtxWriterIndex;
|
||||
final int idx2 = idx * 2;
|
||||
@@ -437,8 +434,6 @@ public class BatchingFontRenderer {
|
||||
chr = MCFONT_CHARS.charAt(lutIndex);
|
||||
}
|
||||
|
||||
final float shadowOffset = unicodeFlag ? 0.5F : 1.0F;
|
||||
|
||||
// Check ASCII space, NBSP, NNBSP
|
||||
if (chr == ' ' || chr == '\u00A0' || chr == '\u202F') {
|
||||
curX += 4;
|
||||
@@ -452,6 +447,7 @@ public class BatchingFontRenderer {
|
||||
final float uSz;
|
||||
final float vSz;
|
||||
final float itOff = curItalic ? 1.0F : 0.0F; // italic offset
|
||||
final float shadowOffset;
|
||||
final ResourceLocation texture;
|
||||
|
||||
if (lutIndex == -1 || unicodeFlag) {
|
||||
@@ -459,6 +455,7 @@ public class BatchingFontRenderer {
|
||||
continue;
|
||||
}
|
||||
// Draw unicode char
|
||||
shadowOffset = 0.5F;
|
||||
final int uniPage = chr / 256;
|
||||
texture = getUnicodePageLocation(uniPage);
|
||||
final int startColumn = this.glyphWidth[chr] >>> 4;
|
||||
@@ -475,6 +472,7 @@ public class BatchingFontRenderer {
|
||||
|
||||
} else {
|
||||
// Draw "ASCII" char
|
||||
shadowOffset = 1.0F;
|
||||
uStart = ((lutIndex % 16) * 8) / 128.0F;
|
||||
vStart = (float) ((lutIndex / 16) * 8) / 128.0F;
|
||||
xAdvance = this.charWidth[lutIndex];
|
||||
|
||||
@@ -2,17 +2,17 @@ package com.gtnewhorizons.angelica.common;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
/**
|
||||
* This Block is not actually getting registered. A static instance is created in AngelicaMod.
|
||||
* In order to register the texture for it, there is a mixin to TextureMap which injects a call
|
||||
* to this instance's registerBlocKIcons method. Actually registering the block on the client but
|
||||
* not the server can cause block IDs to different between client/server, which is not good.
|
||||
* Actually registering the block on the client but not the server can cause block IDs to
|
||||
* different between client/server, which is not good.
|
||||
|
||||
* We're essentially injecting the block's texture, so that we may use this block as if it were
|
||||
* any normal block for rendering purposes with RenderBlocks and such, but not have to actually
|
||||
@@ -25,21 +25,24 @@ public class BlockError extends Block {
|
||||
|
||||
public BlockError() {
|
||||
super(Material.rock);
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister reg)
|
||||
{
|
||||
for (int i = 0; i < icons.length; i++) {
|
||||
icons[i] = reg.registerIcon("angelica:error_block_" + i);
|
||||
public void onTextureStitch(TextureStitchEvent.Pre event) {
|
||||
if (event.map.getTextureType() == 0) {
|
||||
for (int i = 0; i < icons.length; i++) {
|
||||
icons[i] = event.map.registerIcon("angelica:error_block_" + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return icons[meta];
|
||||
return meta >= 0 && meta < icons.length ? icons[meta] : null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
package com.gtnewhorizons.angelica.compat;
|
||||
|
||||
import com.falsepattern.chunk.api.DataRegistry;
|
||||
import com.gtnewhorizons.angelica.mixins.interfaces.ExtendedBlockStorageAccessor;
|
||||
import com.gtnewhorizons.angelica.mixins.interfaces.ExtendedNibbleArray;
|
||||
import com.gtnewhorizons.neid.mixins.interfaces.IExtendedBlockStorageMixin;
|
||||
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
@@ -19,7 +17,7 @@ public class ExtendedBlockStorageExt extends ExtendedBlockStorage {
|
||||
}
|
||||
|
||||
public ExtendedBlockStorageExt(Chunk chunk, ExtendedBlockStorage storage) {
|
||||
super(((ExtendedBlockStorageAccessor) storage).getYBase(), storage.getSkylightArray() != null);
|
||||
super(storage.yBase, storage.getSkylightArray() != null);
|
||||
|
||||
if (ModStatus.isChunkAPILoaded) {
|
||||
if (storage.getSkylightArray() != null) {
|
||||
@@ -33,7 +31,7 @@ public class ExtendedBlockStorageExt extends ExtendedBlockStorage {
|
||||
System.arraycopy(((IExtendedBlockStorageMixin)(Object)storage).getBlock16BArray(), 0, block16BArray, 0, block16BArray.length);
|
||||
if(storage.getBlockMSBArray() != null) {
|
||||
this.setBlockMSBArray(new NibbleArray(block16BArray.length, 4));
|
||||
copyNibbleArray((ExtendedNibbleArray) storage.getBlockMSBArray(), (ExtendedNibbleArray) this.getBlockMSBArray());
|
||||
copyNibbleArray(storage.getBlockMSBArray(), this.getBlockMSBArray());
|
||||
}
|
||||
arrayLen = block16BArray.length;
|
||||
if (ModStatus.isNEIDMetadataExtended) {
|
||||
@@ -52,31 +50,31 @@ public class ExtendedBlockStorageExt extends ExtendedBlockStorage {
|
||||
System.arraycopy(storage.getBlockLSBArray(), 0, blockLSBArray, 0, blockLSBArray.length);
|
||||
if(storage.getBlockMSBArray() != null) {
|
||||
this.setBlockMSBArray(new NibbleArray(blockLSBArray.length, 4));
|
||||
copyNibbleArray((ExtendedNibbleArray) storage.getBlockMSBArray(), (ExtendedNibbleArray) this.getBlockMSBArray());
|
||||
copyNibbleArray(storage.getBlockMSBArray(), this.getBlockMSBArray());
|
||||
}
|
||||
arrayLen = blockLSBArray.length;
|
||||
}
|
||||
|
||||
|
||||
if (!ModStatus.isNEIDMetadataExtended) copyNibbleArray((ExtendedNibbleArray) storage.getMetadataArray(), (ExtendedNibbleArray)this.getMetadataArray());
|
||||
copyNibbleArray((ExtendedNibbleArray) storage.getBlocklightArray(), (ExtendedNibbleArray)this.getBlocklightArray());
|
||||
if (!ModStatus.isNEIDMetadataExtended) copyNibbleArray(storage.getMetadataArray(), this.getMetadataArray());
|
||||
copyNibbleArray(storage.getBlocklightArray(), this.getBlocklightArray());
|
||||
if(storage.getSkylightArray() != null) {
|
||||
hasSky = true;
|
||||
if(this.getSkylightArray() == null) {
|
||||
this.setSkylightArray(new NibbleArray(arrayLen, 4));
|
||||
}
|
||||
copyNibbleArray((ExtendedNibbleArray) storage.getSkylightArray(), (ExtendedNibbleArray) this.getSkylightArray());
|
||||
copyNibbleArray(storage.getSkylightArray(), this.getSkylightArray());
|
||||
}
|
||||
}
|
||||
((ExtendedBlockStorageAccessor) this).setBlockRefCount(((ExtendedBlockStorageAccessor) storage).getBlockRefCount());
|
||||
this.blockRefCount = storage.blockRefCount;
|
||||
}
|
||||
|
||||
|
||||
private static void copyNibbleArray(ExtendedNibbleArray srcArray, ExtendedNibbleArray dstArray) {
|
||||
private static void copyNibbleArray(NibbleArray srcArray, NibbleArray dstArray) {
|
||||
if (srcArray == null || dstArray == null) {
|
||||
throw new RuntimeException("NibbleArray is null src: " + (srcArray == null) + " dst: " + (dstArray == null));
|
||||
}
|
||||
final byte[] data = srcArray.getData();
|
||||
System.arraycopy(data, 0, dstArray.getData(), 0, data.length);
|
||||
final byte[] data = srcArray.data;
|
||||
System.arraycopy(data, 0, dstArray.data, 0, data.length);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@ 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 mods.battlegear2.Battlegear;
|
||||
import net.dries007.holoInventory.HoloInventory;
|
||||
@@ -62,7 +61,7 @@ public class ModStatus {
|
||||
}
|
||||
|
||||
if (isBackhandLoaded){
|
||||
isBackhandLoaded = new DefaultArtifactVersion("1.4.1")
|
||||
isBackhandLoaded = new DefaultArtifactVersion("1.6.9")
|
||||
.compareTo(
|
||||
LoadControllerHelper.getOwningMod(Backhand.class).getProcessedVersion()
|
||||
) <= 0;
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
package com.gtnewhorizons.angelica.compat.lwjgl;
|
||||
|
||||
import org.lwjgl.BufferUtils;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
public class CompatMemoryUtil {
|
||||
public static ByteBuffer memReallocDirect(ByteBuffer old, int capacity) {
|
||||
ByteBuffer newBuf = BufferUtils.createByteBuffer(capacity);
|
||||
int oldPos = old.position();
|
||||
old.rewind();
|
||||
newBuf.put(old);
|
||||
newBuf.position(Math.min(capacity, oldPos));
|
||||
return newBuf;
|
||||
}
|
||||
|
||||
public static IntBuffer memReallocDirect(IntBuffer old, int capacity) {
|
||||
IntBuffer newBuf = BufferUtils.createIntBuffer(capacity);
|
||||
int oldPos = old.position();
|
||||
old.rewind();
|
||||
newBuf.put(old);
|
||||
newBuf.position(Math.min(capacity, oldPos));
|
||||
return newBuf;
|
||||
}
|
||||
|
||||
public static FloatBuffer memReallocDirect(FloatBuffer old, int capacity) {
|
||||
FloatBuffer newBuf = BufferUtils.createFloatBuffer(capacity);
|
||||
int oldPos = old.position();
|
||||
old.rewind();
|
||||
newBuf.put(old);
|
||||
newBuf.position(Math.min(capacity, oldPos));
|
||||
return newBuf;
|
||||
}
|
||||
|
||||
/**
|
||||
* Backported from LWJGL3 under the BSD 3-Clause "New" or "Revised" License license
|
||||
*
|
||||
* <p>This class provides functionality for managing native memory.
|
||||
*
|
||||
* <p>All methods in this class will make use of {@link sun.misc.Unsafe} if it's available, for performance. If Unsafe is not available, the fallback
|
||||
* implementations make use of reflection and, in the worst-case, JNI.</p>
|
||||
*
|
||||
* <p>Method names in this class are prefixed with {@code mem} to avoid ambiguities when used with static imports.</p>
|
||||
*/
|
||||
|
||||
static final sun.misc.Unsafe UNSAFE;
|
||||
|
||||
static {
|
||||
UNSAFE = getUnsafeInstance();
|
||||
}
|
||||
|
||||
private static sun.misc.Unsafe getUnsafeInstance() {
|
||||
java.lang.reflect.Field[] fields = sun.misc.Unsafe.class.getDeclaredFields();
|
||||
|
||||
/*
|
||||
Different runtimes use different names for the Unsafe singleton,
|
||||
so we cannot use .getDeclaredField and we scan instead. For example:
|
||||
|
||||
Oracle: theUnsafe
|
||||
PERC : m_unsafe_instance
|
||||
Android: THE_ONE
|
||||
*/
|
||||
for (java.lang.reflect.Field field : fields) {
|
||||
if (!field.getType().equals(sun.misc.Unsafe.class)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int modifiers = field.getModifiers();
|
||||
if (!(java.lang.reflect.Modifier.isStatic(modifiers) && java.lang.reflect.Modifier.isFinal(modifiers))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
field.setAccessible(true);
|
||||
return (sun.misc.Unsafe)field.get(null);
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
throw new UnsupportedOperationException("LWJGL requires sun.misc.Unsafe to be available.");
|
||||
}
|
||||
|
||||
|
||||
public static void memPutByte(long ptr, byte value) { UNSAFE.putByte(null, ptr, value); }
|
||||
public static void memPutShort(long ptr, short value) { UNSAFE.putShort(null, ptr, value); }
|
||||
public static void memPutInt(long ptr, int value) { UNSAFE.putInt(null, ptr, value); }
|
||||
public static void memPutLong(long ptr, long value) { UNSAFE.putLong(null, ptr, value); }
|
||||
public static void memPutFloat(long ptr, float value) { UNSAFE.putFloat(null, ptr, value); }
|
||||
public static void memPutDouble(long ptr, double value) { UNSAFE.putDouble(null, ptr, value); }
|
||||
|
||||
public static boolean memGetBoolean(long ptr) { return UNSAFE.getByte(null, ptr) != 0; }
|
||||
public static byte memGetByte(long ptr) { return UNSAFE.getByte(null, ptr); }
|
||||
public static short memGetShort(long ptr) { return UNSAFE.getShort(null, ptr); }
|
||||
public static int memGetInt(long ptr) { return UNSAFE.getInt(null, ptr); }
|
||||
public static long memGetLong(long ptr) { return UNSAFE.getLong(null, ptr); }
|
||||
public static float memGetFloat(long ptr) { return UNSAFE.getFloat(null, ptr); }
|
||||
public static double memGetDouble(long ptr) { return UNSAFE.getDouble(null, ptr); }
|
||||
|
||||
}
|
||||
+1
@@ -15,6 +15,7 @@ public class ByteBufferBackedInputStream extends InputStream {
|
||||
this.buf = buf;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
if (!buf.hasRemaining()) {
|
||||
return -1;
|
||||
|
||||
@@ -40,6 +40,7 @@ public class ChunkPos {
|
||||
return (long)x & 4294967295L | ((long)z & 4294967295L) << 32;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
final int i = 1664525 * this.x + 1013904223;
|
||||
@@ -47,6 +48,7 @@ public class ChunkPos {
|
||||
return i ^ j;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if (this == object) {
|
||||
return true;
|
||||
|
||||
@@ -1,10 +1,24 @@
|
||||
package com.gtnewhorizons.angelica.compat.mojang;
|
||||
|
||||
|
||||
import com.gtnewhorizons.angelica.compat.ModStatus;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import xonin.backhand.api.core.BackhandUtils;
|
||||
|
||||
public enum InteractionHand {
|
||||
MAIN_HAND,
|
||||
OFF_HAND;
|
||||
|
||||
InteractionHand() {
|
||||
}
|
||||
|
||||
public ItemStack getItemInHand(EntityPlayer player){
|
||||
if (ModStatus.isBackhandLoaded && this == InteractionHand.OFF_HAND){ // off hand (requires backhand)
|
||||
return BackhandUtils.getOffhandItem(player);
|
||||
}
|
||||
else { // main hand
|
||||
return player.getHeldItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,18 @@
|
||||
package com.gtnewhorizons.angelica.compat.mojang;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.coderbot.iris.Iris;
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import com.gtnewhorizon.gtnhlib.bytebuf.MemoryUtilities;
|
||||
import lombok.Getter;
|
||||
import net.coderbot.iris.Iris;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
// TBD
|
||||
public class NativeImage extends BufferedImage {
|
||||
@@ -59,13 +59,20 @@ public class NativeImage extends BufferedImage {
|
||||
|
||||
// final int width = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, level, GL11.GL_TEXTURE_WIDTH);
|
||||
// final int height = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, level, GL11.GL_TEXTURE_HEIGHT);
|
||||
IntBuffer buffer = BufferUtils.createIntBuffer(size);
|
||||
int[] data = new int[size];
|
||||
|
||||
GL11.glGetTexImage(GL11.GL_TEXTURE_2D, level, format.glFormat, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, buffer);
|
||||
buffer.get(data);
|
||||
setRGB(0, 0, width, height, data, 0, width);
|
||||
final IntBuffer buffer = MemoryUtilities.memAllocInt(size);
|
||||
|
||||
try {
|
||||
GL11.glGetTexImage(GL11.GL_TEXTURE_2D, level, format.glFormat, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, buffer);
|
||||
|
||||
int[] data = new int[size];
|
||||
buffer.get(data);
|
||||
setRGB(0, 0, width, height, data, 0, width);
|
||||
} finally {
|
||||
MemoryUtilities.memFree(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
public void writeToFile(File file) throws IOException{
|
||||
try {
|
||||
ImageIO.write(this, "png", file);
|
||||
@@ -103,18 +110,15 @@ public class NativeImage extends BufferedImage {
|
||||
|
||||
|
||||
public enum Format {
|
||||
RGBA(4, GL11.GL_RGBA, BufferedImage.TYPE_INT_ARGB),
|
||||
RGB(3, GL11.GL_RGB, BufferedImage.TYPE_INT_RGB);
|
||||
RGBA(4, GL11.GL_RGBA),
|
||||
RGB(3, GL11.GL_RGB);
|
||||
|
||||
private final int components;
|
||||
private final int glFormat;
|
||||
private final int imageType;
|
||||
|
||||
|
||||
Format(int components, int glFormat, int imageType) {
|
||||
Format(int components, int glFormat) {
|
||||
this.components = components;
|
||||
this.glFormat = glFormat;
|
||||
this.imageType = imageType;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,6 @@ public abstract class RenderLayer extends RenderPhase { // Aka: RenderType (Iris
|
||||
private final MultiPhaseParameters phases;
|
||||
private final int hash;
|
||||
private final Optional<RenderLayer> affectedOutline;
|
||||
private final boolean outline;
|
||||
|
||||
private MultiPhase(String name, VertexFormat vertexFormat, int drawMode, int expectedBufferSize, boolean hasCrumbling, boolean translucent, MultiPhaseParameters phases) {
|
||||
super(name, vertexFormat, drawMode, expectedBufferSize, () -> {
|
||||
@@ -84,7 +83,6 @@ public abstract class RenderLayer extends RenderPhase { // Aka: RenderType (Iris
|
||||
this.affectedOutline = phases.outlineMode == RenderLayer.OutlineMode.AFFECTS_OUTLINE ? phases.texture.getId().map((arg2) -> {
|
||||
return getOutline(arg2, phases.cull);
|
||||
}) : Optional.empty();
|
||||
this.outline = phases.outlineMode == RenderLayer.OutlineMode.IS_OUTLINE;
|
||||
this.hash = Objects.hash(new Object[]{super.hashCode(), phases});
|
||||
}
|
||||
|
||||
@@ -97,20 +95,23 @@ public abstract class RenderLayer extends RenderPhase { // Aka: RenderType (Iris
|
||||
return this.affectedOutline;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object object) {
|
||||
return this == object;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RenderType[" + this.phases + ']';
|
||||
}
|
||||
|
||||
static {
|
||||
CACHE = new ObjectOpenCustomHashSet(RenderLayer.MultiPhase.HashStrategy.INSTANCE);
|
||||
CACHE = new ObjectOpenCustomHashSet<>(RenderLayer.MultiPhase.HashStrategy.INSTANCE);
|
||||
}
|
||||
|
||||
static enum HashStrategy implements Hash.Strategy<MultiPhase> {
|
||||
@@ -168,6 +169,7 @@ public abstract class RenderLayer extends RenderPhase { // Aka: RenderType (Iris
|
||||
this.phases = ImmutableList.of(this.texture, this.transparency, this.diffuseLighting, this.shadeModel, this.alpha, this.depthTest, this.cull, this.lightmap, this.fog, this.layering, this.target, this.texturing, this.writeMaskState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if (this == object) {
|
||||
return true;
|
||||
@@ -179,10 +181,12 @@ public abstract class RenderLayer extends RenderPhase { // Aka: RenderType (Iris
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(new Object[]{this.phases, this.outlineMode});
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CompositeState[" + this.phases + ", outlineProperty=" + this.outlineMode + ']';
|
||||
}
|
||||
@@ -293,6 +297,7 @@ public abstract class RenderLayer extends RenderPhase { // Aka: RenderType (Iris
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import org.lwjgl.opengl.GL11;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.OptionalDouble;
|
||||
|
||||
|
||||
public abstract class RenderPhase {
|
||||
@@ -98,6 +97,7 @@ public abstract class RenderPhase {
|
||||
this.endAction.run();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object object) {
|
||||
if (this == object) {
|
||||
return true;
|
||||
@@ -109,10 +109,12 @@ public abstract class RenderPhase {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.name.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public class AngelicaConfig {
|
||||
public static boolean enableTestBlocks;
|
||||
|
||||
@Config.Comment("Enable Iris Shaders [Requires Sodium]")
|
||||
@Config.DefaultBoolean(false)
|
||||
@Config.DefaultBoolean(true)
|
||||
@Config.RequiresMcRestart
|
||||
public static boolean enableIris;
|
||||
|
||||
@@ -107,21 +107,6 @@ public class AngelicaConfig {
|
||||
@Config.RequiresMcRestart
|
||||
public static boolean optimizeTextureLoading;
|
||||
|
||||
@Config.Comment("Fix thread-safety in lotrs rendering")
|
||||
@Config.DefaultBoolean(true)
|
||||
@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
|
||||
@@ -138,8 +123,47 @@ public class AngelicaConfig {
|
||||
@Config.RangeInt(min = 32, max = 2048)
|
||||
public static int droppedItemLimit;
|
||||
|
||||
@Config.Comment("Use total world time instead of normal world time. Allows most shader animations to play when "
|
||||
+ "doDaylightCycle is off, but causes shader animations to desync from time of day.")
|
||||
@Config.DefaultBoolean(false)
|
||||
public static boolean useTotalWorldTime;
|
||||
|
||||
@Config.Comment("Enable Debug Logging")
|
||||
@Config.DefaultBoolean(false)
|
||||
@Config.RequiresMcRestart
|
||||
public static boolean enableDebugLogging;
|
||||
|
||||
@Config.Comment("Enables PBR atlas dumping")
|
||||
@Config.DefaultBoolean(false)
|
||||
@Config.Name("Enable PBR Debug")
|
||||
public static boolean enablePBRDebug;
|
||||
|
||||
@Config.Comment("Enable Zoom")
|
||||
@Config.DefaultBoolean(true)
|
||||
@Config.RequiresMcRestart
|
||||
public static boolean enableZoom;
|
||||
|
||||
@Config.Comment("Optimizes in-world item rendering [Experimental]")
|
||||
@Config.DefaultBoolean(false)
|
||||
@Config.RequiresMcRestart
|
||||
public static boolean optimizeInWorldItemRendering_WIP;
|
||||
|
||||
@Config.Comment("Max amount of display lists to cache for optimized item rendering. Higher number will use more VRAM")
|
||||
@Config.DefaultInt(256)
|
||||
@Config.RangeInt(min = 64, max = 1024)
|
||||
public static int itemRendererDisplayListCacheSize;
|
||||
|
||||
@Config.Comment("Render distance for the spinning mob inside mod spawners")
|
||||
@Config.DefaultDouble(16D)
|
||||
@Config.RangeDouble(min = 16D, max = 64D)
|
||||
public static double mobSpawnerRenderDistance;
|
||||
|
||||
@Config.Comment("Switches to an alternate FPS limiter that gives more stable frametimes, in exchange for slightly " +
|
||||
"more latency. Will never introduce more than one frame of latency, and has a lower impact at higher framerates.")
|
||||
@Config.DefaultBoolean(false)
|
||||
public static boolean sleepBeforeSwap;
|
||||
|
||||
@Config.Comment("Allows unicode languages to use an odd gui scale")
|
||||
@Config.DefaultBoolean(true)
|
||||
public static boolean removeUnicodeEvenScaling;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.gtnewhorizons.angelica.config;
|
||||
|
||||
import com.gtnewhorizon.gtnhlib.config.Config;
|
||||
|
||||
@Config(modid = "angelica", filename = "angelica-compat")
|
||||
public class CompatConfig {
|
||||
|
||||
@Config.Comment("Apply fixes to the LOTR mod")
|
||||
@Config.DefaultBoolean(true)
|
||||
@Config.RequiresMcRestart
|
||||
public static boolean fixLotr;
|
||||
|
||||
@Config.Comment("Apply fixes to Extra Utilities")
|
||||
@Config.DefaultBoolean(true)
|
||||
@Config.RequiresMcRestart
|
||||
public static boolean fixExtraUtils;
|
||||
|
||||
@Config.Comment("Apply fixes to Stacks on Stacks")
|
||||
@Config.DefaultBoolean(true)
|
||||
@Config.RequiresMcRestart
|
||||
public static boolean fixStacksOnStacks;
|
||||
|
||||
@Config.Comment("Apply fixes to Minefactory Reloaded")
|
||||
@Config.DefaultBoolean(true)
|
||||
@Config.RequiresMcRestart
|
||||
public static boolean fixMinefactoryReloaded;
|
||||
|
||||
@Config.Comment("Apply fixes to Thaumcraft")
|
||||
@Config.DefaultBoolean(true)
|
||||
@Config.RequiresMcRestart
|
||||
public static boolean fixThaumcraft;
|
||||
|
||||
@Config.Comment("Apply fixes to ThaumicHorizons")
|
||||
@Config.DefaultBoolean(true)
|
||||
@Config.RequiresMcRestart
|
||||
public static boolean fixThaumicHorizons;
|
||||
|
||||
@Config.Comment("Apply fixes to Immersive Engineering")
|
||||
@Config.DefaultBoolean(true)
|
||||
@Config.RequiresMcRestart
|
||||
public static boolean fixImmersiveEngineering;
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.gtnewhorizons.angelica.debug;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class F3Direction {
|
||||
public static void renderWorldDirectionsEvent(Minecraft mc, RenderGameOverlayEvent.Pre event) {
|
||||
if (mc.gameSettings.showDebugInfo && mc.gameSettings.thirdPersonView == 0) {
|
||||
ScaledResolution scaledresolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
|
||||
int width = scaledresolution.getScaledWidth();
|
||||
int height = scaledresolution.getScaledHeight();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glTranslatef((float) (width / 2), (float) (height / 2), -90);
|
||||
|
||||
Entity entity = mc.renderViewEntity;
|
||||
GL11.glRotatef(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * event.partialTicks, -1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * event.partialTicks, 0.0F, 1.0F, 0.0F);
|
||||
|
||||
GL11.glScalef(-1.0F, -1.0F, -1.0F);
|
||||
|
||||
renderWorldDirections();
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
public static void renderWorldDirections() {
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDepthMask(false);
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
GL11.glLineWidth(2.0F);
|
||||
tessellator.startDrawing(GL11.GL_LINES);
|
||||
|
||||
//X
|
||||
tessellator.setColorRGBA_F(255, 0, 0, 1);
|
||||
tessellator.addVertex(0.0D, 0.0D, 0.0D);
|
||||
tessellator.addVertex(10, 0.0D, 0.0D);
|
||||
|
||||
//Z
|
||||
tessellator.setColorRGBA_F(0, 0, 255, 1);
|
||||
tessellator.addVertex(0.0D, 0.0D, 0.0D);
|
||||
tessellator.addVertex(0.0D, 0.0D, 10);
|
||||
|
||||
//Y
|
||||
tessellator.setColorRGBA_F(0, 255, 0, 1);
|
||||
tessellator.addVertex(0.0D, 0.0D, 0.0D);
|
||||
tessellator.addVertex(0.0D, 10, 0.0D);
|
||||
|
||||
tessellator.draw();
|
||||
|
||||
GL11.glLineWidth(1.0F);
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,274 @@
|
||||
package com.gtnewhorizons.angelica.debug;
|
||||
|
||||
import static org.lwjgl.opengl.GL11.GL_ALPHA_TEST;
|
||||
import static org.lwjgl.opengl.GL11.GL_BLEND;
|
||||
import static org.lwjgl.opengl.GL11.GL_CULL_FACE;
|
||||
import static org.lwjgl.opengl.GL11.GL_DEPTH_TEST;
|
||||
import static org.lwjgl.opengl.GL11.GL_FLOAT;
|
||||
import static org.lwjgl.opengl.GL11.GL_ONE_MINUS_SRC_ALPHA;
|
||||
import static org.lwjgl.opengl.GL11.GL_SRC_ALPHA;
|
||||
import static org.lwjgl.opengl.GL11.GL_TEXTURE_2D;
|
||||
import static org.lwjgl.opengl.GL11.GL_TRIANGLE_STRIP;
|
||||
import static org.lwjgl.opengl.GL11.GL_VERTEX_ARRAY;
|
||||
import static org.lwjgl.opengl.GL11.glBlendFunc;
|
||||
import static org.lwjgl.opengl.GL11.glColor4f;
|
||||
import static org.lwjgl.opengl.GL11.glDisable;
|
||||
import static org.lwjgl.opengl.GL11.glDisableClientState;
|
||||
import static org.lwjgl.opengl.GL11.glDrawArrays;
|
||||
import static org.lwjgl.opengl.GL11.glEnable;
|
||||
import static org.lwjgl.opengl.GL11.glEnableClientState;
|
||||
import static org.lwjgl.opengl.GL15.GL_ARRAY_BUFFER;
|
||||
import static org.lwjgl.opengl.GL15.GL_STATIC_DRAW;
|
||||
import static org.lwjgl.opengl.GL15.glBindBuffer;
|
||||
import static org.lwjgl.opengl.GL15.glBufferData;
|
||||
import static org.lwjgl.opengl.GL15.glGenBuffers;
|
||||
import static org.lwjgl.opengl.GL20.glDisableVertexAttribArray;
|
||||
import static org.lwjgl.opengl.GL20.glEnableVertexAttribArray;
|
||||
import static org.lwjgl.opengl.GL20.glUniform1;
|
||||
import static org.lwjgl.opengl.GL20.glUniform1f;
|
||||
import static org.lwjgl.opengl.GL20.glUniform1i;
|
||||
import static org.lwjgl.opengl.GL20.glVertexAttribPointer;
|
||||
import static com.gtnewhorizon.gtnhlib.bytebuf.MemoryStack.*;
|
||||
|
||||
import com.gtnewhorizon.gtnhlib.bytebuf.MemoryStack;
|
||||
import com.gtnewhorizon.gtnhlib.client.renderer.shader.ShaderProgram;
|
||||
import java.nio.FloatBuffer;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.BufferUtils;
|
||||
|
||||
public abstract class F3Graph {
|
||||
private static final int NUM_SAMPLES = 240;
|
||||
// Two floats (x,y)
|
||||
private static final int VERT_FLOATS = 2;
|
||||
private static final int VERT_COUNT = 4;
|
||||
private static final int BORDER = 1;
|
||||
private static final int HEIGHT = 60;
|
||||
private static final int WIDTH = NUM_SAMPLES;
|
||||
private static final int FONT_COLOR = 0xFFE0E0E0;
|
||||
// Due to GLSL 120 limitations, it's just easier to use floats
|
||||
private final FloatBuffer sampleBuf = BufferUtils.createFloatBuffer(NUM_SAMPLES);
|
||||
private final long[] samples = new long[NUM_SAMPLES]; // long version for calculations
|
||||
// Circular buffer holding the last 240 samples, in nanoseconds
|
||||
private int samplesHead = 0; // one ahead of the position of the last sample
|
||||
private boolean initialized = false;
|
||||
private ShaderProgram shader;
|
||||
private int aPos;
|
||||
private int uFBWidth;
|
||||
private int uFBHeight;
|
||||
private int uScaleFactor;
|
||||
private int uHeadIdx;
|
||||
private int uSamples;
|
||||
private int vertBuf;
|
||||
private final ResourceLocation texture;
|
||||
private final float pxPerNs;
|
||||
private final boolean left;
|
||||
private long sum;
|
||||
|
||||
protected F3Graph(ResourceLocation texture, float pxPerNs, boolean left) {
|
||||
this.texture = texture;
|
||||
this.pxPerNs = pxPerNs;
|
||||
this.left = left;
|
||||
}
|
||||
|
||||
public void putSample(long time) {
|
||||
// Manage running trackers
|
||||
sum -= samples[samplesHead];
|
||||
sum += time;
|
||||
samples[samplesHead] = time;
|
||||
|
||||
sampleBuf.put(samplesHead, (float) time);
|
||||
samplesHead = (samplesHead + 1) % NUM_SAMPLES;
|
||||
}
|
||||
|
||||
private int getVertX(ScaledResolution sres, int idx) {
|
||||
if (left) {
|
||||
return switch (idx) {
|
||||
case 0, 3 -> WIDTH + BORDER * 2;
|
||||
case 1, 2 -> 0;
|
||||
default -> throw new RuntimeException("Tried to get out-of-bounds vertex for graph!");
|
||||
};
|
||||
}
|
||||
|
||||
final int displayWidth = sres.getScaledWidth();
|
||||
return switch (idx) {
|
||||
case 0, 3 -> displayWidth;
|
||||
case 1, 2 -> displayWidth - WIDTH - BORDER * 2;
|
||||
default -> throw new RuntimeException("Tried to get out-of-bounds vertex for graph!");
|
||||
};
|
||||
}
|
||||
|
||||
private int getVertY(ScaledResolution sres, int idx) {
|
||||
final int displayHeight = sres.getScaledHeight();
|
||||
return switch (idx) {
|
||||
case 0, 1 -> displayHeight - HEIGHT - BORDER * 2;
|
||||
case 2, 3 -> displayHeight;
|
||||
default -> throw new RuntimeException("Tried to get out-of-bounds vertex for graph!");
|
||||
};
|
||||
}
|
||||
|
||||
private void init() {
|
||||
shader = new ShaderProgram(
|
||||
"angelica",
|
||||
"shaders/debug_graph.vert.glsl",
|
||||
"shaders/debug_graph.frag.glsl");
|
||||
shader.use();
|
||||
|
||||
// Register attributes
|
||||
aPos = shader.getAttribLocation("pos");
|
||||
|
||||
// Register uniforms
|
||||
uFBWidth = shader.getUniformLocation("fbWidth");
|
||||
uFBHeight = shader.getUniformLocation("fbHeight");
|
||||
uScaleFactor = shader.getUniformLocation("scaleFactor");
|
||||
uSamples = shader.getUniformLocation("samples");
|
||||
uHeadIdx = shader.getUniformLocation("headIdx");
|
||||
final int uPxPerNs = shader.getUniformLocation("pxPerNs");
|
||||
final int uLeft = shader.getUniformLocation("left");
|
||||
|
||||
// Load vertex buffer
|
||||
vertBuf = glGenBuffers();
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vertBuf);
|
||||
try (final MemoryStack stack = stackPush()) {
|
||||
final FloatBuffer vertices = stack.mallocFloat(VERT_COUNT * VERT_FLOATS);
|
||||
// Since we use a triangle strip, we only need 4 vertices. The quad extends to the top of the screen so spikes
|
||||
// don't get truncated. The max height is replaced in the vert shader, no need to be precise.
|
||||
vertices.put(new float[]{
|
||||
BORDER, BORDER,
|
||||
WIDTH + BORDER, BORDER,
|
||||
BORDER, Float.MAX_VALUE,
|
||||
WIDTH + BORDER, Float.MAX_VALUE
|
||||
});
|
||||
vertices.rewind();
|
||||
|
||||
glBufferData(GL_ARRAY_BUFFER, vertices, GL_STATIC_DRAW);
|
||||
}
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
final ScaledResolution sr = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
|
||||
|
||||
// Load initial value for uniforms
|
||||
glUniform1f(uFBWidth, mc.displayWidth);
|
||||
glUniform1f(uFBHeight, mc.displayHeight);
|
||||
glUniform1f(uScaleFactor, sr.getScaleFactor());
|
||||
glUniform1i(uHeadIdx, samplesHead);
|
||||
glUniform1(uSamples, sampleBuf);
|
||||
glUniform1f(uPxPerNs, pxPerNs);
|
||||
glUniform1i(uLeft, left ? 1 : 0); // this is how you load bool uniforms
|
||||
|
||||
ShaderProgram.clear();
|
||||
}
|
||||
|
||||
public void render() {
|
||||
if (!initialized) {
|
||||
init();
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
/*
|
||||
* We try to copy modern vanilla's tracker.
|
||||
* It is 240 (FRAME_TIMES) wide by 60 tall, including the 1px borders.
|
||||
* We instead make it 242x62 including borders to prevent the borders from overlapping the samples.
|
||||
* The background is ARGB 90505050, the borders FFFFFFFF, and the text FFE0E0E0.
|
||||
* First the background is rendered, then the samples, then the foreground texture and the text.
|
||||
* The background is drawn via a 242x62 translucent rect.
|
||||
* Next, the samples are rendered by a shader on a transparent 240x60 rect.
|
||||
* Finally, the foreground texture and the text is rendered on top.
|
||||
* The shader pipeline is only needed for the sample draw.
|
||||
*/
|
||||
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
final ScaledResolution sr = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
|
||||
|
||||
// Setup GL state
|
||||
final Tessellator tess = Tessellator.instance;
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
// Draw background
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glColor4f(0x50 / 255.0F, 0x50 / 255.0F, 0x50 / 255.0F, 0x90 / 255.0F);
|
||||
tess.startDrawingQuads();
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
tess.addVertex(getVertX(sr, i), getVertY(sr, i), 0);
|
||||
}
|
||||
tess.draw();
|
||||
glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
|
||||
// Draw samples
|
||||
shader.use();
|
||||
|
||||
// Load uniforms
|
||||
glUniform1f(uFBWidth, mc.displayWidth);
|
||||
glUniform1f(uFBHeight, mc.displayHeight);
|
||||
glUniform1f(uScaleFactor, sr.getScaleFactor());
|
||||
glUniform1i(uHeadIdx, samplesHead);
|
||||
glUniform1(uSamples, sampleBuf);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vertBuf);
|
||||
glEnableVertexAttribArray(aPos);
|
||||
glVertexAttribPointer(aPos, VERT_FLOATS, GL_FLOAT, false, VERT_FLOATS * 4, 0);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
|
||||
// Left side graphs are inverted, so temporarily disable culling
|
||||
if (!left) glDisable(GL_CULL_FACE);
|
||||
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, VERT_COUNT);
|
||||
|
||||
if (!left) glEnable(GL_CULL_FACE);
|
||||
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableVertexAttribArray(aPos);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
ShaderProgram.clear();
|
||||
|
||||
// Draw foreground
|
||||
|
||||
mc.getTextureManager().bindTexture(texture);
|
||||
tess.startDrawingQuads();
|
||||
tess.addVertexWithUV(getVertX(sr, 0), getVertY(sr, 0), 0.0D, 1, 0);
|
||||
tess.addVertexWithUV(getVertX(sr, 1), getVertY(sr, 1), 0.0D, 0, 0);
|
||||
tess.addVertexWithUV(getVertX(sr, 2), getVertY(sr, 2), 0.0D, 0, 1);
|
||||
tess.addVertexWithUV(getVertX(sr, 3), getVertY(sr, 3), 0.0D, 1, 1);
|
||||
tess.draw();
|
||||
|
||||
// Reset GL state
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
glDisable(GL_BLEND);
|
||||
|
||||
// Draw text
|
||||
// Ensure running counters are reset on first sample
|
||||
long min = Long.MAX_VALUE;
|
||||
long max = Long.MIN_VALUE;
|
||||
for (int i = 0; i < NUM_SAMPLES; ++i) {
|
||||
min = Math.min(min, samples[i]);
|
||||
max = Math.max(max, samples[i]);
|
||||
}
|
||||
String minStr = String.format("%.1f ms min", min / 1_000_000D);
|
||||
String avgStr = String.format("%.1f ms avg", sum / 1_000_000 / (double) NUM_SAMPLES);
|
||||
String maxStr = String.format("%.1f ms max", max / 1_000_000D);
|
||||
final FontRenderer fr = mc.fontRenderer;
|
||||
final int top = sr.getScaledHeight() - HEIGHT - BORDER * 2 - fr.FONT_HEIGHT;
|
||||
final int scaledWidth = sr.getScaledWidth();
|
||||
|
||||
if (left) {
|
||||
fr.drawString(minStr, BORDER * 2, top, FONT_COLOR, true);
|
||||
fr.drawString(avgStr, BORDER + WIDTH / 2 - fr.getStringWidth(avgStr) / 2, top, FONT_COLOR, true);
|
||||
fr.drawString(maxStr, BORDER * 2 + WIDTH - fr.getStringWidth(maxStr), top, FONT_COLOR, true);
|
||||
} else {
|
||||
fr.drawString(minStr, scaledWidth - (BORDER * 2 + WIDTH), top, FONT_COLOR, true);
|
||||
fr.drawString(avgStr, scaledWidth - (BORDER + WIDTH / 2 + fr.getStringWidth(avgStr) / 2), top, FONT_COLOR, true);
|
||||
fr.drawString(maxStr, scaledWidth - (BORDER * 2 + fr.getStringWidth(maxStr)), top, FONT_COLOR, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.gtnewhorizons.angelica.debug;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class FrametimeGraph extends F3Graph {
|
||||
public FrametimeGraph() {
|
||||
// At 1x scale, 30 FPS should be 60 px. 30 FPS = 33_333_333ns per frame, 60px/33_333_333ns = 0.0000018f px/ns
|
||||
super(
|
||||
new ResourceLocation("angelica:textures/frametimes_fg.png"),
|
||||
0.0000018f,
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.gtnewhorizons.angelica.debug;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class TPSGraph extends F3Graph {
|
||||
public TPSGraph() {
|
||||
// At 1x scale, 20 TPS should be 60 px. 20 FPS = 50_000_000ns per frame, 60px/50_000_000ns = 0.0000012 px/ns
|
||||
super(
|
||||
new ResourceLocation("angelica:textures/tps_fg.png"),
|
||||
0.0000012f,
|
||||
false
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,6 @@ 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.monster.EntityCreeper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
@@ -37,6 +36,7 @@ import java.util.function.Predicate;
|
||||
public class DynamicLights {
|
||||
private static DynamicLights instance;
|
||||
public static DynamicLightsMode Mode = DynamicLightsMode.OFF;
|
||||
public static boolean ShaderForce = false;
|
||||
|
||||
private static final double MAX_RADIUS = 7.75;
|
||||
private static final double MAX_RADIUS_SQUARED = MAX_RADIUS * MAX_RADIUS;
|
||||
@@ -52,7 +52,11 @@ public class DynamicLights {
|
||||
}
|
||||
|
||||
public static boolean isEnabled() {
|
||||
return AngelicaConfig.enableDynamicLights && Mode.isEnabled() && !IrisApi.getInstance().isShaderPackInUse();
|
||||
return AngelicaConfig.enableDynamicLights &&
|
||||
Mode.isEnabled() &&
|
||||
// if shader force is enabled then true
|
||||
// if not, then true when shaders are not in use
|
||||
(ShaderForce || !IrisApi.getInstance().isShaderPackInUse());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,7 +69,7 @@ public class DynamicLights {
|
||||
return;
|
||||
|
||||
long now = System.currentTimeMillis();
|
||||
if (now >= this.lastUpdate + 50) {
|
||||
if (now >= this.lastUpdate + Mode.getDelay()) {
|
||||
this.lastUpdate = now;
|
||||
this.lastUpdateCount = 0;
|
||||
|
||||
|
||||
@@ -7,7 +7,8 @@ public enum DynamicLightsMode
|
||||
OFF("Off", 0),
|
||||
FASTEST("Fastest", 500),
|
||||
FAST("Fast", 250),
|
||||
FANCY("Fancy", 0);
|
||||
FANCY("Fancy", 50),
|
||||
REALTIME("Realtime", 0);
|
||||
|
||||
private final String name;
|
||||
private final int delay;
|
||||
|
||||
@@ -73,13 +73,6 @@ public interface IDynamicLightSource {
|
||||
*/
|
||||
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);
|
||||
|
||||
@@ -7,9 +7,11 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL13;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -19,21 +21,25 @@ public class Feature {
|
||||
GL13.GL_MULTISAMPLE_BIT, GL11.GL_PIXEL_MODE_BIT, GL11.GL_POINT_BIT, GL11.GL_POLYGON_BIT, GL11.GL_POLYGON_STIPPLE_BIT, GL11.GL_SCISSOR_BIT,
|
||||
GL11.GL_STENCIL_BUFFER_BIT, GL11.GL_TEXTURE_BIT, GL11.GL_TRANSFORM_BIT, GL11.GL_VIEWPORT_BIT };
|
||||
|
||||
static final Int2ObjectMap<Set<IStateStack<?>>> maskToFeaturesMap = new Int2ObjectOpenHashMap<>();
|
||||
static final Int2ObjectMap<List<IStateStack<?>>> maskToFeaturesMap = new Int2ObjectOpenHashMap<>();
|
||||
|
||||
static Set<IStateStack<?>> maskToFeatures(int mask) {
|
||||
static List<IStateStack<?>> maskToFeatures(int mask) {
|
||||
if(maskToFeaturesMap.containsKey(mask)) {
|
||||
return maskToFeaturesMap.get(mask);
|
||||
}
|
||||
|
||||
final Set<IStateStack<?>> features = new HashSet<>();
|
||||
|
||||
for(int attrib : Feature.supportedAttribs) {
|
||||
if((mask & attrib) == attrib) {
|
||||
features.addAll(getFeatures(attrib));
|
||||
}
|
||||
}
|
||||
maskToFeaturesMap.put(mask, features);
|
||||
return features;
|
||||
|
||||
final List<IStateStack<?>> asList = new ArrayList<>(features);
|
||||
|
||||
maskToFeaturesMap.put(mask, asList);
|
||||
return asList;
|
||||
}
|
||||
|
||||
private static final Map<Integer, Set<IStateStack<?>>> attribToFeatures = new HashMap<>();
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.gtnewhorizons.angelica.glsm.texture.TextureInfoCache;
|
||||
import com.gtnewhorizons.angelica.glsm.texture.TextureTracker;
|
||||
import com.gtnewhorizons.angelica.hudcaching.HUDCaching;
|
||||
import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
||||
@@ -35,6 +36,7 @@ import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArraySet;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.SneakyThrows;
|
||||
import net.coderbot.iris.Iris;
|
||||
import net.coderbot.iris.gbuffer_overrides.state.StateTracker;
|
||||
import net.coderbot.iris.gl.blending.AlphaTestStorage;
|
||||
@@ -65,11 +67,16 @@ import org.lwjgl.opengl.GLContext;
|
||||
import org.lwjgl.opengl.KHRDebug;
|
||||
|
||||
import java.lang.Math;
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.lang.reflect.Field;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.DoubleBuffer;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
import java.nio.ShortBuffer;
|
||||
import java.util.AbstractMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.IntSupplier;
|
||||
@@ -133,11 +140,21 @@ public class GLStateManager {
|
||||
@Getter protected static final MaterialStateStack frontMaterial = new MaterialStateStack(GL11.GL_FRONT);
|
||||
@Getter protected static final MaterialStateStack backMaterial = new MaterialStateStack(GL11.GL_BACK);
|
||||
|
||||
private static final MethodHandle MAT4_STACK_CURR_DEPTH;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
try {
|
||||
Field curr = ReflectionHelper.findField(Matrix4fStack.class, "curr");
|
||||
curr.setAccessible(true);
|
||||
MAT4_STACK_CURR_DEPTH = MethodHandles.lookup().unreflectGetter(curr);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Getter protected static final ViewPortStateStack viewportState = new ViewPortStateStack();
|
||||
@@ -149,11 +166,18 @@ public class GLStateManager {
|
||||
while(!attribs.isEmpty()) {
|
||||
attribs.popInt();
|
||||
}
|
||||
for(IStateStack<?> stack : Feature.maskToFeatures(GL11.GL_ALL_ATTRIB_BITS)) {
|
||||
|
||||
List<IStateStack<?>> stacks = Feature.maskToFeatures(GL11.GL_ALL_ATTRIB_BITS);
|
||||
int size = stacks.size();
|
||||
|
||||
for(int i = 0; i < size; i++) {
|
||||
IStateStack<?> stack = stacks.get(i);
|
||||
|
||||
while(!stack.isEmpty()) {
|
||||
stack.pop();
|
||||
}
|
||||
}
|
||||
|
||||
modelViewMatrix.clear();
|
||||
projectionMatrix.clear();
|
||||
}
|
||||
@@ -172,6 +196,7 @@ public class GLStateManager {
|
||||
@Setter @Getter private static boolean runningSplash = true;
|
||||
|
||||
private static int glListMode = 0;
|
||||
private static int glListNesting = 0;
|
||||
private static int glListId = -1;
|
||||
private static final Map<IStateStack<?>, ISettableState<?>> glListStates = new Object2ObjectArrayMap<>();
|
||||
private static final Int2ObjectMap<Set<Map.Entry<IStateStack<?>, ISettableState<?>>>> glListChanges = new Int2ObjectOpenHashMap<>();
|
||||
@@ -179,6 +204,9 @@ public class GLStateManager {
|
||||
|
||||
|
||||
public static class GLFeatureSet extends IntOpenHashSet {
|
||||
|
||||
private static final long serialVersionUID = 8558779940775721010L;
|
||||
|
||||
public GLFeatureSet addFeature(int feature) {
|
||||
super.add(feature);
|
||||
return this;
|
||||
@@ -397,6 +425,11 @@ public class GLStateManager {
|
||||
}
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public static int getMatrixStackDepth(Matrix4fStack stack) {
|
||||
return (int) MAT4_STACK_CURR_DEPTH.invokeExact(stack);
|
||||
}
|
||||
|
||||
public static int glGetInteger(int pname) {
|
||||
if(shouldBypassCache()) {
|
||||
return GL11.glGetInteger(pname);
|
||||
@@ -416,6 +449,8 @@ public class GLStateManager {
|
||||
case GL11.GL_COLOR_MATERIAL_FACE -> colorMaterialFace.getValue();
|
||||
case GL11.GL_COLOR_MATERIAL_PARAMETER -> colorMaterialParameter.getValue();
|
||||
case GL20.GL_CURRENT_PROGRAM -> activeProgram;
|
||||
case GL11.GL_MODELVIEW_STACK_DEPTH -> getMatrixStackDepth(modelViewMatrix);
|
||||
case GL11.GL_PROJECTION_STACK_DEPTH -> getMatrixStackDepth(projectionMatrix);
|
||||
|
||||
default -> GL11.glGetInteger(pname);
|
||||
};
|
||||
@@ -959,18 +994,52 @@ public class GLStateManager {
|
||||
glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, j);
|
||||
}
|
||||
|
||||
public static void glDrawArrays(int mode, int first, int count) {
|
||||
// Iris -- TODO: This doesn't seem to work and is related to matchPass()
|
||||
if(AngelicaConfig.enableIris) {
|
||||
public static void trySyncProgram() {
|
||||
if (AngelicaConfig.enableIris) {
|
||||
Iris.getPipelineManager().getPipeline().ifPresent(WorldRenderingPipeline::syncProgram);
|
||||
}
|
||||
GL11.glDrawArrays(mode, first, count);
|
||||
}
|
||||
|
||||
public static void glBegin(int mode) {
|
||||
trySyncProgram();
|
||||
GL11.glBegin(mode);
|
||||
}
|
||||
|
||||
public static void glDrawElements(int mode, ByteBuffer indices) {
|
||||
trySyncProgram();
|
||||
GL11.glDrawElements(mode, indices);
|
||||
}
|
||||
|
||||
public static void glDrawElements(int mode, IntBuffer indices) {
|
||||
trySyncProgram();
|
||||
GL11.glDrawElements(mode, indices);
|
||||
}
|
||||
|
||||
public static void glDrawElements(int mode, ShortBuffer indices) {
|
||||
trySyncProgram();
|
||||
GL11.glDrawElements(mode, indices);
|
||||
}
|
||||
|
||||
public static void glDrawElements(int mode, int indices_count, int type, long indices_buffer_offset) {
|
||||
trySyncProgram();
|
||||
GL11.glDrawElements(mode, indices_count, type, indices_buffer_offset);
|
||||
}
|
||||
|
||||
public static void glDrawElements(int mode, int count, int type, ByteBuffer indices) {
|
||||
trySyncProgram();
|
||||
GL11.glDrawElements(mode, count, type, indices);
|
||||
}
|
||||
|
||||
public static void glDrawBuffer(int mode) {
|
||||
trySyncProgram();
|
||||
GL11.glDrawBuffer(mode);
|
||||
}
|
||||
|
||||
public static void glDrawArrays(int mode, int first, int count) {
|
||||
trySyncProgram();
|
||||
GL11.glDrawArrays(mode, first, count);
|
||||
}
|
||||
|
||||
public static void glLogicOp(int opcode) {
|
||||
GL11.glLogicOp(opcode);
|
||||
}
|
||||
@@ -1173,21 +1242,35 @@ public class GLStateManager {
|
||||
|
||||
public static void glNewList(int list, int mode) {
|
||||
if(glListMode > 0) {
|
||||
throw new RuntimeException("glNewList called inside of a display list!");
|
||||
glListNesting += 1;
|
||||
return;
|
||||
}
|
||||
|
||||
glListId = list;
|
||||
glListMode = mode;
|
||||
GL11.glNewList(list, mode);
|
||||
for(IStateStack<?> stack : Feature.maskToFeatures(GL11.GL_ALL_ATTRIB_BITS)) {
|
||||
|
||||
List<IStateStack<?>> stacks = Feature.maskToFeatures(GL11.GL_ALL_ATTRIB_BITS);
|
||||
int size = stacks.size();
|
||||
|
||||
for(int i = 0; i < size; i++) {
|
||||
IStateStack<?> stack = stacks.get(i);
|
||||
|
||||
// Feature Stack, copy of current feature state
|
||||
glListStates.put(stack, (ISettableState<?>) ((ISettableState<?>)stack).copy());
|
||||
}
|
||||
|
||||
if(glListMode == GL11.GL_COMPILE) {
|
||||
pushState(GL11.GL_ALL_ATTRIB_BITS);
|
||||
}
|
||||
}
|
||||
|
||||
public static void glEndList() {
|
||||
if (glListNesting > 0) {
|
||||
glListNesting -= 1;
|
||||
return;
|
||||
}
|
||||
|
||||
if(glListMode == 0) {
|
||||
throw new RuntimeException("glEndList called outside of a display list!");
|
||||
}
|
||||
@@ -1219,6 +1302,7 @@ public class GLStateManager {
|
||||
if(list < 0) {
|
||||
VBOManager.get(list).render();
|
||||
} else {
|
||||
trySyncProgram();
|
||||
GL11.glCallList(list);
|
||||
if(glListChanges.containsKey(list)) {
|
||||
for(Map.Entry<IStateStack<?>, ISettableState<?>> entry : glListChanges.get(list)) {
|
||||
@@ -1231,15 +1315,23 @@ public class GLStateManager {
|
||||
|
||||
public static void pushState(int mask) {
|
||||
attribs.push(mask);
|
||||
for(IStateStack<?> stack : Feature.maskToFeatures(mask)) {
|
||||
stack.push();
|
||||
}
|
||||
|
||||
List<IStateStack<?>> stacks = Feature.maskToFeatures(mask);
|
||||
int size = stacks.size();
|
||||
|
||||
for(int i = 0; i < size; i++) {
|
||||
stacks.get(i).push();
|
||||
}
|
||||
}
|
||||
|
||||
public static void popState() {
|
||||
final int mask = attribs.popInt();
|
||||
for(IStateStack<?> stack : Feature.maskToFeatures(mask)) {
|
||||
stack.pop();
|
||||
|
||||
List<IStateStack<?>> stacks = Feature.maskToFeatures(mask);
|
||||
int size = stacks.size();
|
||||
|
||||
for(int i = 0; i < size; i++) {
|
||||
stacks.get(i).pop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ import java.nio.IntBuffer;
|
||||
public class RenderSystem {
|
||||
private static final Logger LOGGER = LogManager.getLogger("RenderSystem");
|
||||
private static DSAAccess dsaState;
|
||||
private static boolean hasMultibind;
|
||||
private static boolean supportsCompute;
|
||||
|
||||
private RenderSystem() {}
|
||||
@@ -41,7 +40,6 @@ public class RenderSystem {
|
||||
dsaState = new DSACore();
|
||||
LOGGER.info("OpenGL 4.5 detected, enabling DSA.");
|
||||
}
|
||||
hasMultibind = GLStateManager.capabilities.OpenGL45;
|
||||
|
||||
} catch (NoSuchFieldError ignored) {}
|
||||
try {
|
||||
@@ -55,10 +53,6 @@ public class RenderSystem {
|
||||
LOGGER.info("No DSA support detected, falling back to legacy OpenGL.");
|
||||
}
|
||||
|
||||
try {
|
||||
hasMultibind |= GLStateManager.capabilities.GL_ARB_multi_bind;
|
||||
} catch (NoSuchFieldError ignored) {}
|
||||
|
||||
supportsCompute = supportsCompute();
|
||||
}
|
||||
|
||||
@@ -239,7 +233,7 @@ public class RenderSystem {
|
||||
dsaState.bindTextureToUnit(unit, texture);
|
||||
}
|
||||
|
||||
public static FloatBuffer PROJECTION_MATRIX_BUFFER = BufferUtils.createFloatBuffer(16);
|
||||
public static final FloatBuffer PROJECTION_MATRIX_BUFFER = BufferUtils.createFloatBuffer(16);
|
||||
public static void setupProjectionMatrix(Matrix4f matrix) {
|
||||
GL11.glMatrixMode(GL11.GL_PROJECTION);
|
||||
GL11.glPushMatrix();
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.gtnewhorizons.angelica.glsm.states;
|
||||
|
||||
public interface ISettableState<T> extends Cloneable {
|
||||
T set(T state);
|
||||
@SuppressWarnings("unchecked")
|
||||
default void set(ISettableState<?> value) {
|
||||
set((T) value);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ 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;
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
package com.gtnewhorizons.angelica.hudcaching;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.gtnewhorizon.gtnhlib.client.renderer.TessellatorManager;
|
||||
import com.gtnewhorizons.angelica.compat.ModStatus;
|
||||
import com.gtnewhorizons.angelica.config.AngelicaConfig;
|
||||
@@ -19,9 +16,7 @@ import org.lwjgl.opengl.GL30;
|
||||
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.InputEvent;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.gui.GuiIngame;
|
||||
@@ -29,16 +24,14 @@ import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.EntityRenderer;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.client.shader.Framebuffer;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraftforge.client.GuiIngameForge;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import xaero.common.core.XaeroMinimapCore;
|
||||
|
||||
import static com.gtnewhorizons.angelica.loading.AngelicaTweaker.LOGGER;
|
||||
|
||||
// See LICENSE+HUDCaching.md for license information.
|
||||
// See LICENSE-HUDCaching.md for license information.
|
||||
|
||||
public class HUDCaching {
|
||||
|
||||
@@ -63,38 +56,13 @@ public class HUDCaching {
|
||||
public static boolean renderCrosshairsCaptured;
|
||||
|
||||
private final static RenderGameOverlayEvent fakeTextEvent = new RenderGameOverlayEvent.Text(new RenderGameOverlayEvent(0, null, 0, 0), null, null);
|
||||
private final static RenderGameOverlayEvent fakePreEvent = new RenderGameOverlayEvent.Pre(new RenderGameOverlayEvent(0, null, 0, 0), RenderGameOverlayEvent.ElementType.HELMET);
|
||||
private final static RenderGameOverlayEvent.Post fakePostEvent = new RenderGameOverlayEvent.Post(new RenderGameOverlayEvent(0, null, 0, 0), RenderGameOverlayEvent.ElementType.HELMET);
|
||||
|
||||
public static final HUDCaching INSTANCE = new HUDCaching();
|
||||
|
||||
|
||||
private HUDCaching() {}
|
||||
|
||||
/* TODO START REMOVE DEBUG STUFF */
|
||||
|
||||
private final List<Long> updateTimeList = new ArrayList<>(21);
|
||||
private static boolean isEnabled = true;
|
||||
|
||||
// moved initialization to when its registered to avoid an empty Debug category, which can cause crashes when
|
||||
// opening the controls menu and hudcaching is disabled in the config
|
||||
private static KeyBinding toggle;
|
||||
|
||||
public static void registerKeyBindings() {
|
||||
toggle = new KeyBinding("Toggle HUDCaching", 0, "Debug");
|
||||
ClientRegistry.registerKeyBinding(toggle);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onKeypress(InputEvent.KeyInputEvent event) {
|
||||
if (toggle != null && toggle.isPressed()) {
|
||||
isEnabled = !isEnabled;
|
||||
final String msg = isEnabled ? "Enabled HUDCaching" : "Disabled HUDCaching";
|
||||
if (mc.thePlayer != null) mc.thePlayer.addChatMessage(new ChatComponentText(msg));
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO END REMOVE DEBUG STUFF */
|
||||
|
||||
// highest so it runs before the GLSM load event
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public void onJoinWorld(WorldEvent.Load event) {
|
||||
@@ -112,7 +80,7 @@ public class HUDCaching {
|
||||
XaeroMinimapCore.beforeIngameGuiRender(partialTicks);
|
||||
}
|
||||
|
||||
if (!OpenGlHelper.isFramebufferEnabled() || !isEnabled || framebuffer == null) {
|
||||
if (!OpenGlHelper.isFramebufferEnabled() || framebuffer == null) {
|
||||
ingame.renderGameOverlay(partialTicks, hasScreen, mouseX, mouseY);
|
||||
return;
|
||||
}
|
||||
@@ -154,17 +122,21 @@ public class HUDCaching {
|
||||
GuiIngameForgeAccessor guiForge = ((GuiIngameForgeAccessor) ingame);
|
||||
if (renderHelmetCaptured) {
|
||||
guiForge.callRenderHelmet(resolution, partialTicks, hasScreen, mouseX, mouseY);
|
||||
if (ModStatus.isHoloInventoryLoaded){
|
||||
if (ModStatus.isHoloInventoryLoaded) {
|
||||
Renderer.INSTANCE.angelicaOverride = false;
|
||||
// only settings the partial ticks as mouseX and mouseY are not used in renderEvent
|
||||
((RenderGameOverlayEventAccessor) fakePreEvent).setPartialTicks(partialTicks);
|
||||
Renderer.INSTANCE.renderEvent(fakePreEvent);
|
||||
((RenderGameOverlayEventAccessor) fakePostEvent).setPartialTicks(partialTicks);
|
||||
Renderer.INSTANCE.renderEvent(fakePostEvent);
|
||||
}
|
||||
}
|
||||
if (renderPortalCapturedTicks > 0) {
|
||||
guiForge.callRenderPortal(width, height, partialTicks);
|
||||
}
|
||||
if (renderCrosshairsCaptured) {
|
||||
if (ModStatus.isXaerosMinimapLoaded){
|
||||
// this fixes the crosshair going invisible when no lines are being drawn under the minimap
|
||||
GLStateManager.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
guiForge.callRenderCrosshairs(width, height);
|
||||
}
|
||||
if (ModStatus.isThaumcraftLoaded || ModStatus.isThaumicHorizonsLoaded){
|
||||
@@ -244,13 +216,14 @@ public class HUDCaching {
|
||||
|
||||
// moved to here due to the method being called from a mixin
|
||||
public static void disableHoloInventory() {
|
||||
if (ModStatus.isHoloInventoryLoaded){
|
||||
Renderer.INSTANCE.angelicaOverride = isEnabled;
|
||||
if (ModStatus.isHoloInventoryLoaded) {
|
||||
Renderer.INSTANCE.angelicaOverride = true;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused") // called via ASM
|
||||
public static class HUDCachingHooks {
|
||||
public static boolean shouldReturnEarly(){
|
||||
public static boolean shouldReturnEarly() {
|
||||
return renderingCacheOverride;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
package com.gtnewhorizons.angelica.loading;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.gtnewhorizon.gtnhlib.asm.ASMUtil;
|
||||
import com.gtnewhorizon.gtnhlib.config.ConfigException;
|
||||
import com.gtnewhorizon.gtnhlib.config.ConfigurationManager;
|
||||
import com.gtnewhorizon.gtnhmixins.IEarlyMixinLoader;
|
||||
import com.gtnewhorizons.angelica.config.AngelicaConfig;
|
||||
import com.gtnewhorizons.angelica.config.CompatConfig;
|
||||
import com.gtnewhorizons.angelica.mixins.Mixins;
|
||||
import com.gtnewhorizons.angelica.mixins.TargetedMod;
|
||||
import com.gtnewhorizons.angelica.transform.compat.CompatASMTransformers;
|
||||
import com.gtnewhorizons.angelica.transform.compat.GenericCompatTransformer;
|
||||
import com.gtnewhorizons.angelica.transform.compat.handlers.CompatHandler;
|
||||
import com.gtnewhorizons.angelica.transform.compat.handlers.CompatHandlers;
|
||||
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
|
||||
import jss.notfine.asm.AsmTransformers;
|
||||
import jss.notfine.asm.mappings.Namer;
|
||||
import jss.notfine.config.MCPatcherForgeConfig;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -52,6 +55,8 @@ public class AngelicaTweaker implements IFMLLoadingPlugin, IEarlyMixinLoader {
|
||||
try {
|
||||
// Angelica Config
|
||||
ConfigurationManager.registerConfig(AngelicaConfig.class);
|
||||
ConfigurationManager.registerConfig(CompatConfig.class);
|
||||
MCPatcherForgeConfig.registerConfig();
|
||||
final LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
|
||||
final Configuration config = ctx.getConfiguration();
|
||||
final LoggerConfig loggerConfig = config.getLoggerConfig(LogManager.ROOT_LOGGER_NAME);
|
||||
@@ -76,10 +81,24 @@ public class AngelicaTweaker implements IFMLLoadingPlugin, IEarlyMixinLoader {
|
||||
mixinTweakClasses.add(MixinCompatHackTweaker.class.getName());
|
||||
}
|
||||
if (transformerClasses == null) {
|
||||
final List<String> transformers = new ArrayList<>(CompatASMTransformers.getTransformers());
|
||||
final List<String> transformers = new ArrayList<>();
|
||||
|
||||
// Regsiter compat handlers, and add extra specific transformers, then build and register the generic transformer
|
||||
for (CompatHandler handler : CompatHandlers.getHandlers()) {
|
||||
GenericCompatTransformer.register(handler);
|
||||
if (handler.extraTransformers() != null) {
|
||||
transformers.addAll(handler.extraTransformers());
|
||||
}
|
||||
}
|
||||
|
||||
GenericCompatTransformer.build();
|
||||
transformers.add(GenericCompatTransformer.class.getName());
|
||||
|
||||
// Add NotFine transformers
|
||||
final List<String> notFineTransformers = AsmTransformers.getTransformers();
|
||||
if (!notFineTransformers.isEmpty()) Namer.initNames();
|
||||
transformers.addAll(notFineTransformers);
|
||||
|
||||
transformerClasses = transformers.toArray(new String[0]);
|
||||
}
|
||||
return transformerClasses;
|
||||
@@ -133,18 +152,5 @@ public class AngelicaTweaker implements IFMLLoadingPlugin, IEarlyMixinLoader {
|
||||
}
|
||||
}
|
||||
|
||||
private static final ImmutableMap<String, TargetedMod> MODS_BY_CLASS = ImmutableMap.<String, TargetedMod>builder()
|
||||
.put("optifine.OptiFineForgeTweaker", TargetedMod.OPTIFINE)
|
||||
.put("fastcraft.Tweaker", TargetedMod.FASTCRAFT)
|
||||
.put("cofh.asm.LoadingPlugin", TargetedMod.COFHCORE)
|
||||
.build();
|
||||
public static final Set<TargetedMod> coreMods = new HashSet<>();
|
||||
|
||||
private static void detectCoreMods(Set<String> loadedCoreMods) {
|
||||
MODS_BY_CLASS.forEach((key, value) -> {
|
||||
if (loadedCoreMods.contains(key))
|
||||
coreMods.add(value);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,15 +4,24 @@ import com.gtnewhorizons.angelica.config.AngelicaConfig;
|
||||
import com.gtnewhorizons.angelica.transform.BlockTransformer;
|
||||
import com.gtnewhorizons.angelica.transform.RedirectorTransformer;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.relauncher.CoreModManager;
|
||||
import cpw.mods.fml.relauncher.FMLLaunchHandler;
|
||||
import net.minecraft.launchwrapper.IClassTransformer;
|
||||
import net.minecraft.launchwrapper.ITweaker;
|
||||
import net.minecraft.launchwrapper.Launch;
|
||||
import net.minecraft.launchwrapper.LaunchClassLoader;
|
||||
import org.spongepowered.asm.launch.platform.MixinContainer;
|
||||
import org.spongepowered.asm.launch.platform.MixinPlatformManager;
|
||||
import org.spongepowered.asm.launch.platform.container.IContainerHandle;
|
||||
import org.spongepowered.asm.mixin.transformer.Config;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static com.gtnewhorizons.angelica.loading.AngelicaTweaker.LOGGER;
|
||||
|
||||
@@ -23,8 +32,8 @@ public class MixinCompatHackTweaker implements ITweaker {
|
||||
verifyDependencies();
|
||||
|
||||
if(DISABLE_OPTIFINE_FASTCRAFT_BETTERFPS) {
|
||||
LOGGER.info("Disabling Optifine, Fastcraft, and BetterFPS (if present)");
|
||||
disableOptifineFastcraftAndBetterFPS();
|
||||
LOGGER.info("Disabling Optifine, Fastcraft, BetterFPS, and other incompatible mods (if present)");
|
||||
disableIncompatibleMods();
|
||||
}
|
||||
|
||||
if (AngelicaConfig.enableHudCaching){
|
||||
@@ -40,8 +49,8 @@ public class MixinCompatHackTweaker implements ITweaker {
|
||||
|
||||
private void disableXaerosMinimapWaypointTransformer(){
|
||||
try {
|
||||
LaunchClassLoader lcl = Launch.classLoader;
|
||||
Field xformersField = lcl.getClass().getDeclaredField("transformers");
|
||||
final LaunchClassLoader lcl = Launch.classLoader;
|
||||
final Field xformersField = lcl.getClass().getDeclaredField("transformers");
|
||||
xformersField.setAccessible(true);
|
||||
@SuppressWarnings("unchecked")
|
||||
List<IClassTransformer> xformers = (List<IClassTransformer>) xformersField.get(lcl);
|
||||
@@ -57,14 +66,14 @@ public class MixinCompatHackTweaker implements ITweaker {
|
||||
}
|
||||
}
|
||||
|
||||
private void disableOptifineFastcraftAndBetterFPS() {
|
||||
// Remove Optifine, Fastcraft, and BetterFPS transformers & Mod Containers
|
||||
@SuppressWarnings("unchecked")
|
||||
private void disableIncompatibleMods() {
|
||||
// Remove transformers, Mod Containers, and mixins for Optifine, Fastcraft, BetterFPS and other incompatible mods
|
||||
try {
|
||||
LaunchClassLoader lcl = Launch.classLoader;
|
||||
Field xformersField = lcl.getClass().getDeclaredField("transformers");
|
||||
final LaunchClassLoader lcl = Launch.classLoader;
|
||||
final Field xformersField = lcl.getClass().getDeclaredField("transformers");
|
||||
xformersField.setAccessible(true);
|
||||
@SuppressWarnings("unchecked")
|
||||
List<IClassTransformer> xformers = (List<IClassTransformer>) xformersField.get(lcl);
|
||||
final 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("optifine") || name.startsWith("fastcraft") || name.startsWith("me.guichaguri.betterfps")) {
|
||||
@@ -76,17 +85,72 @@ public class MixinCompatHackTweaker implements ITweaker {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
try {
|
||||
Field injectedContainersField = Loader.class.getDeclaredField("injectedContainers");
|
||||
final Field injectedContainersField = Loader.class.getDeclaredField("injectedContainers");
|
||||
injectedContainersField.setAccessible(true);
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> containers = (List<String> ) injectedContainersField.get(Loader.class);
|
||||
final List<String> containers = (List<String> ) injectedContainersField.get(Loader.class);
|
||||
for (int idx = containers.size() - 1; idx >= 0; idx--) {
|
||||
final String name = containers.get(idx);
|
||||
final String name = containers.get(idx);
|
||||
if (name.startsWith("optifine") || name.startsWith("fastcraft")) {
|
||||
LOGGER.info("Removing mod container " + name);
|
||||
containers.remove(idx);
|
||||
}
|
||||
}
|
||||
|
||||
final Field reparsedCoremodsField = CoreModManager.class.getDeclaredField("reparsedCoremods");
|
||||
final Field loadedCoremodsField = CoreModManager.class.getDeclaredField("loadedCoremods");
|
||||
reparsedCoremodsField.setAccessible(true);
|
||||
loadedCoremodsField.setAccessible(true);
|
||||
final ArrayList<String> reparsedCoremods = (ArrayList<String>) reparsedCoremodsField.get(CoreModManager.class);
|
||||
final ArrayList<String> loadedCoremods = (ArrayList<String>) loadedCoremodsField.get(CoreModManager.class);
|
||||
for (int idx = reparsedCoremods.size() - 1; idx >= 0; idx--) {
|
||||
final String coreMod = reparsedCoremods.get(idx);
|
||||
if (coreMod.startsWith("optimizationsandtweaks")) {
|
||||
LOGGER.info("Removing reparsed coremod " + coreMod);
|
||||
// Fool the CoreModManager into not checking for a mod container again later
|
||||
loadedCoremods.add(reparsedCoremods.remove(idx));
|
||||
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
try {
|
||||
final ArrayList<String> mixinConfigsDefault = (ArrayList<String>) Launch.blackboard.get("mixin.configs.default");
|
||||
if (mixinConfigsDefault != null) {
|
||||
for (int idx = mixinConfigsDefault.size() - 1; idx >= 0; idx--) {
|
||||
final String name = mixinConfigsDefault.get(idx);
|
||||
if (name != null && name.contains("optimizationsandtweaks")) {
|
||||
LOGGER.info("Removing mixin config " + name);
|
||||
mixinConfigsDefault.remove(idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
final Set<Config> mixinConfigs = (Set<Config>) Launch.blackboard.get("mixin.configs.queue");
|
||||
final Set<Config> toRemove = new HashSet<>();
|
||||
if (mixinConfigs != null) {
|
||||
for (Config config : mixinConfigs) {
|
||||
final String name = config.getName();
|
||||
if (name != null && name.contains("optimizationsandtweaks")) {
|
||||
LOGGER.info("Removing queued mixin config " + config.getName());
|
||||
toRemove.add(config);
|
||||
}
|
||||
}
|
||||
mixinConfigs.removeAll(toRemove);
|
||||
}
|
||||
final MixinPlatformManager platformManager = (MixinPlatformManager) Launch.blackboard.get("mixin.platform");
|
||||
if (platformManager != null) {
|
||||
final Field containersField = platformManager.getClass().getDeclaredField("containers");
|
||||
containersField.setAccessible(true);
|
||||
final Map<IContainerHandle, MixinContainer> containers = (Map<IContainerHandle, MixinContainer>) containersField.get(platformManager);
|
||||
for (Map.Entry<IContainerHandle, MixinContainer> entry : containers.entrySet()) {
|
||||
final String attribute = entry.getKey().getAttribute("MixinConfigs");
|
||||
if(attribute != null && attribute.contains("optimizationsandtweaks")) {
|
||||
LOGGER.info("Removing mixin container " + entry.getKey().toString());
|
||||
containers.remove(entry.getKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.gtnewhorizons.angelica.mixins;
|
||||
|
||||
import com.gtnewhorizons.angelica.AngelicaMod;
|
||||
import com.gtnewhorizons.angelica.config.AngelicaConfig;
|
||||
import com.gtnewhorizons.angelica.config.CompatConfig;
|
||||
import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
|
||||
import cpw.mods.fml.relauncher.FMLLaunchHandler;
|
||||
import jss.notfine.config.MCPatcherForgeConfig;
|
||||
@@ -26,10 +27,12 @@ public enum Mixins {
|
||||
.setPhase(Phase.EARLY).addMixinClasses(
|
||||
"angelica.MixinActiveRenderInfo"
|
||||
,"angelica.MixinEntityRenderer"
|
||||
,"angelica.MixinGameSettings"
|
||||
,"angelica.MixinMinecraft"
|
||||
,"angelica.MixinMinecraftServer"
|
||||
,"angelica.optimizations.MixinRendererLivingEntity"
|
||||
,"angelica.MixinFMLClientHandler"
|
||||
,"angelica.MixinTextureMap"
|
||||
,"angelica.bugfixes.MixinRenderGlobal_DestroyBlock"
|
||||
)
|
||||
),
|
||||
ANGELICA_VBO(
|
||||
@@ -75,6 +78,11 @@ public enum Mixins {
|
||||
.setApplyIf(() -> AngelicaConfig.dynamicItemRenderDistance)
|
||||
.addTargetedMod(TargetedMod.VANILLA)),
|
||||
|
||||
ANGELICA_ITEM_DISPLAY_LIST_OPTIMIZATION(new Builder("Optimized item rendering by wrapping them with display lists")
|
||||
.setPhase(Phase.EARLY).addMixinClasses("angelica.itemrenderer.MixinItemRenderer").setSide(Side.CLIENT)
|
||||
.setApplyIf(() -> AngelicaConfig.optimizeInWorldItemRendering_WIP)
|
||||
.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)
|
||||
.setPhase(Phase.EARLY).setApplyIf(() -> AngelicaConfig.showSplashMemoryBar && !AngelicaMod.lwjglDebug).addMixinClasses(
|
||||
@@ -83,8 +91,8 @@ public enum Mixins {
|
||||
)
|
||||
),
|
||||
|
||||
ARCHAIC_CORE(new Builder("Archaic Core").addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT)
|
||||
.setPhase(Phase.EARLY).addMixinClasses(
|
||||
ARCHAIC_CORE(new Builder("Archaic Core").addTargetedMod(TargetedMod.VANILLA).addExcludedMod(TargetedMod.ARCHAICFIX)
|
||||
.setSide(Side.CLIENT).setPhase(Phase.EARLY).addMixinClasses(
|
||||
"angelica.archaic.MixinBlockFence"
|
||||
,"angelica.archaic.MixinFMLClientHandler"
|
||||
,"angelica.archaic.MixinGuiIngameForge"
|
||||
@@ -116,19 +124,17 @@ public enum Mixins {
|
||||
,"sodium.MixinEntity_RenderDist"
|
||||
,"sodium.MixinEntityItem_RenderDist"
|
||||
,"sodium.MixinRenderManager"
|
||||
,"sodium.MixinExtendedBlockStorage"
|
||||
,"sodium.MixinEntityRenderer"
|
||||
,"sodium.MixinFMLClientHandler"
|
||||
,"sodium.MixinForgeHooksClient"
|
||||
,"sodium.MixinGameSettings"
|
||||
,"sodium.MixinFrustrum"
|
||||
,"sodium.MixinMaterial"
|
||||
,"sodium.MixinMinecraft"
|
||||
,"sodium.MixinNibbleArray"
|
||||
,"sodium.MixinRenderBlocks"
|
||||
,"sodium.MixinRenderGlobal"
|
||||
,"sodium.MixinWorldClient"
|
||||
,"sodium.MixinTileEntity"
|
||||
,"sodium.MixinTileEntityMobSpawner"
|
||||
,"sodium.MixinEffectRenderer"
|
||||
,"sodium.MixinTileEntityRendererDispatcher"
|
||||
,"sodium.MixinLongHashMap"
|
||||
@@ -146,32 +152,43 @@ public enum Mixins {
|
||||
,"shaders.MixinLocale"
|
||||
,"shaders.MixinOpenGlHelper"
|
||||
,"shaders.MixinRender"
|
||||
,"shaders.MixinRenderDragon"
|
||||
,"shaders.MixinRenderEnderman"
|
||||
,"shaders.MixinRendererLivingEntity"
|
||||
,"shaders.MixinRenderGlobal"
|
||||
,"shaders.MixinRenderSpider"
|
||||
,"shaders.MixinTileEntityBeaconRenderer"
|
||||
)
|
||||
),
|
||||
|
||||
IRIS_ACCESSORS(new Builder("Iris Accessors").addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT)
|
||||
.setPhase(Phase.EARLY).setApplyIf(() -> AngelicaConfig.enableIris).addMixinClasses(
|
||||
"shaders.accessors.MixinMinecraft"
|
||||
,"shaders.accessors.MixinEntityRenderer"
|
||||
,"shaders.accessors.MixinSimpleTexture"
|
||||
,"shaders.accessors.MixinTextureAtlasSprite"
|
||||
,"shaders.accessors.MixinTextureMap"
|
||||
,"shaders.accessors.MixinAnimationMetadataSection"
|
||||
IRIS_RENDERING_NOBACKHAND(new Builder("Iris Hand Shaders").addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT)
|
||||
.setPhase(Phase.EARLY).setApplyIf(() -> AngelicaConfig.enableIris).addExcludedMod(TargetedMod.BACKHAND).addMixinClasses(
|
||||
"shaders.MixinItemRenderer"
|
||||
)
|
||||
),
|
||||
|
||||
IRIS_RENDERING_BACKHAND(new Builder("Iris Hand Shaders (Backhand)").addTargetedMod(TargetedMod.VANILLA)
|
||||
.addTargetedMod(TargetedMod.BACKHAND).setSide(Side.CLIENT)
|
||||
.setPhase(Phase.EARLY).setApplyIf(() -> AngelicaConfig.enableIris).addMixinClasses(
|
||||
"shaders.MixinItemRendererBackhand"
|
||||
)
|
||||
),
|
||||
|
||||
IRIS_ACCESSORS(new Builder("Iris Accessors").addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT)
|
||||
.setPhase(Phase.EARLY).setApplyIf(() -> AngelicaConfig.enableIris).addMixinClasses("shaders.accessors.MixinEntityRenderer")
|
||||
),
|
||||
|
||||
ANGELICA_TEXTURE(new Builder("Textures").addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT)
|
||||
.setPhase(Phase.EARLY).setApplyIf(() -> AngelicaConfig.enableIris || AngelicaConfig.enableSodium).addMixinClasses(
|
||||
"angelica.textures.MixinTextureAtlasSprite"
|
||||
,"angelica.textures.MixinTextureUtil"
|
||||
)),
|
||||
|
||||
ANGELICA_ZOOM(new Builder("Zoom").addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT)
|
||||
.setPhase(Phase.EARLY).setApplyIf(() -> AngelicaConfig.enableZoom)
|
||||
.addMixinClasses(
|
||||
"angelica.zoom.MixinEntityRenderer_Zoom",
|
||||
"angelica.zoom.MixinMinecraft_Zoom",
|
||||
"angelica.zoom.MixinMouseFilter"
|
||||
)),
|
||||
|
||||
HUD_CACHING(new Builder("Renders the HUD elements 20 times per second maximum to improve performance")
|
||||
.addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT).setPhase(Phase.EARLY)
|
||||
.setApplyIf(() -> AngelicaConfig.enableHudCaching).addMixinClasses(
|
||||
@@ -204,9 +221,14 @@ public enum Mixins {
|
||||
"angelica.animation.MixinWorldRenderer",
|
||||
"angelica.animation.MixinRenderItem")),
|
||||
|
||||
SCALED_RESOUTION_UNICODE_FIX(new Builder("Removes unicode languages gui scaling being forced to even values").setPhase(Phase.EARLY)
|
||||
.setSide(Side.CLIENT).addTargetedMod(TargetedMod.VANILLA)
|
||||
.setApplyIf(() -> AngelicaConfig.removeUnicodeEvenScaling)
|
||||
.addMixinClasses("angelica.bugfixes.MixinScaledResolution_UnicodeFix")),
|
||||
|
||||
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)
|
||||
.setApplyIf(() -> CompatConfig.fixExtraUtils)
|
||||
.addMixinClasses(
|
||||
"client.extrautils.MixinRenderBlockConnectedTextures",
|
||||
"client.extrautils.MixinRenderBlockConnectedTexturesEthereal",
|
||||
@@ -214,7 +236,7 @@ public enum Mixins {
|
||||
|
||||
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)
|
||||
.setApplyIf(() -> CompatConfig.fixMinefactoryReloaded)
|
||||
.addMixinClasses("client.minefactoryreloaded.MixinRedNetCableRenderer")),
|
||||
|
||||
SPEEDUP_CAMPFIRE_BACKPORT_ANIMATIONS(new Builder("Add animation speedup support to Campfire Backport").setPhase(Phase.LATE)
|
||||
@@ -293,7 +315,7 @@ public enum Mixins {
|
||||
),
|
||||
NOTFINE_NO_CUSTOM_ITEM_TEXTURES(new Builder("NotFine no Custom Item Textures")
|
||||
.setSide(Side.CLIENT).setPhase(Phase.EARLY)
|
||||
.setApplyIf(() -> !AngelicaConfig.enableMCPatcherForgeFeatures || !MCPatcherForgeConfig.instance().customItemTexturesEnabled)
|
||||
.setApplyIf(() -> !AngelicaConfig.enableMCPatcherForgeFeatures || !MCPatcherForgeConfig.CustomItemTextures.enabled)
|
||||
.addTargetedMod(TargetedMod.VANILLA)
|
||||
.addMixinClasses(addPrefix("notfine.glint.",
|
||||
"MixinItemRenderer",
|
||||
@@ -377,7 +399,7 @@ public enum Mixins {
|
||||
),
|
||||
MCPATCHER_FORGE_CUSTOM_COLORS(new Builder("MCP:F Custom Colors")
|
||||
.setSide(Mixins.Side.CLIENT).setPhase(Phase.EARLY)
|
||||
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.instance().customColorsEnabled)
|
||||
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.CustomColors.enabled)
|
||||
.addTargetedMod(TargetedMod.VANILLA)
|
||||
.addMixinClasses(addPrefix("mcpatcherforge.cc.",
|
||||
"block.material.MixinMapColor",
|
||||
@@ -433,7 +455,7 @@ public enum Mixins {
|
||||
),
|
||||
MCPATCHER_FORGE_CUSTOM_ITEM_TEXTURES(new Builder("MCP:F Custom Item Textures")
|
||||
.setSide(Side.CLIENT).setPhase(Phase.EARLY)
|
||||
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.instance().customItemTexturesEnabled)
|
||||
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.CustomItemTextures.enabled)
|
||||
.addTargetedMod(TargetedMod.VANILLA)
|
||||
.addMixinClasses(addPrefix("mcpatcherforge.cit.",
|
||||
"client.renderer.entity.MixinRenderBiped",
|
||||
@@ -452,13 +474,13 @@ public enum Mixins {
|
||||
),
|
||||
MCPATCHER_FORGE_CONNECTED_TEXTURES(new Builder("MCP:F Connected Textures")
|
||||
.setSide(Side.CLIENT).setPhase(Phase.EARLY)
|
||||
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.instance().connectedTexturesEnabled)
|
||||
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.ConnectedTextures.enabled)
|
||||
.addTargetedMod(TargetedMod.VANILLA)
|
||||
.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)
|
||||
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.ExtendedHD.enabled)
|
||||
.addTargetedMod(TargetedMod.VANILLA)
|
||||
.addMixinClasses(addPrefix("mcpatcherforge.hd.",
|
||||
"MixinTextureClock",
|
||||
@@ -468,14 +490,14 @@ public enum Mixins {
|
||||
),
|
||||
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))
|
||||
.setApplyIf(() -> (AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.ExtendedHD.enabled && MCPatcherForgeConfig.ExtendedHD.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)
|
||||
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.RandomMobs.enabled)
|
||||
.addTargetedMod(TargetedMod.VANILLA)
|
||||
.addMixinClasses(addPrefix("mcpatcherforge.mob.",
|
||||
"MixinRender",
|
||||
@@ -492,7 +514,7 @@ public enum Mixins {
|
||||
),
|
||||
MCPATCHER_FORGE_SKY(new Builder("MCP:F Sky")
|
||||
.setSide(Side.CLIENT).setPhase(Phase.EARLY)
|
||||
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.instance().betterSkiesEnabled)
|
||||
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.BetterSkies.enabled)
|
||||
.addTargetedMod(TargetedMod.VANILLA)
|
||||
.addMixinClasses(addPrefix("mcpatcherforge.sky.",
|
||||
"MixinEffectRenderer",
|
||||
@@ -502,32 +524,32 @@ public enum Mixins {
|
||||
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)
|
||||
&& !MCPatcherForgeConfig.ConnectedTextures.enabled
|
||||
&& MCPatcherForgeConfig.CustomColors.enabled)
|
||||
.addTargetedMod(TargetedMod.VANILLA)
|
||||
.addMixinClasses("mcpatcherforge.cc_ctm.MixinRenderBlocksNoCTM")
|
||||
.addMixinClasses("mcpatcherforge.ctm_cc.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)
|
||||
&& MCPatcherForgeConfig.ConnectedTextures.enabled
|
||||
&& !MCPatcherForgeConfig.CustomColors.enabled)
|
||||
.addTargetedMod(TargetedMod.VANILLA)
|
||||
.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)
|
||||
&& MCPatcherForgeConfig.ConnectedTextures.enabled
|
||||
&& MCPatcherForgeConfig.CustomColors.enabled)
|
||||
.addTargetedMod(TargetedMod.VANILLA)
|
||||
.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)
|
||||
&& MCPatcherForgeConfig.ConnectedTextures.enabled
|
||||
|| MCPatcherForgeConfig.CustomColors.enabled)
|
||||
.addTargetedMod(TargetedMod.VANILLA)
|
||||
.addMixinClasses("mcpatcherforge.ctm_cc.MixinTextureMap")
|
||||
),
|
||||
@@ -570,7 +592,7 @@ public enum Mixins {
|
||||
NotFineConfig.loadSettings();
|
||||
//This may be possible to handle differently or fix.
|
||||
if(loadedCoreMods.contains("cofh.asm.LoadingPlugin")) {
|
||||
MCPatcherForgeConfig.instance().hdFont = false;
|
||||
MCPatcherForgeConfig.ExtendedHD.hdFont = false;
|
||||
}
|
||||
final List<String> mixins = new ArrayList<>();
|
||||
final List<String> notLoading = new ArrayList<>();
|
||||
|
||||
@@ -8,6 +8,7 @@ public enum TargetedMod {
|
||||
, FASTCRAFT("FastCraft", "fastcraft.Tweaker")
|
||||
, OPTIFINE("Optifine", "optifine.OptiFineForgeTweaker", "Optifine")
|
||||
, ARCHAICFIX("ArchaicFix", "org.embeddedt.archaicfix.ArchaicCore", "archaicfix")
|
||||
, BACKHAND("Backhand","xonin.backhand.coremod.BackhandLoadingPlugin", "backhand")
|
||||
, BOTANIA("Botania", null, "Botania")
|
||||
, CAMPFIRE_BACKPORT("CampfireBackport", null, "campfirebackport")
|
||||
, CHICKENCHUNKS("ChickenChunks", null, "ChickenChunks")
|
||||
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
package com.gtnewhorizons.angelica.mixins.interfaces;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mutable;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
public interface AnimationMetadataSectionAccessor {
|
||||
int getFrameWidth();
|
||||
|
||||
void setFrameWidth(int frameWidth);
|
||||
|
||||
int getFrameHeight();
|
||||
|
||||
void setFrameHeight(int frameHeight);
|
||||
}
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
package com.gtnewhorizons.angelica.mixins.interfaces;
|
||||
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
public interface ExtendedBlockStorageAccessor {
|
||||
int getYBase();
|
||||
int getBlockRefCount();
|
||||
void setBlockRefCount(int blockRefCount);
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.gtnewhorizons.angelica.mixins.interfaces;
|
||||
|
||||
public interface ExtendedNibbleArray {
|
||||
public byte[] getData();
|
||||
public int getDepthBits();
|
||||
public int getDepthBitsPlusFour();
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.gtnewhorizons.angelica.mixins.interfaces;
|
||||
|
||||
public interface IGameSettingsExt {
|
||||
boolean angelica$showFpsGraph();
|
||||
void angelica$setShowFpsGraph(boolean renderFpsGraph);
|
||||
}
|
||||
@@ -8,4 +8,5 @@ public interface ITexturesCache {
|
||||
|
||||
Set<IIcon> getRenderedTextures();
|
||||
void enableTextureTracking();
|
||||
void track(IPatchedTextureAtlasSprite sprite);
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.gtnewhorizons.angelica.mixins.interfaces;
|
||||
|
||||
import net.minecraft.util.Timer;
|
||||
|
||||
public interface MinecraftAccessor {
|
||||
Timer getTimer();
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.gtnewhorizons.angelica.mixins.interfaces;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public interface SimpleTextureAccessor {
|
||||
ResourceLocation getLocation();
|
||||
}
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
package com.gtnewhorizons.angelica.mixins.interfaces;
|
||||
|
||||
import net.minecraft.client.resources.data.AnimationMetadataSection;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface TextureAtlasSpriteAccessor {
|
||||
AnimationMetadataSection getMetadata();
|
||||
|
||||
List<int[][]> getFramesTextureData();
|
||||
|
||||
int getFrame();
|
||||
|
||||
void setFrame(int frame);
|
||||
|
||||
int getSubFrame();
|
||||
|
||||
void setSubFrame(int subFrame);
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.gtnewhorizons.angelica.mixins.interfaces;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface TextureMapAccessor {
|
||||
Map getMapUploadedSprites();
|
||||
|
||||
int getAnisotropicFiltering();
|
||||
|
||||
int getMipmapLevels();
|
||||
|
||||
ResourceLocation getLocationBlocksTexture();
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.gtnewhorizons.angelica.models;
|
||||
|
||||
import com.gtnewhorizon.gtnhlib.blockpos.BlockPos;
|
||||
import com.gtnewhorizon.gtnhlib.blockpos.IBlockPos;
|
||||
import com.gtnewhorizon.gtnhlib.client.model.ModelLoader;
|
||||
import com.gtnewhorizon.gtnhlib.client.model.Variant;
|
||||
|
||||
@@ -1,11 +1,18 @@
|
||||
package com.gtnewhorizons.angelica.proxy;
|
||||
|
||||
import static com.gtnewhorizons.angelica.loading.AngelicaTweaker.LOGGER;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.gtnewhorizon.gtnhlib.client.renderer.vertex.DefaultVertexFormat;
|
||||
import com.gtnewhorizon.gtnhlib.client.renderer.vertex.VertexFormat;
|
||||
import com.gtnewhorizons.angelica.compat.ModStatus;
|
||||
import com.gtnewhorizons.angelica.compat.bettercrashes.BetterCrashesCompat;
|
||||
import com.gtnewhorizons.angelica.config.AngelicaConfig;
|
||||
import com.gtnewhorizons.angelica.config.CompatConfig;
|
||||
import com.gtnewhorizons.angelica.debug.F3Direction;
|
||||
import com.gtnewhorizons.angelica.debug.FrametimeGraph;
|
||||
import com.gtnewhorizons.angelica.debug.TPSGraph;
|
||||
import com.gtnewhorizons.angelica.mixins.interfaces.IGameSettingsExt;
|
||||
import com.gtnewhorizons.angelica.dynamiclights.DynamicLights;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import com.gtnewhorizons.angelica.glsm.debug.OpenGLDebugging;
|
||||
@@ -14,6 +21,7 @@ import com.gtnewhorizons.angelica.models.VanillaModels;
|
||||
import com.gtnewhorizons.angelica.render.CloudRenderer;
|
||||
import com.gtnewhorizons.angelica.rendering.AngelicaBlockSafetyRegistry;
|
||||
import com.gtnewhorizons.angelica.utils.AssetLoader;
|
||||
import com.gtnewhorizons.angelica.zoom.Zoom;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
@@ -24,6 +32,9 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import cpw.mods.fml.common.registry.GameData;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import jss.notfine.core.Settings;
|
||||
import me.jellysquid.mods.sodium.client.SodiumDebugScreenHandler;
|
||||
import net.coderbot.iris.Iris;
|
||||
@@ -36,6 +47,7 @@ import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.gui.GuiMainMenu;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.network.NetHandlerPlayClient;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.server.integrated.IntegratedServer;
|
||||
import net.minecraft.util.Direction;
|
||||
@@ -51,15 +63,11 @@ import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import static com.gtnewhorizons.angelica.loading.AngelicaTweaker.LOGGER;
|
||||
|
||||
public class ClientProxy extends CommonProxy {
|
||||
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
final FrametimeGraph frametimeGraph = new FrametimeGraph();
|
||||
final TPSGraph tpsGraph = new TPSGraph();
|
||||
|
||||
@Override
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
@@ -95,8 +103,7 @@ public class ClientProxy extends CommonProxy {
|
||||
|
||||
if (AngelicaConfig.enableHudCaching) {
|
||||
FMLCommonHandler.instance().bus().register(HUDCaching.INSTANCE);
|
||||
MinecraftForge.EVENT_BUS.register(HUDCaching.INSTANCE); // TODO remove debug stuff, unused registration}
|
||||
HUDCaching.registerKeyBindings();
|
||||
MinecraftForge.EVENT_BUS.register(HUDCaching.INSTANCE);
|
||||
}
|
||||
if (AngelicaConfig.enableSodium) {
|
||||
MinecraftForge.EVENT_BUS.register(SodiumDebugScreenHandler.INSTANCE);
|
||||
@@ -129,7 +136,7 @@ public class ClientProxy extends CommonProxy {
|
||||
FMLCommonHandler.instance().bus().register(this);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
|
||||
glsmKeyBinding = new KeyBinding("Print GLSM Debug", Keyboard.KEY_NONE, "Angelica Keybinds");
|
||||
glsmKeyBinding = new KeyBinding("Print GLSM Debug", Keyboard.KEY_NONE, "Angelica");
|
||||
ClientRegistry.registerKeyBinding(glsmKeyBinding);
|
||||
|
||||
VanillaModels.init();
|
||||
@@ -137,13 +144,16 @@ public class ClientProxy extends CommonProxy {
|
||||
if (ModStatus.isBetterCrashesLoaded) {
|
||||
BetterCrashesCompat.init();
|
||||
}
|
||||
if (AngelicaConfig.enableZoom) {
|
||||
Zoom.init();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean wasGLSMKeyPressed;
|
||||
|
||||
@SubscribeEvent
|
||||
public void onKeypress(TickEvent.ClientTickEvent event) {
|
||||
final boolean isPressed = glsmKeyBinding.getKeyCode() != 0 && Keyboard.isKeyDown(glsmKeyBinding.getKeyCode());
|
||||
final boolean isPressed = glsmKeyBinding.getKeyCode() != 0 && GameSettings.isKeyDown(glsmKeyBinding);
|
||||
if (isPressed && !wasGLSMKeyPressed) {
|
||||
OpenGLDebugging.checkGLSM();
|
||||
}
|
||||
@@ -154,7 +164,7 @@ public class ClientProxy extends CommonProxy {
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
super.postInit(event);
|
||||
|
||||
if (ModStatus.isLotrLoaded && AngelicaConfig.enableSodium && AngelicaConfig.fixLotrSodiumCompat) {
|
||||
if (ModStatus.isLotrLoaded && AngelicaConfig.enableSodium && CompatConfig.fixLotr) {
|
||||
try {
|
||||
Class<?> lotrRendering = Class.forName("lotr.common.coremod.LOTRReplacedMethods$BlockRendering");
|
||||
ReflectionHelper.setPrivateValue(lotrRendering, null, new ConcurrentHashMap<>(), "naturalBlockClassTable");
|
||||
@@ -179,19 +189,30 @@ public class ClientProxy extends CommonProxy {
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.LOWEST)
|
||||
public void onRenderOverlay(RenderGameOverlayEvent.Pre event) {
|
||||
if (event.isCanceled() || !mc.gameSettings.showDebugInfo) return;
|
||||
if (AngelicaConfig.modernizeF3Screen && event.type == RenderGameOverlayEvent.ElementType.CROSSHAIRS) {
|
||||
F3Direction.renderWorldDirectionsEvent(mc, event);
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.LOWEST)
|
||||
public void onRenderOverlay(RenderGameOverlayEvent.Text event) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
if (event.isCanceled() || !mc.gameSettings.showDebugInfo || event.left.isEmpty()) return;
|
||||
|
||||
NetHandlerPlayClient cl = mc.getNetHandler();
|
||||
if (cl != null) {
|
||||
IntegratedServer srv = mc.getIntegratedServer();
|
||||
|
||||
if (srv != null) {
|
||||
String s = String.format("Integrated server @ %.0f ms ticks", lastIntegratedTickTime);
|
||||
event.left.add(1, s);
|
||||
event.left.add(Math.min(event.left.size(), 1), s);
|
||||
}
|
||||
}
|
||||
|
||||
if (AngelicaConfig.showBlockDebugInfo && mc.objectMouseOver != null && mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
|
||||
if (!event.right.isEmpty() && !Objects.firstNonNull(event.right.get(event.right.size() - 1), "").isEmpty()) event.right.add("");
|
||||
Block block = mc.theWorld.getBlock(mc.objectMouseOver.blockX, mc.objectMouseOver.blockY, mc.objectMouseOver.blockZ);
|
||||
@@ -199,6 +220,7 @@ public class ClientProxy extends CommonProxy {
|
||||
event.right.add(Block.blockRegistry.getNameForObject(block));
|
||||
event.right.add("meta: " + meta);
|
||||
}
|
||||
|
||||
if (DynamicLights.isEnabled()) {
|
||||
var builder = new StringBuilder("Dynamic Light Sources: ");
|
||||
DynamicLights dl = DynamicLights.get();
|
||||
@@ -206,6 +228,7 @@ public class ClientProxy extends CommonProxy {
|
||||
|
||||
event.right.add(builder.toString());
|
||||
}
|
||||
|
||||
if (AngelicaConfig.modernizeF3Screen) {
|
||||
boolean hasReplacedXYZ = false;
|
||||
for (int i = 0; i < event.left.size() - 3; i++) {
|
||||
@@ -246,6 +269,8 @@ public class ClientProxy extends CommonProxy {
|
||||
}
|
||||
}
|
||||
event.setCanceled(true);
|
||||
// TODO don't cancel the event and render here,
|
||||
// instead mixin into the vanilla code and add a background to it
|
||||
/* render ourselves for modern background */
|
||||
FontRenderer fontrenderer = mc.fontRenderer;
|
||||
int fontColor = 0xe0e0e0;
|
||||
@@ -268,6 +293,14 @@ public class ClientProxy extends CommonProxy {
|
||||
Gui.drawRect(strX - 1, strY - 1, strX + w + 1, strY + fontrenderer.FONT_HEIGHT - 1, rectColor);
|
||||
fontrenderer.drawString(msg, strX, strY, fontColor);
|
||||
}
|
||||
|
||||
// Draw a frametime graph
|
||||
if (((IGameSettingsExt)mc.gameSettings).angelica$showFpsGraph()) {
|
||||
frametimeGraph.render();
|
||||
if (Minecraft.getMinecraft().isSingleplayer()) {
|
||||
tpsGraph.render();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,4 +336,14 @@ public class ClientProxy extends CommonProxy {
|
||||
event.newfov = 1.0F;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putFrametime(long time) {
|
||||
frametimeGraph.putSample(time);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putTicktime(long time) {
|
||||
tpsGraph.putSample(time);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package com.gtnewhorizons.angelica.proxy;
|
||||
|
||||
import com.gtnewhorizons.angelica.common.BlockTest;
|
||||
import com.gtnewhorizons.angelica.config.AngelicaConfig;
|
||||
import com.gtnewhorizons.angelica.utils.AssetLoader;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
@@ -20,4 +19,9 @@ public class CommonProxy {
|
||||
public void init(FMLInitializationEvent event) {}
|
||||
|
||||
public void postInit(FMLPostInitializationEvent event) {}
|
||||
|
||||
// Only present on the client!
|
||||
public void putFrametime(long time) { throw new UnsupportedOperationException(); }
|
||||
|
||||
public void putTicktime(long time) { throw new UnsupportedOperationException(); }
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* This file is part of FalseTweaks.
|
||||
*
|
||||
* Copyright (C) 2022-2024 FalsePattern
|
||||
* All Rights Reserved
|
||||
*
|
||||
* Modifications by Angelica in accordance with LGPL v3.0
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* FalseTweaks is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* FalseTweaks is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with FalseTweaks. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.gtnewhorizons.angelica.rendering;
|
||||
|
||||
import com.gtnewhorizons.angelica.config.AngelicaConfig;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.val;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.renderer.GLAllocation;
|
||||
import net.minecraft.client.resources.IResourceManager;
|
||||
import net.minecraft.client.resources.IResourceManagerReloadListener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public class ItemRenderListManager implements IResourceManagerReloadListener {
|
||||
public static final ItemRenderListManager INSTANCE = new ItemRenderListManager();
|
||||
|
||||
private final Map<ItemProp, Integer> theMap = new HashMap<>();
|
||||
private final List<ItemProp> propList = new ArrayList<>();
|
||||
private final ItemProp prop = new ItemProp();
|
||||
private int list = 0;
|
||||
|
||||
public boolean pre(float a, float b, float c, float d, int e, int f, float g) {
|
||||
prop.set(a, b, c, d, e, f, g);
|
||||
if (theMap.containsKey(prop)) {
|
||||
val list = theMap.get(prop);
|
||||
propList.add(propList.remove(propList.indexOf(prop)));
|
||||
GL11.glCallList(list);
|
||||
return true;
|
||||
} else {
|
||||
if (propList.size() >= AngelicaConfig.itemRendererDisplayListCacheSize) {
|
||||
val oldProp = propList.remove(0);
|
||||
GLAllocation.deleteDisplayLists(theMap.remove(oldProp));
|
||||
}
|
||||
list = GLAllocation.generateDisplayLists(1);
|
||||
val newProp = new ItemProp(prop);
|
||||
theMap.put(newProp, list);
|
||||
propList.add(newProp);
|
||||
GL11.glNewList(list, GL11.GL_COMPILE);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void post() {
|
||||
GL11.glEndList();
|
||||
GL11.glCallList(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResourceManagerReload(IResourceManager p_110549_1_) {
|
||||
propList.clear();
|
||||
theMap.forEach((key, value) -> GLAllocation.deleteDisplayLists(value));
|
||||
theMap.clear();
|
||||
}
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class ItemProp {
|
||||
private float a;
|
||||
private float b;
|
||||
private float c;
|
||||
private float d;
|
||||
private int e;
|
||||
private int f;
|
||||
private float g;
|
||||
|
||||
public ItemProp(ItemProp old) {
|
||||
set(old.a, old.b, old.c, old.d, old.e, old.f, old.g);
|
||||
}
|
||||
|
||||
public void set(float a, float b, float c, float d, int e, int f, float g) {
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
this.c = c;
|
||||
this.d = d;
|
||||
this.e = e;
|
||||
this.f = f;
|
||||
this.g = g;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,10 @@
|
||||
package com.gtnewhorizons.angelica.rendering;
|
||||
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.joml.Matrix4f;
|
||||
import org.joml.Vector3d;
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.gtnewhorizons.angelica.transform;
|
||||
|
||||
import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
|
||||
|
||||
public class AsmUtil {
|
||||
|
||||
public static String obf(String deobf, String obf) {
|
||||
if (AngelicaTweaker.isObfEnv()) {
|
||||
return obf;
|
||||
}
|
||||
return deobf;
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
package com.gtnewhorizons.angelica.transform;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
|
||||
import net.minecraft.launchwrapper.IClassTransformer;
|
||||
import org.spongepowered.asm.lib.ClassReader;
|
||||
import org.spongepowered.asm.lib.ClassWriter;
|
||||
import org.spongepowered.asm.lib.Opcodes;
|
||||
import org.spongepowered.asm.lib.tree.ClassNode;
|
||||
import org.spongepowered.asm.lib.tree.InsnList;
|
||||
import org.spongepowered.asm.lib.tree.InsnNode;
|
||||
import org.spongepowered.asm.lib.tree.JumpInsnNode;
|
||||
import org.spongepowered.asm.lib.tree.LabelNode;
|
||||
import org.spongepowered.asm.lib.tree.MethodInsnNode;
|
||||
import org.spongepowered.asm.lib.tree.MethodNode;
|
||||
import org.spongepowered.asm.transformers.MixinClassWriter;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public class HUDCachingTransformer implements IClassTransformer, Opcodes {
|
||||
|
||||
private static final String HUDCaching = "com/gtnewhorizons/angelica/hudcaching/HUDCaching$HUDCachingHooks";
|
||||
private static final Map<String, List<String>> ReturnEarlyMethods = ImmutableMap.of(
|
||||
"thaumcraft.client.lib.RenderEventHandler", ImmutableList.of("renderOverlay"),
|
||||
"com.kentington.thaumichorizons.client.lib.RenderEventHandler", ImmutableList.of("renderOverlay")
|
||||
);
|
||||
|
||||
@Override
|
||||
public byte[] transform(String name, String transformedName, byte[] basicClass) {
|
||||
if (basicClass == null) return null;
|
||||
|
||||
if (ReturnEarlyMethods.containsKey(transformedName)) {
|
||||
ClassReader cr = new ClassReader(basicClass);
|
||||
ClassNode cn = new ClassNode();
|
||||
cr.accept(cn, 0);
|
||||
|
||||
for (String targetMethod : ReturnEarlyMethods.get(transformedName)) {
|
||||
for (MethodNode method : cn.methods) {
|
||||
if (!method.name.equals(targetMethod)) continue;
|
||||
|
||||
InsnList list = new InsnList();
|
||||
LabelNode exitLabel = new LabelNode();
|
||||
AngelicaTweaker.LOGGER.info("Injecting HUDCaching Conditional Return: " + transformedName + "#" + method.name);
|
||||
list.add(new MethodInsnNode(INVOKESTATIC, HUDCaching, "shouldReturnEarly", "()Z", false));
|
||||
list.add(new JumpInsnNode(IFEQ, exitLabel));
|
||||
if (method.desc.endsWith("Z") || method.desc.endsWith("I")) {
|
||||
list.add(new InsnNode(ICONST_0));
|
||||
list.add(new InsnNode(IRETURN));
|
||||
} else if (method.desc.endsWith("V")) {
|
||||
list.add(new InsnNode(RETURN));
|
||||
} else {
|
||||
AngelicaTweaker.LOGGER.warn("HUDCaching Conditional Return - Unknown return type: " + transformedName + "#" + method.name + ":" + method.desc);
|
||||
return basicClass;
|
||||
}
|
||||
list.add(exitLabel);
|
||||
method.instructions.insert(list);
|
||||
}
|
||||
}
|
||||
|
||||
MixinClassWriter cw = new MixinClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);
|
||||
cn.accept(cw);
|
||||
final byte[] bytes = cw.toByteArray();
|
||||
AngelicaTweaker.dumpClass(transformedName, basicClass, bytes, this);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
return basicClass;
|
||||
}
|
||||
}
|
||||
@@ -76,7 +76,6 @@ public class RedirectorTransformer implements IClassTransformer {
|
||||
"com.gtnewhorizons.angelica.transform",
|
||||
"me.eigenraven.lwjgl3ify"
|
||||
);
|
||||
private static int remaps = 0;
|
||||
|
||||
private static final Set<String> moddedBlockSubclasses = Collections.newSetFromMap(new ConcurrentHashMap<>());
|
||||
// Block owners we *shouldn't* redirect because they shadow one of our fields
|
||||
@@ -97,6 +96,7 @@ public class RedirectorTransformer implements IClassTransformer {
|
||||
glCapRedirects.put(org.lwjgl.opengl.GL11.GL_SCISSOR_TEST, "ScissorTest");
|
||||
methodRedirects.put(GL11, RedirectMap.newMap()
|
||||
.add("glAlphaFunc")
|
||||
.add("glBegin")
|
||||
.add("glBindTexture")
|
||||
.add("glBlendFunc")
|
||||
.add("glCallList")
|
||||
@@ -119,6 +119,7 @@ public class RedirectorTransformer implements IClassTransformer {
|
||||
.add("glDepthRange")
|
||||
.add("glDrawArrays")
|
||||
.add("glDrawBuffer")
|
||||
.add("glDrawElements")
|
||||
.add("glEdgeFlag")
|
||||
.add("glEndList")
|
||||
.add("glFog")
|
||||
@@ -346,7 +347,6 @@ public class RedirectorTransformer implements IClassTransformer {
|
||||
}
|
||||
changed = true;
|
||||
redirectInMethod = true;
|
||||
remaps++;
|
||||
} else if (mNode.owner.startsWith(Drawable) && mNode.name.equals("makeCurrent")) {
|
||||
mNode.setOpcode(Opcodes.INVOKESTATIC);
|
||||
mNode.owner = GLStateManager;
|
||||
@@ -367,7 +367,6 @@ public class RedirectorTransformer implements IClassTransformer {
|
||||
mNode.name = redirects.get(mNode.name);
|
||||
changed = true;
|
||||
redirectInMethod = true;
|
||||
remaps++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -421,6 +420,9 @@ public class RedirectorTransformer implements IClassTransformer {
|
||||
}
|
||||
|
||||
private static class RedirectMap<K> extends HashMap<K, K> {
|
||||
|
||||
private static final long serialVersionUID = 1712218575345511543L;
|
||||
|
||||
public static RedirectMap<String> newMap() {
|
||||
return new RedirectMap<>();
|
||||
}
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
package com.gtnewhorizons.angelica.transform.compat;
|
||||
|
||||
import com.gtnewhorizons.angelica.config.AngelicaConfig;
|
||||
import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
|
||||
import cpw.mods.fml.relauncher.FMLLaunchHandler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public enum CompatASMTransformers {
|
||||
|
||||
EXTRA_UTILITIES_ISBRH("RenderBlockColor Transformer", () -> AngelicaConfig.fixExtraUtilsSodiumCompat, Side.CLIENT,
|
||||
"com.gtnewhorizons.angelica.transform.compat.ExtraUtilsTransformer"
|
||||
),
|
||||
HUD_CACHING("HUDCaching Early Return Transformer", () -> AngelicaConfig.enableHudCaching && AngelicaConfig.enableHudCachingEventTransformer, Side.CLIENT,
|
||||
"com.gtnewhorizons.angelica.transform.HUDCachingTransformer")
|
||||
;
|
||||
|
||||
private final Supplier<Boolean> applyIf;
|
||||
private final Side side;
|
||||
private final String[] transformerClasses;
|
||||
|
||||
CompatASMTransformers(String description, Supplier<Boolean> applyIf, Side side, String... transformers) {
|
||||
this.applyIf = applyIf;
|
||||
this.side = side;
|
||||
this.transformerClasses = transformers;
|
||||
}
|
||||
|
||||
private boolean shouldBeLoaded() { return applyIf.get() && shouldLoadSide(); }
|
||||
|
||||
private boolean shouldLoadSide() {
|
||||
return side == Side.BOTH || (side == Side.SERVER && FMLLaunchHandler.side()
|
||||
.isServer())
|
||||
|| (side == Side.CLIENT && FMLLaunchHandler.side()
|
||||
.isClient());
|
||||
}
|
||||
|
||||
public static List<String> getTransformers() {
|
||||
final List<String> list = new ArrayList<>();
|
||||
for (CompatASMTransformers transformer : values()) {
|
||||
if (transformer.shouldBeLoaded()) {
|
||||
AngelicaTweaker.LOGGER.info("Loading transformer {}", (Object[]) transformer.transformerClasses);
|
||||
list.addAll(Arrays.asList(transformer.transformerClasses));
|
||||
} else {
|
||||
AngelicaTweaker.LOGGER.info("Not loading transformer {}", (Object[]) transformer.transformerClasses);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private enum Side {
|
||||
BOTH,
|
||||
CLIENT,
|
||||
SERVER
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
package com.gtnewhorizons.angelica.transform.compat;
|
||||
|
||||
import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
|
||||
import net.minecraft.launchwrapper.IClassTransformer;
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.tree.AnnotationNode;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ExtraUtilsTransformer implements IClassTransformer {
|
||||
|
||||
private static final String RenderBlockColor = "com.rwtema.extrautils.block.render.RenderBlockColor";
|
||||
private static final String RenderBlockConnectedTextures = "com.rwtema.extrautils.block.render.RenderBlockConnectedTextures";
|
||||
private static final String RenderBlockConnectedTexturesEthereal = "com.rwtema.extrautils.block.render.RenderBlockConnectedTexturesEthereal";
|
||||
private static final String RenderBlockFullBright = "com.rwtema.extrautils.block.render.RenderBlockFullBright";
|
||||
private static final String RenderBlockSpike = "com.rwtema.extrautils.block.render.RenderBlockSpike";
|
||||
|
||||
private static final List<String> transformedClasses = Arrays.asList(RenderBlockColor, RenderBlockConnectedTextures, RenderBlockConnectedTexturesEthereal, RenderBlockFullBright, RenderBlockSpike);
|
||||
|
||||
private static final Map<String, Boolean> perThreadMap = new HashMap<>();
|
||||
|
||||
static {
|
||||
perThreadMap.put(RenderBlockColor, false);
|
||||
perThreadMap.put(RenderBlockConnectedTextures, true);
|
||||
perThreadMap.put(RenderBlockConnectedTexturesEthereal, true);
|
||||
perThreadMap.put(RenderBlockFullBright, false);
|
||||
perThreadMap.put(RenderBlockSpike, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] transform(final String className, String transformedName, byte[] basicClass) {
|
||||
if (basicClass == null) return null;
|
||||
|
||||
if (!transformedClasses.contains(transformedName)) {
|
||||
return basicClass;
|
||||
}
|
||||
|
||||
AngelicaTweaker.LOGGER.info("Adding ThreadSafeISBRH for Extra Utilities to: {}", transformedName);
|
||||
|
||||
final ClassReader cr = new ClassReader(basicClass);
|
||||
final ClassNode cn = new ClassNode();
|
||||
cr.accept(cn, 0);
|
||||
|
||||
addThreadSafeISBRHAnnotation(transformedName, cn);
|
||||
|
||||
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
|
||||
cn.accept(cw);
|
||||
final byte[] bytes = cw.toByteArray();
|
||||
AngelicaTweaker.dumpClass(transformedName, basicClass, bytes, this);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public void addThreadSafeISBRHAnnotation(String transformedName, ClassNode cn) {
|
||||
|
||||
AnnotationNode isbrhAnnotation = new AnnotationNode("Lcom/gtnewhorizons/angelica/api/ThreadSafeISBRH;");
|
||||
|
||||
Boolean perThread = perThreadMap.get(transformedName);
|
||||
if (perThread == null) {
|
||||
perThread = false;
|
||||
AngelicaTweaker.LOGGER.info("Tried to add ThreadSafeISBRH annotation to {} which is missing from perThreadMap. Using false for perThread.", transformedName);
|
||||
}
|
||||
isbrhAnnotation.values = Arrays.asList("perThread", perThread);
|
||||
|
||||
if (cn.visibleAnnotations == null) {
|
||||
cn.visibleAnnotations = new ArrayList<>();
|
||||
}
|
||||
cn.visibleAnnotations.add(isbrhAnnotation);
|
||||
}
|
||||
}
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
package com.gtnewhorizons.angelica.transform.compat;
|
||||
|
||||
import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
|
||||
import com.gtnewhorizons.angelica.transform.compat.handlers.CompatHandler;
|
||||
import com.gtnewhorizons.angelica.transform.compat.transformers.generic.FieldLevelTessellatorTransformer;
|
||||
import com.gtnewhorizons.angelica.transform.compat.transformers.generic.HUDCachingEarlyReturnTransformer;
|
||||
import com.gtnewhorizons.angelica.transform.compat.transformers.generic.ThreadSafeISBRHAnnotationTransformer;
|
||||
import com.gtnewhorizons.angelica.transform.compat.transformers.generic.TileEntityNullGuardTransformer;
|
||||
import it.unimi.dsi.fastutil.objects.Object2BooleanOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
|
||||
import net.minecraft.launchwrapper.IClassTransformer;
|
||||
import org.spongepowered.asm.lib.ClassReader;
|
||||
import org.spongepowered.asm.lib.tree.ClassNode;
|
||||
import org.spongepowered.asm.transformers.MixinClassWriter;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class GenericCompatTransformer implements IClassTransformer {
|
||||
|
||||
private static final Map<String, List<String>> fieldLevelTessellator = new Object2ObjectOpenHashMap<>();
|
||||
private static final Map<String, List<String>> tileEntityNullGuard = new Object2ObjectOpenHashMap<>();
|
||||
private static final Map<String, Boolean> threadSafeIBSRH = new Object2BooleanOpenHashMap<>();
|
||||
private static final Map<String, List<String>> hudCachingEarlyReturn = new Object2ObjectOpenHashMap<>();
|
||||
|
||||
private static final Set<String> transformedClasses = new ObjectOpenHashSet<>();
|
||||
|
||||
@Override
|
||||
public byte[] transform(String name, String transformedName, byte[] basicClass) {
|
||||
if (basicClass == null) return null;
|
||||
|
||||
if (!transformedClasses.contains(transformedName)) return basicClass;
|
||||
|
||||
ClassReader cr = new ClassReader(basicClass);
|
||||
ClassNode cn = new ClassNode();
|
||||
cr.accept(cn, 0);
|
||||
|
||||
if (fieldLevelTessellator.containsKey(transformedName)) {
|
||||
FieldLevelTessellatorTransformer.transform(cn, fieldLevelTessellator.get(transformedName));
|
||||
}
|
||||
|
||||
if (tileEntityNullGuard.containsKey(transformedName)) {
|
||||
TileEntityNullGuardTransformer.transform(cn, tileEntityNullGuard.get(transformedName));
|
||||
}
|
||||
|
||||
if (threadSafeIBSRH.containsKey(transformedName)) {
|
||||
ThreadSafeISBRHAnnotationTransformer.transform(cn, threadSafeIBSRH.get(transformedName));
|
||||
}
|
||||
|
||||
if (hudCachingEarlyReturn.containsKey(transformedName)) {
|
||||
HUDCachingEarlyReturnTransformer.transform(cn, hudCachingEarlyReturn.get(transformedName));
|
||||
}
|
||||
|
||||
MixinClassWriter cw = new MixinClassWriter(MixinClassWriter.COMPUTE_MAXS | MixinClassWriter.COMPUTE_FRAMES);
|
||||
cn.accept(cw);
|
||||
final byte[] bytes = cw.toByteArray();
|
||||
AngelicaTweaker.dumpClass(transformedName, basicClass, bytes, this);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public static void register(CompatHandler handler) {
|
||||
if (handler.getFieldLevelTessellator() != null)
|
||||
fieldLevelTessellator.putAll(handler.getFieldLevelTessellator());
|
||||
if (handler.getTileEntityNullGuard() != null)
|
||||
tileEntityNullGuard.putAll(handler.getTileEntityNullGuard());
|
||||
if (handler.getThreadSafeISBRHAnnotations() != null)
|
||||
threadSafeIBSRH.putAll(handler.getThreadSafeISBRHAnnotations());
|
||||
if (handler.getHUDCachingEarlyReturn() != null)
|
||||
hudCachingEarlyReturn.putAll(handler.getHUDCachingEarlyReturn());
|
||||
}
|
||||
|
||||
public static void build() {
|
||||
transformedClasses.addAll(fieldLevelTessellator.keySet());
|
||||
transformedClasses.addAll(tileEntityNullGuard.keySet());
|
||||
transformedClasses.addAll(threadSafeIBSRH.keySet());
|
||||
transformedClasses.addAll(hudCachingEarlyReturn.keySet());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.gtnewhorizons.angelica.transform.compat.handlers;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface CompatHandler {
|
||||
|
||||
default Map<String, List<String>> getFieldLevelTessellator() {
|
||||
return null;
|
||||
}
|
||||
|
||||
default Map<String, List<String>> getTileEntityNullGuard() {
|
||||
return null;
|
||||
}
|
||||
|
||||
default Map<String, Boolean> getThreadSafeISBRHAnnotations() {
|
||||
return null;
|
||||
}
|
||||
|
||||
default Map<String, List<String>> getHUDCachingEarlyReturn() {
|
||||
return null;
|
||||
}
|
||||
|
||||
default List<String> extraTransformers() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package com.gtnewhorizons.angelica.transform.compat.handlers;
|
||||
|
||||
import com.gtnewhorizons.angelica.config.CompatConfig;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public enum CompatHandlers {
|
||||
|
||||
STACKS_ON_STACKS(() -> CompatConfig.fixStacksOnStacks, new StacksOnStacksCompatHandler()),
|
||||
EXTRA_UTILS(() -> CompatConfig.fixExtraUtils, new ExtraUtilsCompatHandler()),
|
||||
IMMERSIVE_ENGINEERING(() -> CompatConfig.fixImmersiveEngineering, new ImmersiveEngineeringCompatHandler()),
|
||||
THAUMCRAFT(() -> CompatConfig.fixThaumcraft, new ThaumcraftCompatHandler()),
|
||||
THAUMIC_HORIZONS(() -> CompatConfig.fixThaumicHorizons, new ThaumicHorizonsCompatHandler());
|
||||
|
||||
private final Supplier<Boolean> applyIf;
|
||||
private final CompatHandler handler;
|
||||
|
||||
CompatHandlers(Supplier<Boolean> applyIf, CompatHandler handler) {
|
||||
this.applyIf = applyIf;
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
private static List<CompatHandler> compatHandlers = null;
|
||||
|
||||
public static List<CompatHandler> getHandlers() {
|
||||
if (compatHandlers != null) {
|
||||
return compatHandlers;
|
||||
}
|
||||
compatHandlers = new ArrayList<>();
|
||||
for (CompatHandlers value : values()) {
|
||||
if (value.applyIf.get()) {
|
||||
compatHandlers.add(value.handler);
|
||||
}
|
||||
}
|
||||
return compatHandlers;
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.gtnewhorizons.angelica.transform.compat.handlers;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class ExtraUtilsCompatHandler implements CompatHandler {
|
||||
|
||||
@Override
|
||||
public Map<String, Boolean> getThreadSafeISBRHAnnotations() {
|
||||
return ImmutableMap.of(
|
||||
"com.rwtema.extrautils.block.render.RenderBlockColor",
|
||||
false,
|
||||
"com.rwtema.extrautils.block.render.RenderBlockConnectedTextures",
|
||||
true,
|
||||
"com.rwtema.extrautils.block.render.RenderBlockConnectedTexturesEthereal",
|
||||
true,
|
||||
"com.rwtema.extrautils.block.render.RenderBlockFullBright",
|
||||
false,
|
||||
"com.rwtema.extrautils.block.render.RenderBlockSpike",
|
||||
false);
|
||||
}
|
||||
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
package com.gtnewhorizons.angelica.transform.compat.handlers;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.gtnewhorizons.angelica.transform.compat.transformers.specific.ImmersiveEngineeringTransformer;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ImmersiveEngineeringCompatHandler implements CompatHandler {
|
||||
|
||||
@Override
|
||||
public Map<String, List<String>> getTileEntityNullGuard() {
|
||||
final List<String> renderWorldBlockExclusive = ImmutableList.of("renderWorldBlock");
|
||||
return ImmutableMap.<String, List<String>>builder()
|
||||
.put("blusunrize.immersiveengineering.client.render.BlockRenderClothDevices", renderWorldBlockExclusive)
|
||||
.put("blusunrize.immersiveengineering.client.render.BlockRenderMetalDecoration", renderWorldBlockExclusive)
|
||||
.put("blusunrize.immersiveengineering.client.render.BlockRenderMetalDevices", renderWorldBlockExclusive)
|
||||
.put("blusunrize.immersiveengineering.client.render.BlockRenderMetalDevices2", renderWorldBlockExclusive)
|
||||
.put("blusunrize.immersiveengineering.client.render.BlockRenderWoodenDecoration", renderWorldBlockExclusive)
|
||||
.put("blusunrize.immersiveengineering.client.render.BlockRenderWoodenDevices", renderWorldBlockExclusive)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Boolean> getThreadSafeISBRHAnnotations() {
|
||||
return ImmutableMap.<String, Boolean>builder()
|
||||
.put("blusunrize.immersiveengineering.client.render.BlockRenderClothDevices", false)
|
||||
.put("blusunrize.immersiveengineering.client.render.BlockRenderMetalDecoration", false)
|
||||
.put("blusunrize.immersiveengineering.client.render.BlockRenderMetalDevices", false)
|
||||
.put("blusunrize.immersiveengineering.client.render.BlockRenderMetalDevices2", false)
|
||||
.put("blusunrize.immersiveengineering.client.render.BlockRenderMetalMultiblocks", false)
|
||||
.put("blusunrize.immersiveengineering.client.render.BlockRenderStoneDevices", false)
|
||||
.put("blusunrize.immersiveengineering.client.render.BlockRenderWoodenDecoration", false)
|
||||
.put("blusunrize.immersiveengineering.client.render.BlockRenderWoodenDevices", false)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> extraTransformers() {
|
||||
return ImmutableList.of(ImmersiveEngineeringTransformer.class.getName());
|
||||
}
|
||||
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package com.gtnewhorizons.angelica.transform.compat.handlers;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.gtnewhorizons.angelica.transform.compat.transformers.specific.StacksOnStacksTransformer;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class StacksOnStacksCompatHandler implements CompatHandler {
|
||||
|
||||
@Override
|
||||
public Map<String, List<String>> getFieldLevelTessellator() {
|
||||
return ImmutableMap
|
||||
.of("com.tierzero.stacksonstacks.util.ClientUtils", ImmutableList.of("drawQuad", "drawRectangularPrism"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, List<String>> getTileEntityNullGuard() {
|
||||
return ImmutableMap
|
||||
.of("com.tierzero.stacksonstacks.client.render.RenderTilePile", ImmutableList.of("renderWorldBlock"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Boolean> getThreadSafeISBRHAnnotations() {
|
||||
return ImmutableMap.of("com.tierzero.stacksonstacks.client.render.RenderTilePile", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> extraTransformers() {
|
||||
return ImmutableList.of(StacksOnStacksTransformer.class.getName());
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.gtnewhorizons.angelica.transform.compat.handlers;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ThaumcraftCompatHandler implements CompatHandler {
|
||||
|
||||
@Override
|
||||
public Map<String, List<String>> getHUDCachingEarlyReturn() {
|
||||
return ImmutableMap.of("thaumcraft.client.lib.RenderEventHandler", ImmutableList.of("renderOverlay"));
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.gtnewhorizons.angelica.transform.compat.handlers;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ThaumicHorizonsCompatHandler implements CompatHandler {
|
||||
|
||||
@Override
|
||||
public Map<String, List<String>> getHUDCachingEarlyReturn() {
|
||||
return ImmutableMap
|
||||
.of("com.kentington.thaumichorizons.client.lib.RenderEventHandler", ImmutableList.of("renderOverlay"));
|
||||
}
|
||||
}
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
package com.gtnewhorizons.angelica.transform.compat.transformers.generic;
|
||||
|
||||
import com.gtnewhorizons.angelica.transform.AsmUtil;
|
||||
import org.spongepowered.asm.lib.Opcodes;
|
||||
import org.spongepowered.asm.lib.tree.AbstractInsnNode;
|
||||
import org.spongepowered.asm.lib.tree.ClassNode;
|
||||
import org.spongepowered.asm.lib.tree.FieldInsnNode;
|
||||
import org.spongepowered.asm.lib.tree.InsnList;
|
||||
import org.spongepowered.asm.lib.tree.LabelNode;
|
||||
import org.spongepowered.asm.lib.tree.LocalVariableNode;
|
||||
import org.spongepowered.asm.lib.tree.MethodNode;
|
||||
import org.spongepowered.asm.lib.tree.VarInsnNode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class FieldLevelTessellatorTransformer {
|
||||
|
||||
public static void transform(ClassNode cn, List<String> patchMethods) {
|
||||
for (MethodNode method : cn.methods) {
|
||||
if (patchMethods.contains(method.name)) {
|
||||
injectLocalTessellatorAndReplaceFieldUsage(method);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void injectLocalTessellatorAndReplaceFieldUsage(MethodNode mn) {
|
||||
// This part searches the instructions to see if there is any usage of a Tessellator field
|
||||
// which is NOT owned by Minecraft itself. This means anyone that caches it into a field will get caught
|
||||
// but not direct usage of Tessellator.instance.whatever()
|
||||
List<String> fields = new ArrayList<>();
|
||||
for (int i = 0; i < mn.instructions.size(); i++) {
|
||||
AbstractInsnNode in = mn.instructions.get(i);
|
||||
if (in instanceof FieldInsnNode fin) {
|
||||
if ((fin.getOpcode() == Opcodes.GETSTATIC || fin.getOpcode() == Opcodes.GETFIELD)
|
||||
&& fin.desc.equals("Lnet/minecraft/client/renderer/Tessellator;")
|
||||
&& !fin.owner.equals("net/minecraft/client/renderer/Tessellator")) {
|
||||
fields.add(fin.owner + ";" + fin.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fields.isEmpty()) return;
|
||||
|
||||
// Injects a new local to store our new local Tessellator in
|
||||
int localIndex = mn.maxLocals;
|
||||
LabelNode startLabel = new LabelNode();
|
||||
LabelNode endLabel = new LabelNode();
|
||||
LocalVariableNode tesNode = new LocalVariableNode(
|
||||
"tes",
|
||||
"Lnet/minecraft/client/renderer/Tessellator;",
|
||||
null,
|
||||
startLabel,
|
||||
endLabel,
|
||||
localIndex);
|
||||
mn.localVariables.add(tesNode);
|
||||
|
||||
// Actually initialize the new local Tessellator
|
||||
InsnList list = new InsnList();
|
||||
list.add(startLabel);
|
||||
list.add(
|
||||
new FieldInsnNode(
|
||||
Opcodes.GETSTATIC,
|
||||
"net/minecraft/client/renderer/Tessellator",
|
||||
AsmUtil.obf("instance", "field_78398_a"),
|
||||
"Lnet/minecraft/client/renderer/Tessellator;"));
|
||||
list.add(new VarInsnNode(Opcodes.ASTORE, localIndex));
|
||||
mn.instructions.insert(list);
|
||||
|
||||
// This searches through all the instructions and finds usage of the previously discovered fields, then it
|
||||
// replaces them
|
||||
// with an ALOAD for our new local instead of the GETSTATIC/GETFIELD
|
||||
for (int i = 0; i < mn.instructions.size(); i++) {
|
||||
AbstractInsnNode in = mn.instructions.get(i);
|
||||
if (in instanceof FieldInsnNode fin) {
|
||||
String hash = fin.owner + ";" + fin.name;
|
||||
if ((fin.getOpcode() == Opcodes.GETSTATIC || fin.getOpcode() == Opcodes.GETFIELD)
|
||||
&& fin.desc.equals("Lnet/minecraft/client/renderer/Tessellator;")
|
||||
&& fields.contains(hash)) {
|
||||
mn.instructions.insertBefore(in, new VarInsnNode(Opcodes.ALOAD, localIndex));
|
||||
mn.instructions.remove(in);
|
||||
}
|
||||
}
|
||||
}
|
||||
mn.instructions.add(endLabel);
|
||||
}
|
||||
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
package com.gtnewhorizons.angelica.transform.compat.transformers.generic;
|
||||
|
||||
import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
|
||||
import org.spongepowered.asm.lib.Opcodes;
|
||||
import org.spongepowered.asm.lib.tree.ClassNode;
|
||||
import org.spongepowered.asm.lib.tree.InsnList;
|
||||
import org.spongepowered.asm.lib.tree.InsnNode;
|
||||
import org.spongepowered.asm.lib.tree.JumpInsnNode;
|
||||
import org.spongepowered.asm.lib.tree.LabelNode;
|
||||
import org.spongepowered.asm.lib.tree.MethodInsnNode;
|
||||
import org.spongepowered.asm.lib.tree.MethodNode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class HUDCachingEarlyReturnTransformer {
|
||||
|
||||
private static final String HUDCaching = "com/gtnewhorizons/angelica/hudcaching/HUDCaching$HUDCachingHooks";
|
||||
|
||||
public static void transform(ClassNode cn, List<String> patchMethods) {
|
||||
for (MethodNode method : cn.methods) {
|
||||
if (patchMethods.contains(method.name)) {
|
||||
InsnList list = new InsnList();
|
||||
LabelNode exitLabel = new LabelNode();
|
||||
list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, HUDCaching, "shouldReturnEarly", "()Z", false));
|
||||
list.add(new JumpInsnNode(Opcodes.IFEQ, exitLabel));
|
||||
if (method.desc.endsWith("Z") || method.desc.endsWith("I")) {
|
||||
list.add(new InsnNode(Opcodes.ICONST_0));
|
||||
list.add(new InsnNode(Opcodes.IRETURN));
|
||||
} else if (method.desc.endsWith("V")) {
|
||||
list.add(new InsnNode(Opcodes.RETURN));
|
||||
} else {
|
||||
AngelicaTweaker.LOGGER.warn(
|
||||
"HUDCaching Conditional Return - Unknown return type: {}#{}:{}", cn.name, method.name, method.desc
|
||||
);
|
||||
return;
|
||||
}
|
||||
list.add(exitLabel);
|
||||
method.instructions.insert(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.gtnewhorizons.angelica.transform.compat.transformers.generic;
|
||||
|
||||
import org.spongepowered.asm.lib.tree.AnnotationNode;
|
||||
import org.spongepowered.asm.lib.tree.ClassNode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class ThreadSafeISBRHAnnotationTransformer {
|
||||
|
||||
public static void transform(ClassNode cn, boolean perThread) {
|
||||
if (cn.visibleAnnotations == null) {
|
||||
cn.visibleAnnotations = new ArrayList<>();
|
||||
}
|
||||
|
||||
AnnotationNode isbrhAnnotation = new AnnotationNode("Lcom/gtnewhorizons/angelica/api/ThreadSafeISBRH;");
|
||||
isbrhAnnotation.values = Arrays.asList("perThread", perThread);
|
||||
cn.visibleAnnotations.add(isbrhAnnotation);
|
||||
}
|
||||
}
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
package com.gtnewhorizons.angelica.transform.compat.transformers.generic;
|
||||
|
||||
import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
|
||||
import com.gtnewhorizons.angelica.transform.AsmUtil;
|
||||
import org.spongepowered.asm.lib.Opcodes;
|
||||
import org.spongepowered.asm.lib.tree.AbstractInsnNode;
|
||||
import org.spongepowered.asm.lib.tree.ClassNode;
|
||||
import org.spongepowered.asm.lib.tree.InsnList;
|
||||
import org.spongepowered.asm.lib.tree.InsnNode;
|
||||
import org.spongepowered.asm.lib.tree.JumpInsnNode;
|
||||
import org.spongepowered.asm.lib.tree.LabelNode;
|
||||
import org.spongepowered.asm.lib.tree.MethodInsnNode;
|
||||
import org.spongepowered.asm.lib.tree.MethodNode;
|
||||
import org.spongepowered.asm.lib.tree.TypeInsnNode;
|
||||
import org.spongepowered.asm.lib.tree.VarInsnNode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TileEntityNullGuardTransformer {
|
||||
|
||||
public static void transform(ClassNode cn, List<String> patchMethods) {
|
||||
for (MethodNode method : cn.methods) {
|
||||
if (patchMethods.contains(method.name)) {
|
||||
injectGetTileEntityNullGuard(method);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void injectGetTileEntityNullGuard(MethodNode mn) {
|
||||
/*
|
||||
* Searching for the following pattern:
|
||||
* L0 {
|
||||
* ...
|
||||
* INVOKEINTERFACE net/minecraft/world/IBlockAccess.getTileEntity(III)Lnet/minecraft/tileentity/TileEntity;
|
||||
* CHECKCAST *
|
||||
* ASTORE x
|
||||
* }
|
||||
* L1 {...
|
||||
* Then injecting the following after the ASTORE such that we get
|
||||
* L0 {
|
||||
* ASTORE x
|
||||
* ALOAD x
|
||||
* IFNONNULL L1
|
||||
* ICONST_0
|
||||
* IRETURN
|
||||
* }
|
||||
* L1 {...
|
||||
* Ultimately this converts:
|
||||
* MyTileEntity tile = (MyTileEntity) world.getTileEntity(x, y, z);
|
||||
* doSomethingWithTileEntity(tile);
|
||||
* into:
|
||||
* MyTileEntity tile = (MyTileEntity) world.getTileEntity(x, y, z);
|
||||
* if (tile == null) {
|
||||
* return false;
|
||||
* } else {
|
||||
* doSomethingWithTileEntity(tile);
|
||||
* }
|
||||
*/
|
||||
for (int i = 0; i < mn.instructions.size(); i++) {
|
||||
AbstractInsnNode in = mn.instructions.get(i);
|
||||
if (in instanceof MethodInsnNode min) {
|
||||
if (min.getOpcode() == Opcodes.INVOKEINTERFACE
|
||||
&& min.name.equals(AsmUtil.obf("getTileEntity", "func_147438_o"))
|
||||
&& min.owner.equals("net/minecraft/world/IBlockAccess")) {
|
||||
AbstractInsnNode castNodeAbstract = min.getNext();
|
||||
if (castNodeAbstract instanceof TypeInsnNode castNodeType) {
|
||||
if (castNodeType.getOpcode() == Opcodes.CHECKCAST) {
|
||||
AbstractInsnNode astoreNodeAbstract = castNodeType.getNext();
|
||||
if (astoreNodeAbstract instanceof VarInsnNode astoreNodeVar) {
|
||||
if (astoreNodeVar.getOpcode() == Opcodes.ASTORE) {
|
||||
InsnList list = new InsnList();
|
||||
LabelNode exit = new LabelNode();
|
||||
list.add(new VarInsnNode(Opcodes.ALOAD, astoreNodeVar.var));
|
||||
list.add(new JumpInsnNode(Opcodes.IFNONNULL, exit));
|
||||
if (mn.desc.endsWith("Z") || mn.desc.endsWith("I")) {
|
||||
list.add(new InsnNode(Opcodes.ICONST_0));
|
||||
list.add(new InsnNode(Opcodes.IRETURN));
|
||||
} else if (mn.desc.endsWith("V")) {
|
||||
list.add(new InsnNode(Opcodes.RETURN));
|
||||
} else {
|
||||
AngelicaTweaker.LOGGER.warn("TileEntityNullGuard - Unknown Return Type: {}:{}", mn.name, mn.desc);
|
||||
return;
|
||||
}
|
||||
list.add(exit);
|
||||
mn.instructions.insert(astoreNodeVar, list);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
package com.gtnewhorizons.angelica.transform.compat.transformers.specific;
|
||||
|
||||
import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
|
||||
import net.minecraft.launchwrapper.IClassTransformer;
|
||||
import org.spongepowered.asm.lib.ClassReader;
|
||||
import org.spongepowered.asm.lib.Opcodes;
|
||||
import org.spongepowered.asm.lib.tree.AbstractInsnNode;
|
||||
import org.spongepowered.asm.lib.tree.ClassNode;
|
||||
import org.spongepowered.asm.lib.tree.FieldInsnNode;
|
||||
import org.spongepowered.asm.lib.tree.InsnNode;
|
||||
import org.spongepowered.asm.lib.tree.JumpInsnNode;
|
||||
import org.spongepowered.asm.lib.tree.MethodInsnNode;
|
||||
import org.spongepowered.asm.lib.tree.MethodNode;
|
||||
import org.spongepowered.asm.transformers.MixinClassWriter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ImmersiveEngineeringTransformer implements IClassTransformer {
|
||||
|
||||
private static final String BlockRenderClothDevices = "blusunrize.immersiveengineering.client.render.BlockRenderClothDevices";
|
||||
private static final String BlockRenderMetalDevices2 = "blusunrize.immersiveengineering.client.render.BlockRenderMetalDevices2";
|
||||
private static final String BlockRenderStoneDevices = "blusunrize.immersiveengineering.client.render.BlockRenderStoneDevices";
|
||||
private static final String ClientUtils = "blusunrize.immersiveengineering.client.ClientUtils";
|
||||
|
||||
private static final List<String> transformedClasses = new ArrayList<>();
|
||||
|
||||
private static final List<String> staticRenderPassPatches = new ArrayList<>();
|
||||
|
||||
static {
|
||||
transformedClasses.add(BlockRenderClothDevices);
|
||||
transformedClasses.add(BlockRenderMetalDevices2);
|
||||
transformedClasses.add(BlockRenderStoneDevices);
|
||||
transformedClasses.add(ClientUtils);
|
||||
|
||||
staticRenderPassPatches.add(BlockRenderClothDevices);
|
||||
staticRenderPassPatches.add(BlockRenderMetalDevices2);
|
||||
staticRenderPassPatches.add(BlockRenderStoneDevices);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] transform(String name, String transformedName, byte[] basicClass) {
|
||||
if (basicClass == null) return null;
|
||||
|
||||
if (!transformedClasses.contains(transformedName)) return basicClass;
|
||||
|
||||
final ClassReader cr = new ClassReader(basicClass);
|
||||
final ClassNode cn = new ClassNode();
|
||||
cr.accept(cn, 0);
|
||||
|
||||
if (transformedName.equals(ClientUtils)) {
|
||||
transformClientUtils(cn);
|
||||
}
|
||||
|
||||
if (staticRenderPassPatches.contains(transformedName)) {
|
||||
staticRenderPassPatcher(cn);
|
||||
}
|
||||
|
||||
MixinClassWriter cw = new MixinClassWriter(MixinClassWriter.COMPUTE_FRAMES);
|
||||
cn.accept(cw);
|
||||
final byte[] bytes = cw.toByteArray();
|
||||
AngelicaTweaker.LOGGER.info("[AngelicaCompat]Extra Transformers: Applied ImmersiveEngineeringTransformer");
|
||||
AngelicaTweaker.dumpClass(transformedName, basicClass, bytes, this);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
private void staticRenderPassPatcher(ClassNode cn) {
|
||||
for (MethodNode mn : cn.methods) {
|
||||
if (mn.name.equals("renderWorldBlock")) {
|
||||
for (int i = 0; i < mn.instructions.size(); i++) {
|
||||
AbstractInsnNode ain = mn.instructions.get(i);
|
||||
// So far every one of these has been named renderPass, eventually might need to make the name dynamic and possibly care about owner?
|
||||
// Maybe this is common in other mods, possibly could generalize this transformation further if it comes up more.
|
||||
if (ain instanceof FieldInsnNode fin && fin.getOpcode() == Opcodes.GETSTATIC && fin.name.equals("renderPass")) {
|
||||
MethodInsnNode getRenderPass = new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraftforge/client/ForgeHooksClient", "getWorldRenderPass", "()I");
|
||||
mn.instructions.insert(fin, getRenderPass);
|
||||
mn.instructions.remove(fin);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void transformClientUtils(ClassNode cn) {
|
||||
for (MethodNode mn : cn.methods) {
|
||||
// This patches an if (world != null) check to just be if (false) in order to make the block of code not run
|
||||
// The block of code in question calls OpenGL to update the lightmap texture coordinates, which is illegal from an ISBRH
|
||||
// in Angelica. It doesn't seem to make anything not work by causing this to not happen.
|
||||
if (mn.name.equals("renderStaticWavefrontModelWithIcon") || mn.name.equals("renderStaticWavefrontModel")) {
|
||||
if (
|
||||
mn.desc.equals("(Lnet/minecraft/world/IBlockAccess;IIILnet/minecraftforge/client/model/obj/WavefrontObject;Lnet/minecraft/util/IIcon;Lnet/minecraft/client/renderer/Tessellator;Lblusunrize/immersiveengineering/common/util/chickenbones/Matrix4;Lblusunrize/immersiveengineering/common/util/chickenbones/Matrix4;IZFFF[Ljava/lang/String;)V")
|
||||
|| mn.desc.equals("(Lnet/minecraft/world/IBlockAccess;IIILnet/minecraftforge/client/model/obj/WavefrontObject;Lnet/minecraft/client/renderer/Tessellator;Lblusunrize/immersiveengineering/common/util/chickenbones/Matrix4;Lblusunrize/immersiveengineering/common/util/chickenbones/Matrix4;IZFFF[Ljava/lang/String;)V")
|
||||
) {
|
||||
for (int i = 0; i < mn.instructions.size(); i++) {
|
||||
AbstractInsnNode ain = mn.instructions.get(i);
|
||||
if (ain instanceof JumpInsnNode jump && jump.getOpcode() == Opcodes.IFNULL) {
|
||||
InsnNode iconst = new InsnNode(Opcodes.ICONST_0);
|
||||
jump.setOpcode(Opcodes.IFEQ);
|
||||
mn.instructions.insertBefore(jump, iconst);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+165
@@ -0,0 +1,165 @@
|
||||
package com.gtnewhorizons.angelica.transform.compat.transformers.specific;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
|
||||
import net.minecraft.launchwrapper.IClassTransformer;
|
||||
import org.spongepowered.asm.lib.ClassReader;
|
||||
import org.spongepowered.asm.lib.ClassWriter;
|
||||
import org.spongepowered.asm.lib.Opcodes;
|
||||
import org.spongepowered.asm.lib.tree.AbstractInsnNode;
|
||||
import org.spongepowered.asm.lib.tree.ClassNode;
|
||||
import org.spongepowered.asm.lib.tree.FieldInsnNode;
|
||||
import org.spongepowered.asm.lib.tree.FieldNode;
|
||||
import org.spongepowered.asm.lib.tree.InsnList;
|
||||
import org.spongepowered.asm.lib.tree.InsnNode;
|
||||
import org.spongepowered.asm.lib.tree.LabelNode;
|
||||
import org.spongepowered.asm.lib.tree.MethodInsnNode;
|
||||
import org.spongepowered.asm.lib.tree.MethodNode;
|
||||
import org.spongepowered.asm.lib.tree.TypeInsnNode;
|
||||
import org.spongepowered.asm.lib.tree.VarInsnNode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class StacksOnStacksTransformer implements IClassTransformer {
|
||||
|
||||
private static final String RenderTilePile = "com.tierzero.stacksonstacks.client.render.RenderTilePile";
|
||||
private static final List<String> staticRemovers = ImmutableList.of("ingotRender", "gemRender", "dustRender");
|
||||
|
||||
private static final String ClientUtils = "com.tierzero.stacksonstacks.util.ClientUtils";
|
||||
|
||||
@Override
|
||||
public byte[] transform(String name, String transformedName, byte[] basicClass) {
|
||||
if (basicClass == null) return null;
|
||||
|
||||
if (!transformedName.equals(RenderTilePile) && !transformedName.equals(ClientUtils)) return basicClass;
|
||||
|
||||
final ClassReader cr = new ClassReader(basicClass);
|
||||
final ClassNode cn = new ClassNode();
|
||||
cr.accept(cn, 0);
|
||||
|
||||
if (transformedName.equals(RenderTilePile)) {
|
||||
transformRenderTilePile(cn);
|
||||
} else {
|
||||
transformClientUtils(cn);
|
||||
}
|
||||
|
||||
ClassWriter cw = new ClassWriter(0);
|
||||
cn.accept(cw);
|
||||
final byte[] bytes = cw.toByteArray();
|
||||
AngelicaTweaker.LOGGER.info("[AngelicaCompat]Extra Transformers: Applied StacksOnStacksTransformer");
|
||||
AngelicaTweaker.dumpClass(transformedName, basicClass, bytes, this);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Injects initializers for the field level PileRender objects which used to be static into the <init>
|
||||
*/
|
||||
private static InsnList buildPilerRenderInitializer(String type) {
|
||||
LabelNode start = new LabelNode();
|
||||
LabelNode end = new LabelNode();
|
||||
InsnList list = new InsnList();
|
||||
list.add(start);
|
||||
list.add(new VarInsnNode(Opcodes.ALOAD, 0));
|
||||
list.add(new TypeInsnNode(Opcodes.NEW, "com/tierzero/stacksonstacks/client/render/PileRender" + type));
|
||||
list.add(new InsnNode(Opcodes.DUP));
|
||||
list.add(
|
||||
new MethodInsnNode(
|
||||
Opcodes.INVOKESPECIAL,
|
||||
"com/tierzero/stacksonstacks/client/render/PileRender" + type,
|
||||
"<init>",
|
||||
"()V"));
|
||||
list.add(
|
||||
new FieldInsnNode(
|
||||
Opcodes.PUTFIELD,
|
||||
"com/tierzero/stacksonstacks/client/render/RenderTilePile",
|
||||
type.toLowerCase() + "Render",
|
||||
"Lcom/tierzero/stacksonstacks/client/render/PileRender;"));
|
||||
list.add(end);
|
||||
return list;
|
||||
}
|
||||
|
||||
private static void transformRenderTilePile(ClassNode cn) {
|
||||
MethodNode clinit = null;
|
||||
for (MethodNode mn : cn.methods) {
|
||||
// Handles injecting field initializers for the various PileRender fields which used to be static
|
||||
// but we're removing <clinit> entirely and doing the initialization in <init>
|
||||
if (mn.name.equals("<init>")) {
|
||||
AbstractInsnNode objectInsn = null;
|
||||
// This removes the early return, and gets a reference to the self initialization so we can insert after
|
||||
for (int i = 0; i < mn.instructions.size(); i++) {
|
||||
AbstractInsnNode ain = mn.instructions.get(i);
|
||||
if (ain.getOpcode() == Opcodes.RETURN) mn.instructions.remove(ain);
|
||||
if (ain.getOpcode() == Opcodes.INVOKESPECIAL) objectInsn = mn.instructions.get(i);
|
||||
}
|
||||
// Build the initializer InsnLists and then insert them in reverse order, such that the dustRender comes
|
||||
// last
|
||||
// because we are adding the return opcode back in as part of that one's InsnList
|
||||
InsnList ingotRender = buildPilerRenderInitializer("Ingot");
|
||||
InsnList gemRender = buildPilerRenderInitializer("Gem");
|
||||
InsnList dustRender = buildPilerRenderInitializer("Dust");
|
||||
dustRender.add(new InsnNode(Opcodes.RETURN));
|
||||
mn.instructions.insert(objectInsn, dustRender);
|
||||
mn.instructions.insert(objectInsn, gemRender);
|
||||
mn.instructions.insert(objectInsn, ingotRender);
|
||||
}
|
||||
// Just catching the MethodNode for <clinit> so we can remove it later after we're done iterating
|
||||
if (mn.name.equals("<clinit>")) {
|
||||
clinit = mn;
|
||||
}
|
||||
if (mn.name.equals("renderWorldBlock")) {
|
||||
for (int i = 0; i < mn.instructions.size(); i++) {
|
||||
AbstractInsnNode in = mn.instructions.get(i);
|
||||
// This part removes the GETSTATIC for the field level PileRender objects which used to be static,
|
||||
// and replaces them with
|
||||
// a non-static GETFIELD
|
||||
if (in instanceof FieldInsnNode fin) {
|
||||
if (fin.getOpcode() == Opcodes.GETSTATIC && staticRemovers.contains(fin.name)) {
|
||||
FieldInsnNode nonStatic = new FieldInsnNode(
|
||||
Opcodes.GETFIELD,
|
||||
"com/tierzero/stacksonstacks/client/render/RenderTilePile",
|
||||
fin.name,
|
||||
"Lcom/tierzero/stacksonstacks/client/render/PileRender;");
|
||||
mn.instructions.insertBefore(fin, new VarInsnNode(Opcodes.ALOAD, 0));
|
||||
mn.instructions.insertBefore(fin, nonStatic);
|
||||
mn.instructions.remove(fin);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Remove clinit after iterating. Nothing else happens in here besides the field initialization, so no reason to
|
||||
// drill down
|
||||
// into the instructions
|
||||
if (clinit != null) cn.methods.remove(clinit);
|
||||
|
||||
// Remove the static access bits from the desired field names
|
||||
for (FieldNode fn : cn.fields) {
|
||||
if (staticRemovers.contains(fn.name)) {
|
||||
fn.access = fn.access & (~Opcodes.ACC_STATIC);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void transformClientUtils(ClassNode cn) {
|
||||
// Various things throughout the ISBRH call these functions which in turn call GL11.glPush/PopMatrix
|
||||
// Upon checking, these aren't called anywhere but in the ISBRH, and they're entirely unnecessary in there.
|
||||
// This just makes the methods no-op, since they aren't required by any other part of the mod to be working.
|
||||
for (MethodNode mn : cn.methods) {
|
||||
if (mn.name.equals("pushMatrix")) {
|
||||
for (int i = 0; i < mn.instructions.size(); i++) {
|
||||
AbstractInsnNode in = mn.instructions.get(i);
|
||||
if (in.getOpcode() == Opcodes.INVOKESTATIC) {
|
||||
mn.instructions.remove(in);
|
||||
}
|
||||
}
|
||||
} else if (mn.name.equals("popMatrix")) {
|
||||
for (int i = 0; i < mn.instructions.size(); i++) {
|
||||
AbstractInsnNode in = mn.instructions.get(i);
|
||||
if (in.getOpcode() == Opcodes.INVOKESTATIC) {
|
||||
mn.instructions.remove(in);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.gtnewhorizons.angelica.utils;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
|
||||
import com.gtnewhorizons.angelica.mixins.interfaces.IPatchedTextureAtlasSprite;
|
||||
import com.gtnewhorizons.angelica.mixins.interfaces.ITexturesCache;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -28,4 +30,26 @@ public class AnimationsRenderUtils {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final static ThreadLocal<ArrayDeque<ITexturesCache>> TEXTURE_CACHE_STACK = ThreadLocal.withInitial(ArrayDeque::new);
|
||||
|
||||
public static void onSpriteUsed(IPatchedTextureAtlasSprite sprite) {
|
||||
ArrayDeque<ITexturesCache> stack = TEXTURE_CACHE_STACK.get();
|
||||
|
||||
if (stack == null || stack.isEmpty()) {
|
||||
// icon was used outside of chunk building, it's probably an item in an inventory or something
|
||||
sprite.markNeedsAnimationUpdate();
|
||||
return;
|
||||
}
|
||||
|
||||
stack.peek().track(sprite);
|
||||
}
|
||||
|
||||
public static void pushCache(ITexturesCache cache) {
|
||||
TEXTURE_CACHE_STACK.get().push(cache);
|
||||
}
|
||||
|
||||
public static void popCache() {
|
||||
TEXTURE_CACHE_STACK.get().pop();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.gtnewhorizons.angelica.zoom;
|
||||
|
||||
public interface IMouseFilterExt {
|
||||
void angelica$reset();
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.gtnewhorizons.angelica.zoom;
|
||||
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.InputEvent;
|
||||
import lombok.Getter;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
public class Zoom {
|
||||
|
||||
@Getter
|
||||
private static float zoom = 4.0F;
|
||||
@Getter
|
||||
private static final KeyBinding zoomKey = new KeyBinding("Zoom", 0, "key.categories.misc");
|
||||
|
||||
public static final float ZOOM_MIN = 1.0F;
|
||||
public static final float ZOOM_MAX = 64.0F;
|
||||
public static final float ZOOM_STEP = 1.2F;
|
||||
|
||||
private static boolean lastSmoothCameraState = false;
|
||||
|
||||
public static void init() {
|
||||
ClientRegistry.registerKeyBinding(zoomKey);
|
||||
FMLCommonHandler.instance().bus().register(new Zoom());
|
||||
}
|
||||
|
||||
public static void modifyZoom(int eventDWheel) {
|
||||
if (eventDWheel == 0) return;
|
||||
zoom = MathHelper.clamp_float((float) (zoom * Math.pow(ZOOM_STEP, Integer.signum(eventDWheel))), ZOOM_MIN, ZOOM_MAX);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onKeyPress(InputEvent.KeyInputEvent e) {
|
||||
final int keyCode = zoomKey.getKeyCode();
|
||||
if (keyCode == 0 || Keyboard.getEventKey() != keyCode || Keyboard.isRepeatEvent()) return;
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
if (Keyboard.getEventKeyState()) {
|
||||
lastSmoothCameraState = mc.gameSettings.smoothCamera;
|
||||
mc.gameSettings.smoothCamera = true;
|
||||
} else {
|
||||
zoom = 4.0F;
|
||||
if (mc.gameSettings.smoothCamera != lastSmoothCameraState) {
|
||||
((IMouseFilterExt) mc.entityRenderer.mouseFilterXAxis).angelica$reset();
|
||||
((IMouseFilterExt) mc.entityRenderer.mouseFilterYAxis).angelica$reset();
|
||||
}
|
||||
mc.gameSettings.smoothCamera = lastSmoothCameraState;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.prupe.mcpatcher;
|
||||
|
||||
import jss.notfine.config.MCPatcherForgeConfig;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Formatter;
|
||||
@@ -8,10 +10,10 @@ import java.util.logging.Level;
|
||||
import java.util.logging.LogRecord;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import jss.notfine.config.MCPatcherForgeConfig;
|
||||
|
||||
public class MCLogger {
|
||||
|
||||
private static final org.apache.logging.log4j.Logger MAIN_LOGGER = org.apache.logging.log4j.LogManager.getLogger("MCPatcherForge");
|
||||
|
||||
private static final Map<String, MCLogger> allLoggers = new HashMap<>();
|
||||
|
||||
public static final Level ERROR = new ErrorLevel();
|
||||
@@ -44,16 +46,15 @@ public class MCLogger {
|
||||
private MCLogger(Category category, String logPrefix) {
|
||||
this.logPrefix = logPrefix;
|
||||
logger = Logger.getLogger(category.name);
|
||||
MCPatcherForgeConfig config = MCPatcherForgeConfig.instance();
|
||||
logger.setLevel(Level.parse(switch (category) {
|
||||
case CUSTOM_COLORS -> config.customColorsLoggingLevel;
|
||||
case CUSTOM_ITEM_TEXTURES -> config.customItemTexturesLoggingLevel;
|
||||
case CONNECTED_TEXTURES -> config.connectedTexturesLoggingLevel;
|
||||
case EXTENDED_HD -> config.extendedHDLoggingLevel;
|
||||
case RANDOM_MOBS -> config.randomMobsLoggingLevel;
|
||||
case BETTER_SKIES -> config.betterSkiesLoggingLevel;
|
||||
default -> Level.INFO.getName();
|
||||
}));
|
||||
logger.setLevel(switch (category) {
|
||||
case CUSTOM_COLORS -> MCPatcherForgeConfig.CustomColors.logging.level;
|
||||
case CUSTOM_ITEM_TEXTURES -> MCPatcherForgeConfig.CustomItemTextures.logging.level;
|
||||
case CONNECTED_TEXTURES -> MCPatcherForgeConfig.ConnectedTextures.logging.level;
|
||||
case EXTENDED_HD -> MCPatcherForgeConfig.ExtendedHD.logging.level;
|
||||
case RANDOM_MOBS -> MCPatcherForgeConfig.RandomMobs.logging.level;
|
||||
case BETTER_SKIES -> MCPatcherForgeConfig.BetterSkies.logging.level;
|
||||
default -> Level.INFO;
|
||||
});
|
||||
|
||||
logger.setUseParentHandlers(false);
|
||||
logger.addHandler(new Handler() {
|
||||
@@ -72,14 +73,14 @@ public class MCLogger {
|
||||
prefix.append("\n");
|
||||
message = message.substring(1);
|
||||
}
|
||||
return prefix + "[" + MCLogger.this.logPrefix + "] " + level.toString() + ": " + message;
|
||||
return prefix + "[" + MCLogger.this.logPrefix + "/" + level.toString() + "]: " + message;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void publish(LogRecord record) {
|
||||
System.out.println(formatter.format(record));
|
||||
MAIN_LOGGER.info(formatter.format(record));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -171,6 +172,8 @@ public class MCLogger {
|
||||
|
||||
private static class ErrorLevel extends Level {
|
||||
|
||||
private static final long serialVersionUID = 3987750897854233321L;
|
||||
|
||||
protected ErrorLevel() {
|
||||
super("ERROR", (Level.WARNING.intValue() + Level.SEVERE.intValue()) / 2);
|
||||
}
|
||||
|
||||
@@ -34,14 +34,14 @@ public class ColorizeBlock {
|
||||
|
||||
private static final MCLogger logger = MCLogger.getLogger(MCLogger.Category.CUSTOM_COLORS);
|
||||
|
||||
private static final boolean useWaterColors = MCPatcherForgeConfig.instance().ccWater;
|
||||
private static final boolean useTreeColors = MCPatcherForgeConfig.instance().ccTree;
|
||||
private static final boolean useRedstoneColors = MCPatcherForgeConfig.instance().ccRedstone;
|
||||
private static final boolean useStemColors = MCPatcherForgeConfig.instance().ccStem;
|
||||
private static final boolean useBlockColors = MCPatcherForgeConfig.instance().ccOtherBlocks;
|
||||
private static final boolean useWaterColors = MCPatcherForgeConfig.CustomColors.water;
|
||||
private static final boolean useTreeColors = MCPatcherForgeConfig.CustomColors.tree;
|
||||
private static final boolean useRedstoneColors = MCPatcherForgeConfig.CustomColors.redstone;
|
||||
private static final boolean useStemColors = MCPatcherForgeConfig.CustomColors.stem;
|
||||
private static final boolean useBlockColors = MCPatcherForgeConfig.CustomColors.otherBlocks;
|
||||
|
||||
private static final boolean enableSmoothBiomes = MCPatcherForgeConfig.instance().smoothBiomes;
|
||||
private static final boolean enableTestColorSmoothing = MCPatcherForgeConfig.instance().testColorSmoothing;
|
||||
private static final boolean enableSmoothBiomes = MCPatcherForgeConfig.CustomColors.smoothBiomes;
|
||||
private static final boolean enableTestColorSmoothing = MCPatcherForgeConfig.CustomColors.testColorSmoothing;
|
||||
|
||||
private static final ResourceLocation REDSTONE_COLORS = TexturePackAPI
|
||||
.newMCPatcherResourceLocation("colormap/redstone.png");
|
||||
@@ -73,7 +73,7 @@ public class ColorizeBlock {
|
||||
private static IColorMap waterColorMap;
|
||||
private static float[][] redstoneColor; // colormap/redstone.png
|
||||
|
||||
private static final int blockBlendRadius = MCPatcherForgeConfig.instance().blockBlendRadius;
|
||||
private static final int blockBlendRadius = MCPatcherForgeConfig.CustomColors.blockBlendRadius;
|
||||
|
||||
public static int blockColor;
|
||||
public static boolean isSmooth;
|
||||
|
||||
@@ -26,7 +26,7 @@ import jss.notfine.config.MCPatcherForgeConfig;
|
||||
|
||||
public class ColorizeWorld {
|
||||
|
||||
private static final int fogBlendRadius = MCPatcherForgeConfig.instance().fogBlendRadius;
|
||||
private static final int fogBlendRadius = MCPatcherForgeConfig.CustomColors.fogBlendRadius;
|
||||
|
||||
private static final ResourceLocation UNDERWATERCOLOR = TexturePackAPI
|
||||
.newMCPatcherResourceLocation("colormap/underwater.png");
|
||||
|
||||
@@ -20,15 +20,15 @@ public class Colorizer {
|
||||
static final ResourceLocation COLOR_PROPERTIES = TexturePackAPI.newMCPatcherResourceLocation("color.properties");
|
||||
private static PropertiesFile properties;
|
||||
|
||||
static final boolean usePotionColors = MCPatcherForgeConfig.instance().ccPotion;
|
||||
static final boolean useParticleColors = MCPatcherForgeConfig.instance().ccParticle;
|
||||
static final boolean useFogColors = MCPatcherForgeConfig.instance().ccFog;
|
||||
static final boolean useCloudType = MCPatcherForgeConfig.instance().ccClouds;
|
||||
static final boolean useMapColors = MCPatcherForgeConfig.instance().ccMap;
|
||||
static final boolean useDyeColors = MCPatcherForgeConfig.instance().ccDye;
|
||||
static final boolean useTextColors = MCPatcherForgeConfig.instance().ccText;
|
||||
static final boolean useXPOrbColors = MCPatcherForgeConfig.instance().ccXPOrb;
|
||||
static final boolean useEggColors = MCPatcherForgeConfig.instance().ccEgg;
|
||||
static final boolean usePotionColors = MCPatcherForgeConfig.CustomColors.potion;
|
||||
static final boolean useParticleColors = MCPatcherForgeConfig.CustomColors.particle;
|
||||
static final boolean useFogColors = MCPatcherForgeConfig.CustomColors.fog;
|
||||
static final boolean useCloudType = MCPatcherForgeConfig.CustomColors.clouds;
|
||||
static final boolean useMapColors = MCPatcherForgeConfig.CustomColors.map;
|
||||
static final boolean useDyeColors = MCPatcherForgeConfig.CustomColors.dye;
|
||||
static final boolean useTextColors = MCPatcherForgeConfig.CustomColors.text;
|
||||
static final boolean useXPOrbColors = MCPatcherForgeConfig.CustomColors.xporb;
|
||||
static final boolean useEggColors = MCPatcherForgeConfig.CustomColors.egg;
|
||||
|
||||
public static final float[] setColor = new float[3];
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ public final class Lightmap {
|
||||
private static final int HEIGHT_WITHOUT_NIGHTVISION = 2 * LIGHTMAP_SIZE;
|
||||
private static final int HEIGHT_WITH_NIGHTVISION = 4 * LIGHTMAP_SIZE;
|
||||
|
||||
private static final boolean useLightmaps = MCPatcherForgeConfig.instance().ccLightmaps;
|
||||
private static final boolean useLightmaps = MCPatcherForgeConfig.CustomColors.lightmaps;
|
||||
|
||||
private static final Map<Integer, Lightmap> lightmaps = new HashMap<>();
|
||||
|
||||
|
||||
@@ -46,9 +46,9 @@ public class CITUtils {
|
||||
static Item itemCompass;
|
||||
static Item itemClock;
|
||||
|
||||
static final boolean enableItems = MCPatcherForgeConfig.instance().citItems;
|
||||
static final boolean enableEnchantments = MCPatcherForgeConfig.instance().citEnchantments;
|
||||
static final boolean enableArmor = MCPatcherForgeConfig.instance().citArmor;
|
||||
static final boolean enableItems = MCPatcherForgeConfig.CustomItemTextures.items;
|
||||
static final boolean enableEnchantments = MCPatcherForgeConfig.CustomItemTextures.enchantments;
|
||||
static final boolean enableArmor = MCPatcherForgeConfig.CustomItemTextures.armor;
|
||||
|
||||
private static TileLoader tileLoader;
|
||||
private static final Map<Item, List<ItemOverride>> items = new IdentityHashMap<>();
|
||||
@@ -221,7 +221,7 @@ public class CITUtils {
|
||||
List<T> list = overrides.get(item);
|
||||
if (list != null) {
|
||||
int[] enchantmentLevels = getEnchantmentLevels(item, itemStack.getTagCompound());
|
||||
boolean hasEffect = itemStack.hasEffect();
|
||||
boolean hasEffect = itemStack.hasEffect(0);
|
||||
for (T override : list) {
|
||||
if (override.match(itemStack, enchantmentLevels, hasEffect)) {
|
||||
return override;
|
||||
|
||||
@@ -49,7 +49,7 @@ final class EnchantmentList {
|
||||
Map<Integer, Layer> tmpLayers = new HashMap<>();
|
||||
Item item = itemStack.getItem();
|
||||
int[] enchantmentLevels = CITUtils.getEnchantmentLevels(item, itemStack.getTagCompound());
|
||||
boolean hasEffect = itemStack.hasEffect();
|
||||
boolean hasEffect = itemStack.hasEffect(0);
|
||||
List<Enchantment> list = enchantments.get(item);
|
||||
if (list == null) {
|
||||
list = allItemEnchantments;
|
||||
|
||||
@@ -9,7 +9,6 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
@@ -32,9 +31,6 @@ public class CTMUtils {
|
||||
|
||||
private static final MCLogger logger = MCLogger.getLogger(MCLogger.Category.CONNECTED_TEXTURES, "CTM");
|
||||
|
||||
private static final boolean enableStandard = MCPatcherForgeConfig.instance().ctmStandard;
|
||||
private static final boolean enableNonStandard = MCPatcherForgeConfig.instance().ctmNonStandard;
|
||||
|
||||
private static final List<TileOverride> allOverrides = new ArrayList<>();
|
||||
private static final Map<Block, List<BlockStateMatcher>> blockOverrides = new IdentityHashMap<>();
|
||||
private static final Map<String, List<TileOverride>> tileOverrides = new HashMap<>();
|
||||
@@ -81,7 +77,7 @@ public class CTMUtils {
|
||||
tileLoader = new TileLoader("textures/blocks", logger);
|
||||
RenderPassAPI.instance.refreshBlendingOptions();
|
||||
|
||||
if (enableStandard || enableNonStandard) {
|
||||
if (MCPatcherForgeConfig.ConnectedTextures.standard || MCPatcherForgeConfig.ConnectedTextures.nonStandard) {
|
||||
for (ResourceLocation resource : ResourceList.getInstance()
|
||||
.listResources(TexturePackAPI.MCPATCHER_SUBDIR + "ctm", ".properties", true)) {
|
||||
registerOverride(TileOverride.create(resource, tileLoader));
|
||||
@@ -160,7 +156,7 @@ public class CTMUtils {
|
||||
public static void reset() {}
|
||||
|
||||
private static boolean checkFace(int face) {
|
||||
return face < 0 ? enableNonStandard : enableStandard;
|
||||
return face < 0 ? MCPatcherForgeConfig.ConnectedTextures.nonStandard : MCPatcherForgeConfig.ConnectedTextures.standard;
|
||||
}
|
||||
|
||||
private static boolean checkRenderType(Block block) {
|
||||
|
||||
@@ -12,8 +12,6 @@ import jss.notfine.config.MCPatcherForgeConfig;
|
||||
|
||||
public class GlassPaneRenderer {
|
||||
|
||||
private static final boolean enable = MCPatcherForgeConfig.instance().ctmGlassPane;
|
||||
|
||||
public static boolean skipPaneRendering;
|
||||
public static boolean skipTopEdgeRendering;
|
||||
public static boolean skipBottomEdgeRendering;
|
||||
@@ -47,7 +45,7 @@ public class GlassPaneRenderer {
|
||||
|
||||
private static boolean setupIcons(RenderBlocks renderBlocks, Block blockPane, IIcon origIcon, int x, int y, int z) {
|
||||
skipPaneRendering = skipBottomEdgeRendering = skipTopEdgeRendering = false;
|
||||
if (!enable) {
|
||||
if (!MCPatcherForgeConfig.ConnectedTextures.glassPane) {
|
||||
return false;
|
||||
}
|
||||
for (int face = BlockOrientation.NORTH_FACE; face <= BlockOrientation.EAST_FACE; face++) {
|
||||
|
||||
@@ -32,8 +32,6 @@ abstract class TileOverride implements Comparable<TileOverride> {
|
||||
|
||||
private static final MCLogger logger = MCLogger.getLogger(MCLogger.Category.CONNECTED_TEXTURES, "CTM");
|
||||
|
||||
private static final int META_MASK = 0xffff;
|
||||
|
||||
private final PropertiesFile properties;
|
||||
private final String baseFilename;
|
||||
private final TileLoader tileLoader;
|
||||
@@ -41,7 +39,6 @@ abstract class TileOverride implements Comparable<TileOverride> {
|
||||
private final int weight;
|
||||
private final List<BlockStateMatcher> matchBlocks;
|
||||
private final Set<String> matchTiles;
|
||||
private final int defaultMetaMask;
|
||||
private final BlockFaceMatcher faceMatcher;
|
||||
private final int connectType;
|
||||
private final boolean innerSeams;
|
||||
@@ -50,7 +47,6 @@ abstract class TileOverride implements Comparable<TileOverride> {
|
||||
|
||||
private final List<ResourceLocation> tileNames = new ArrayList<>();
|
||||
protected IIcon[] icons;
|
||||
private int matchMetadata = META_MASK;
|
||||
|
||||
static TileOverride create(ResourceLocation propertiesFile, TileLoader tileLoader) {
|
||||
if (propertiesFile == null) {
|
||||
@@ -133,11 +129,6 @@ abstract class TileOverride implements Comparable<TileOverride> {
|
||||
if (matchBlocks.isEmpty() && matchTiles.isEmpty()) {
|
||||
matchTiles.add(baseFilename);
|
||||
}
|
||||
int bits = 0;
|
||||
for (int i : properties.getIntList("metadata", 0, 15, "0-15")) {
|
||||
bits |= 1 << i;
|
||||
}
|
||||
defaultMetaMask = bits;
|
||||
|
||||
faceMatcher = BlockFaceMatcher.create(properties.getString("faces", ""));
|
||||
|
||||
|
||||
@@ -15,8 +15,6 @@ import jss.notfine.config.MCPatcherForgeConfig;
|
||||
|
||||
abstract public class TileOverrideIterator implements Iterator<TileOverride> {
|
||||
|
||||
private static final int MAX_RECURSION = MCPatcherForgeConfig.instance().maxRecursion;
|
||||
|
||||
private final Map<Block, List<BlockStateMatcher>> allBlockOverrides;
|
||||
private final Map<String, List<TileOverride>> allTileOverrides;
|
||||
|
||||
@@ -118,7 +116,7 @@ abstract public class TileOverrideIterator implements Iterator<TileOverride> {
|
||||
lastMatchedOverride = null;
|
||||
skipOverrides.clear();
|
||||
|
||||
pass: for (int pass = 0; pass < MAX_RECURSION; pass++) {
|
||||
pass: for (int pass = 0; pass < MCPatcherForgeConfig.ConnectedTextures.maxRecursion; pass++) {
|
||||
while (hasNext()) {
|
||||
TileOverride override = next();
|
||||
IIcon newIcon = getTile(override, renderBlockState, origIcon);
|
||||
|
||||
@@ -28,7 +28,7 @@ public class CustomAnimation implements Comparable<CustomAnimation> {
|
||||
|
||||
private static final MCLogger logger = MCLogger.getLogger(MCLogger.Category.EXTENDED_HD, "Animation");
|
||||
|
||||
private static final boolean enable = MCPatcherForgeConfig.instance().animations;
|
||||
private static final boolean enable = MCPatcherForgeConfig.ExtendedHD.animations;
|
||||
private static final Set<PropertiesFile> pending = new HashSet<>();
|
||||
private static final List<CustomAnimation> animations = new ArrayList<>();
|
||||
|
||||
|
||||
@@ -48,10 +48,10 @@ public class FancyDial {
|
||||
|
||||
private static final boolean fboSupported = GLContext.getCapabilities().GL_EXT_framebuffer_object;
|
||||
private static final boolean gl13Supported = GLContext.getCapabilities().OpenGL13;
|
||||
private static final boolean enableCompass = MCPatcherForgeConfig.instance().fancyCompass;
|
||||
private static final boolean enableClock = MCPatcherForgeConfig.instance().fancyClock;
|
||||
private static final boolean useGL13 = gl13Supported && MCPatcherForgeConfig.instance().useGL13;
|
||||
private static final boolean useScratchTexture = MCPatcherForgeConfig.instance().useScratchTexture;
|
||||
private static final boolean enableCompass = MCPatcherForgeConfig.ExtendedHD.fancyCompass;
|
||||
private static final boolean enableClock = MCPatcherForgeConfig.ExtendedHD.fancyClock;
|
||||
private static final boolean useGL13 = gl13Supported && MCPatcherForgeConfig.ExtendedHD.useGL13;
|
||||
private static final boolean useScratchTexture = MCPatcherForgeConfig.ExtendedHD.useScratchTexture;
|
||||
private static final int glAttributes;
|
||||
private static boolean initialized;
|
||||
private static boolean active;
|
||||
@@ -170,6 +170,7 @@ public class FancyDial {
|
||||
static void registerAnimations() {
|
||||
ITextureObject texture = TexturePackAPI.getTextureObject(TexturePackAPI.ITEMS_PNG);
|
||||
if (texture instanceof TextureMap map) {
|
||||
@SuppressWarnings("unchecked")
|
||||
List<TextureAtlasSprite> animations = map.listAnimatedSprites;
|
||||
for (FancyDial instance : instances.values()) {
|
||||
instance.registerAnimation(animations);
|
||||
|
||||
@@ -21,8 +21,8 @@ public class FontUtils {
|
||||
|
||||
private static final MCLogger logger = MCLogger.getLogger(MCLogger.Category.EXTENDED_HD);
|
||||
|
||||
private static final boolean enable = MCPatcherForgeConfig.instance().hdFont;
|
||||
private static final boolean enableNonHD = MCPatcherForgeConfig.instance().nonHDFontWidth;
|
||||
private static final boolean enable = MCPatcherForgeConfig.ExtendedHD.hdFont;
|
||||
private static final boolean enableNonHD = MCPatcherForgeConfig.ExtendedHD.nonHDFontWidth;
|
||||
|
||||
private static final int ROWS = 16;
|
||||
private static final int COLS = 16;
|
||||
|
||||
@@ -32,8 +32,8 @@ public class MipmapHelper {
|
||||
static final int TEX_DATA_TYPE = GL12.GL_UNSIGNED_INT_8_8_8_8_REV;
|
||||
|
||||
private static final boolean mipmapSupported;
|
||||
static final boolean mipmapEnabled = MCPatcherForgeConfig.instance().mipmap;
|
||||
static final int maxMipmapLevel = MCPatcherForgeConfig.instance().maxMipMapLevel;
|
||||
static final boolean mipmapEnabled = MCPatcherForgeConfig.ExtendedHD.mipmap;
|
||||
static final int maxMipmapLevel = MCPatcherForgeConfig.ExtendedHD.maxMipMapLevel;
|
||||
private static final boolean useMipmap;
|
||||
|
||||
private static final boolean anisoSupported;
|
||||
@@ -53,14 +53,14 @@ public class MipmapHelper {
|
||||
if (anisoSupported) {
|
||||
anisoMax = (int) GL11.glGetFloat(EXTTextureFilterAnisotropic.GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT);
|
||||
checkGLError("glGetFloat(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT)");
|
||||
anisoLevel = Math.max(Math.min(MCPatcherForgeConfig.instance().anisotropicFiltering, anisoMax), 1);
|
||||
anisoLevel = Math.max(Math.min(MCPatcherForgeConfig.ExtendedHD.anisotropicFiltering, anisoMax), 1);
|
||||
} else {
|
||||
anisoMax = anisoLevel = 1;
|
||||
}
|
||||
|
||||
lodSupported = GLContext.getCapabilities().GL_EXT_texture_lod_bias;
|
||||
if (lodSupported) {
|
||||
lodBias = MCPatcherForgeConfig.instance().lodBias;
|
||||
lodBias = MCPatcherForgeConfig.ExtendedHD.lodBias;
|
||||
} else {
|
||||
lodBias = 0;
|
||||
}
|
||||
|
||||
@@ -25,14 +25,13 @@ abstract public class ColorMap implements IColorMap {
|
||||
|
||||
private static final MCLogger logger = MCLogger.getLogger(MCLogger.Category.CUSTOM_COLORS);
|
||||
|
||||
public static final boolean useSwampColors = MCPatcherForgeConfig.instance().swampColors;
|
||||
public static final boolean useSwampColors = MCPatcherForgeConfig.CustomColors.swampColors;
|
||||
|
||||
private static final int FIXED = 0;
|
||||
private static final int TEMPERATURE_HUMIDITY = 1;
|
||||
private static final int BIOME_HEIGHT = 2;
|
||||
|
||||
private static final int COLORMAP_WIDTH = 256;
|
||||
private static final int COLORMAP_HEIGHT = 256;
|
||||
|
||||
public static final String BLOCK_COLORMAP_DIR = TexturePackAPI.MCPATCHER_SUBDIR + "colormap/blocks";
|
||||
public static final List<ResourceLocation> unusedPNGs = new ArrayList<>();
|
||||
@@ -165,7 +164,7 @@ abstract public class ColorMap implements IColorMap {
|
||||
unusedPNGs.clear();
|
||||
defaultColorMapFormat = TEMPERATURE_HUMIDITY;
|
||||
defaultFlipY = false;
|
||||
defaultYVariance = MCPatcherForgeConfig.instance().yVariance;
|
||||
defaultYVariance = MCPatcherForgeConfig.CustomColors.yVariance;
|
||||
}
|
||||
|
||||
public static void reloadColorMapSettings(PropertiesFile properties) {
|
||||
|
||||
@@ -10,8 +10,6 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import com.prupe.mcpatcher.MCPatcherUtils;
|
||||
import com.prupe.mcpatcher.mal.resource.PropertiesFile;
|
||||
@@ -21,6 +19,7 @@ import cpw.mods.fml.common.registry.GameData;
|
||||
|
||||
public class BlockAPI {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
BlockAPI(FMLControlledNamespacedRegistry<Block> registry) {
|
||||
File outputFile = new File("blocks17.txt");
|
||||
if (outputFile.isFile()) {
|
||||
|
||||
@@ -61,6 +61,7 @@ public class BlockStateMatcher {
|
||||
threadLocal.set(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
final public String toString() {
|
||||
return fullString;
|
||||
}
|
||||
|
||||
@@ -11,8 +11,6 @@ import jss.notfine.config.MCPatcherForgeConfig;
|
||||
// Shared by both CTM and Custom Colors.
|
||||
public class RenderBlocksUtils {
|
||||
|
||||
public static final boolean enableBetterGrass = MCPatcherForgeConfig.instance().betterGrass;
|
||||
|
||||
private static final int COLOR = 0;
|
||||
private static final int NONCOLOR = 1;
|
||||
private static final int COLOR_AND_NONCOLOR = 2;
|
||||
@@ -35,7 +33,7 @@ public class RenderBlocksUtils {
|
||||
colorMultiplierType[5] = COLOR;
|
||||
} else if (block == Blocks.grass) {
|
||||
colorMultiplierType[0] = NONCOLOR;
|
||||
if (enableBetterGrass) {
|
||||
if (MCPatcherForgeConfig.ConnectedTextures.betterGrass) {
|
||||
if (isSnowCovered(blockAccess, x, y, z)) {
|
||||
colorMultiplierType[2] = NONCOLOR;
|
||||
colorMultiplierType[3] = NONCOLOR;
|
||||
@@ -135,7 +133,7 @@ public class RenderBlocksUtils {
|
||||
|
||||
public static IIcon getGrassTexture(Block block, IBlockAccess blockAccess, int x, int y, int z, int face,
|
||||
IIcon topIcon) {
|
||||
if (!enableBetterGrass || face < 2) {
|
||||
if (!MCPatcherForgeConfig.ConnectedTextures.betterGrass || face < 2) {
|
||||
return null;
|
||||
}
|
||||
boolean isSnow = isSnowCovered(blockAccess, x, y, z);
|
||||
|
||||
@@ -13,6 +13,7 @@ import cpw.mods.fml.common.registry.GameData;
|
||||
|
||||
public class ItemAPI {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
ItemAPI() {
|
||||
File outputFile = new File("items17.txt");
|
||||
if (outputFile.isFile()) {
|
||||
|
||||
@@ -120,7 +120,7 @@ final public class PropertiesFile {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Set<Map.Entry<String, String>> entrySet() {
|
||||
return (Set<Map.Entry<String, String>>) (Set) properties.entrySet();
|
||||
return (Set<Map.Entry<String, String>>) (Set<?>) properties.entrySet();
|
||||
}
|
||||
|
||||
public ResourceLocation getResource() {
|
||||
|
||||
@@ -110,6 +110,7 @@ public class ResourceList {
|
||||
MCPatcherUtils.close(zipFile);
|
||||
}
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, File> map = resourcePack.field_152781_b; // map
|
||||
if (map != null) {
|
||||
for (Map.Entry<String, File> entry : map.entrySet()) {
|
||||
|
||||
Loaded 100 of 312 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user