Compare commits

..
28 Commits
Author SHA1 Message Date
glowredman 169e584506 Update buildscript 2023-08-15 20:01:48 +02:00
glowredman 03eeec9d23 Re-enable remapping for certain mixins 2023-08-15 18:09:59 +02:00
glowredman 4d9bb7b9a5 Enable genericInjection 2023-08-15 18:09:13 +02:00
glowredman 08e411f70b Update buildscript 2023-08-15 17:21:48 +02:00
Jason Mitchell d5a005a0ed spotless 2023-07-09 11:39:51 -07:00
Jason Mitchell 5fddbcecec Add MixinEntityRenderer
* Port over (most of) renderHand
2023-07-08 18:11:19 -07:00
Raven Szewczyk 4dfe96639e Fix recursive and relative #include handling 2023-06-22 21:40:34 +01:00
Raven Szewczyk 96e7064192 Fix NPE in ModelRenderer 2023-06-22 21:40:20 +01:00
Raven Szewczyk 1d46d0c32f Update gradle and dependencies 2023-06-22 20:49:45 +01:00
Raven Szewczyk 0b66f7a255 Mixin Tessellator 2023-06-22 20:47:36 +01:00
Caedis d63bd7a8a5 also delete the old transformer 2023-06-10 03:03:32 -05:00
Caedis 9f8477c039 Spotless 2023-06-10 02:59:47 -05:00
Caedis 6526cac45a Mixin SimpleTexture 2023-06-10 02:58:33 -05:00
Caedis c37b1020e2 Update build.gradle 2023-06-09 17:32:55 -05:00
Caedis cc5905dfbc Mixin TextureClock and TextureCompass 2023-06-09 17:20:17 -05:00
Raven Szewczyk 88af3a807a Update buildscript to use unimixins 2023-03-18 20:43:45 +00:00
Jason Mitchell 0b1cd16ed0 Mixin-ify RenderGlobal transformer 2023-02-26 21:20:16 -08:00
Jason Mitchell 7614cfc2c4 Progress
* Remove some compilerStubs, access adjustment ASM and replace with Mixin Accessors
* Renderer Mixins
2023-02-24 23:14:41 -08:00
Jason Mitchell 39e7b5b3ea Renderer Mixins & Lighting Level Mixins 2023-02-24 17:57:09 -08:00
Jason Mitchell df3ff717f0 Mixin Shaders Button 2023-02-23 23:23:35 -08:00
992d5e08b9 Start using mixins (#8)
* SMCLog -> ALog

* Start using Mixins!
* Shader startup ACTMinecraft -> MixinMinecraft

* spotlessApply (#9)

Co-authored-by: GitHub GTNH Actions <>

* Update buildscript, add mixingasm and nei

* Remove unneeded transformer exclusions

* Fix broken stack frames

* Fix mcp namer for rfg

* Inject the asm transformer manually in the correct order to avoid mixin-induced issues

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Raven Szewczyk <[email protected]>
2023-02-23 18:24:05 +00:00
Raven Szewczyk 102938304c Working obfuscated run, switch to FMLLoadingPlugin properly 2023-02-20 20:07:20 +00:00
Raven Szewczyk 9af8478236 Update gradle properties for RFG 2023-02-20 19:54:24 +00:00
Raven Szewczyk 3cc367bf0d Update buildscript 2023-02-20 19:46:58 +00:00
Raven Szewczyk 416b967e8a [ci skip] upgraded build system 2023-01-31 09:50:48 +00:00
Jason Mitchell 5f4739cc78 [ci skip] Add git-blame-ignore-revs for spotlessApply 2023-01-29 12:49:10 -08:00
Jason Mitchell f64f7f366a [ci skip] spotlessApply with the new settings 2023-01-29 12:49:10 -08:00
Jason Mitchell c47661b619 [ci skip] Update buildscript to RetroFuturaGradle 2023-01-29 12:48:47 -08:00
102 changed files with 4543 additions and 4529 deletions

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
# Ignore spotlessApply reformat
f64f7f366af8fc32dddfe9c9acd1259eb7d65787
+36 -27
View File
@@ -1,35 +1,44 @@
* text eol=lf
*.jar binary
*.[jJ][aA][rR] binary
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.tif binary
*.tiff binary
*.ico binary
*.svg text
*.eps binary
*.[pP][nN][gG] binary
*.[jJ][pP][gG] binary
*.[jJ][pP][eE][gG] binary
*.[gG][iI][fF] binary
*.[tT][iI][fF] binary
*.[tT][iI][fF][fF] binary
*.[iI][cC][oO] binary
*.[sS][vV][gG] text
*.[eE][pP][sS] binary
*.[xX][cC][fF] binary
*.kar binary
*.m4a binary
*.mid binary
*.midi binary
*.mp3 binary
*.ogg binary
*.ra binary
*.[kK][aA][rR] binary
*.[mM]4[aA] binary
*.[mM][iI][dD] binary
*.[mM][iI][dD][iI] binary
*.[mM][pP]3 binary
*.[oO][gG][gG] binary
*.[rR][aA] binary
*.7z binary
*.gz binary
*.tar binary
*.tgz binary
*.zip binary
*.7[zZ] binary
*.[gG][zZ] binary
*.[tT][aA][rR] binary
*.[tT][gG][zZ] binary
*.[zZ][iI][pP] binary
*.patch -text
*.[tT][cC][nN] binary
*.[sS][oO] binary
*.[dD][lL][lL] binary
*.[dD][yY][lL][iI][bB] binary
*.[pP][sS][dD] binary
*.[tT][tT][fF] binary
*.[oO][tT][fF] binary
*.bat text eol=crlf
*.cmd text eol=crlf
*.ps1 text eol=crlf
*.[pP][aA][tT][cC][hH] -text
*autogenerated binary
*.[bB][aA][tT] text eol=crlf
*.[cC][mM][dD] text eol=crlf
*.[pP][sS]1 text eol=crlf
*[aA][uU][tT][oO][gG][eE][nN][eE][rR][aA][tT][eE][dD]* binary
+1 -1
View File
@@ -26,7 +26,7 @@ whitelist.json
*.iml
*.ipr
*.iws
src/main/resources/mixins.*.json
src/main/resources/mixins.*([!.]).json
*.bat
*.DS_Store
!gradlew.bat
-10
View File
@@ -9,13 +9,3 @@ sourceSets {
compileClasspath += configurations.compileStubs
}
}
jar {
manifest {
attributes([
"Manifest-Version" : 1.0,
"TweakClass" : "com.gtnewhorizons.angelica.loading.ATweaker",
"TweakOrder" : 1100,
])
}
}
+1098 -475
View File
File diff suppressed because it is too large. Load diff
+2
View File
@@ -2,4 +2,6 @@
dependencies {
compileOnly(sourceSets.compileStubs.output)
compileStubs(sourceSets.compileStubsStubs.output)
runtimeOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughItems:2.3.55-GTNH:dev")
}
+75 -12
View File
@@ -28,16 +28,31 @@ remoteMappings = https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/con
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
developmentEnvironmentUserName = Developer
# Enables using modern java syntax (up to version 17) via Jabel, while still targetting JVM 8.
# See https://github.com/bsideup/jabel for details on how this works.
enableModernJavaSyntax = true
# Enables injecting missing generics into the decompiled source code for a better coding experience
# Turns most publically visible List, Map, etc. into proper List<Type>, Map<K, V> types
enableGenericInjection = true
# Define a source file of your project with:
# public static final String VERSION = "GRADLETOKEN_VERSION";
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
# version in @Mod([...], version = VERSION, [...])
# Leave these properties empty to skip individual token replacements
replaceGradleTokenInFile = Tags.java
gradleTokenModId = GRADLETOKEN_MODID
gradleTokenModName = GRADLETOKEN_MODNAME
gradleTokenVersion = GRADLETOKEN_VERSION
gradleTokenGroupName = GRADLETOKEN_GROUPNAME
generateGradleTokenClass = com.gtnewhorizons.angelica.Tags
gradleTokenModId =
gradleTokenModName =
gradleTokenVersion = VERSION
gradleTokenGroupName =
# [DEPRECATED]
# Multiple source files can be defined here by providing a comma-seperated list: Class1.java,Class2.java,Class3.java
# public static final String VERSION = "GRADLETOKEN_VERSION";
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
# version in @Mod([...], version = VERSION, [...])
# Leave these properties empty to skip individual token replacements
replaceGradleTokenInFile =
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
# leave this property empty.
@@ -45,21 +60,22 @@ gradleTokenGroupName = GRADLETOKEN_GROUPNAME
apiPackage =
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
# Example value: mymodid_at.cfg
accessTransformersFile =
# There can be multiple files in a comma-separated list.
# Example value: mymodid_at.cfg,nei_at.cfg
accessTransformersFile = angelica_at.cfg
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = false
usesMixins = true
# Adds some debug arguments like verbose output and export
usesMixinDebug = false
usesMixinDebug = true
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
mixinPlugin =
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
mixinsPackage =
mixinsPackage = mixins
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
# This parameter is for legacy compatibility only
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
coreModClass =
coreModClass = loading.AngelicaTweaker
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
containsMixinsAndOrCoreModOnly = false
@@ -70,10 +86,49 @@ forceEnableMixins = false
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated in your jar. It is your
# responsibility check the licence and request permission for distribution, if required.
usesShadowedDependencies = false
# If disabled, won't remove unused classes from shaded dependencies. Some libraries use reflection to access
# their own classes, making the minimization unreliable.
minimizeShadowedDependencies = true
# If disabled, won't rename the shadowed classes.
relocateShadowedDependencies = true
# Adds the GTNH maven, CurseMaven, IC2/Player maven, and some more well-known 1.7.10 repositories
includeWellKnownRepositories = true
# Publishing to modrinth requires you to set the MODRINTH_TOKEN environment variable to your current modrinth API token.
# The project's ID on Modrinth. Can be either the slug or the ID.
# Leave this empty if you don't want to publish on Modrinth.
modrinthProjectId =
# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
# Syntax: scope1-type1:name1;scope2-type2:name2;...
# Where scope can be one of [required, optional, incompatible, embedded],
# type can be one of [project, version],
# and the name is the Modrinth project or version slug/id of the other mod.
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
modrinthRelations =
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
# The project's numeric ID on CurseForge. You can find this in the About Project box.
# Leave this empty if you don't want to publish on CurseForge.
curseForgeProjectId =
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
# Syntax: type1:name1;type2:name2;...
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
# and the name is the CurseForge project slug of the other mod.
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
curseForgeRelations =
# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older
# projects. New projects should not use this parameter.
#customArchiveBaseName =
# customArchiveBaseName =
# Optional parameter to prevent the source code from being published
# noPublishedSources =
@@ -82,3 +137,11 @@ usesShadowedDependencies = false
# This should only be uncommented to keep it easier to sync with upstream/other forks.
# That is, if there is no other active fork/upstream, NEVER change this.
# disableSpotless = true
# Override the IDEA build type. Valid value is "" (leave blank, do not override), "idea" (force use native IDEA build), "gradle"
# (force use delegated build).
# This is meant to be set in $HOME/.gradle/gradle.properties.
# e.g. add "systemProp.org.gradle.project.ideaOverrideBuildType=idea" will override the build type to be always native build.
# WARNING: If you do use this option, it will overwrite whatever you have in your existing projects. This might not be what you want!
# Usually there is no need to uncomment this here as other developers do not necessarily use the same build type as you.
# ideaOverrideBuildType = idea
Binary file not shown.
+2 -1
View File
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Vendored Regular → Executable
+173 -116
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env sh
#!/bin/sh
#
# Copyright 2015 the original author or authors.
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -17,78 +17,110 @@
#
##############################################################################
##
## Gradle start up script for UN*X
##
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# 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
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
MAX_FD=maximum
warn () {
echo "$*"
}
} >&2
die () {
echo
echo "$*"
echo
exit 1
}
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD="$JAVA_HOME/bin/java"
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@@ -97,7 +129,7 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
@@ -105,84 +137,109 @@ location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"
Vendored
+15 -23
View File
@@ -14,7 +14,7 @@
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@@ -25,10 +25,14 @@
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@@ -37,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -51,7 +55,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@@ -61,38 +65,26 @@ echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
+21 -3
View File
@@ -1,10 +1,28 @@
pluginManagement {
repositories {
maven {
// RetroFuturaGradle
name "GTNH Maven"
url "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
allowInsecureProtocol = true
mavenContent {
includeGroup("com.gtnewhorizons.retrofuturagradle")
}
}
gradlePluginPortal()
mavenCentral()
mavenLocal()
}
}
plugins {
id 'com.diffplug.blowdryerSetup' version '1.6.0'
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0' // Provides java toolchains
}
apply plugin: 'com.diffplug.blowdryerSetup'
blowdryerSetup {
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.1.5')
repoSubfolder 'gtnhShared'
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.2.0')
//devLocal '.' // Use this when testing config updates locally
}
@@ -3,5 +3,6 @@ package net.minecraft.client.model;
import java.util.List;
public class ModelBase {
public List boxList;
}
@@ -1,10 +0,0 @@
package net.minecraft.client.model;
import java.util.List;
public class ModelRenderer {
public List childModels;
public void resetDisplayList() {}
}
@@ -1,14 +0,0 @@
package net.minecraft.client.renderer;
public class EntityRenderer {
public static int anaglyphField;
public static boolean anaglyphEnable;
/**
* Render player hand
*/
public void renderHand(float p_78476_1_, int p_78476_2_) {}
public void renderWorld(float f, long l) {}
}
@@ -1,8 +0,0 @@
package net.minecraft.client.renderer;
public class RenderGlobal {
public WorldRenderer[] worldRenderers;
public void loadRenderers() {}
}
@@ -1,180 +0,0 @@
package net.minecraft.client.renderer;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.nio.ShortBuffer;
import net.minecraft.client.shader.TesselatorVertexState;
public class Tessellator {
private static int nativeBufferSize;
private static int trivertsInBuffer;
public static boolean renderingWorldRenderer;
public boolean defaultTexture;
private int rawBufferSize;
public int textureID;
/** The byte buffer used for GL allocation. */
public ByteBuffer byteBuffer;
/** The same memory as byteBuffer, but referenced as an integer buffer. */
public IntBuffer intBuffer;
/** The same memory as byteBuffer, but referenced as an float buffer. */
public FloatBuffer floatBuffer;
/** The same memory as byteBuffer, but referenced as an short buffer. */
public ShortBuffer shortBuffer;
/** Raw integer array. */
public int[] rawBuffer;
/** The number of vertices to be drawn in the next draw call. Reset to 0 between draw calls. */
public int vertexCount;
/** The first coordinate to be used for the texture. */
public double textureU;
/** The second coordinate to be used for the texture. */
public double textureV;
public int brightness;
/** The color (RGBA) value to be used for the following draw call. */
public int color;
/** Whether the current draw object for this tessellator has color values. */
public boolean hasColor;
/** Whether the current draw object for this tessellator has texture coordinates. */
public boolean hasTexture;
public boolean hasBrightness;
/** Whether the current draw object for this tessellator has normal values. */
public boolean hasNormals;
/** The index into the raw buffer to be used for the next data. */
public int rawBufferIndex;
/**
* The number of vertices manually added to the given draw call. This differs from vertexCount because it adds extra
* vertices when converting quads to triangles.
*/
public int addedVertices;
/** Disables all color information for the following draw call. */
public boolean isColorDisabled;
/** The draw mode currently being used by the tessellator. */
public int drawMode;
/** An offset to be applied along the x-axis for all vertices in this draw call. */
public double xOffset;
/** An offset to be applied along the y-axis for all vertices in this draw call. */
public double yOffset;
/** An offset to be applied along the z-axis for all vertices in this draw call. */
public double zOffset;
/** The normal to be applied to the face being drawn. */
public int normal;
/** The static instance of the Tessellator. */
public static final Tessellator instance = new Tessellator();
/** Whether this tessellator is currently in draw mode. */
public boolean isDrawing;
/** The size of the buffers used (in integers). */
public int bufferSize;
public float midTextureU;
public float midTextureV;
public float normalX;
public float normalY;
public float normalZ;
public float[] vertexPos = new float[16];
private Tessellator(int p_i1250_1_) {}
public Tessellator() {}
/**
* Draws the data set up in this tessellator and resets the state to prepare for new drawing.
*/
public int draw() {
return 0;
}
public TesselatorVertexState getVertexState(float p_147564_1_, float p_147564_2_, float p_147564_3_) {
return null;
}
public void setVertexState(TesselatorVertexState p_147565_1_) {}
/**
* Clears the tessellator state in preparation for new drawing.
*/
public void reset() {}
/**
* Sets draw mode in the tessellator to draw quads.
*/
public void startDrawingQuads() {}
/**
* Resets tessellator state and prepares for drawing (with the specified draw mode).
*/
public void startDrawing(int p_78371_1_) {}
/**
* Sets the texture coordinates.
*/
public void setTextureUV(double p_78385_1_, double p_78385_3_) {}
public void setBrightness(int p_78380_1_) {}
/**
* Sets the RGB values as specified, converting from floats between 0 and 1 to integers from 0-255.
*/
public void setColorOpaque_F(float p_78386_1_, float p_78386_2_, float p_78386_3_) {}
/**
* Sets the RGBA values for the color, converting from floats between 0 and 1 to integers from 0-255.
*/
public void setColorRGBA_F(float p_78369_1_, float p_78369_2_, float p_78369_3_, float p_78369_4_) {}
/**
* Sets the RGB values as specified, and sets alpha to opaque.
*/
public void setColorOpaque(int p_78376_1_, int p_78376_2_, int p_78376_3_) {}
/**
* Sets the RGBA values for the color. Also clamps them to 0-255.
*/
public void setColorRGBA(int p_78370_1_, int p_78370_2_, int p_78370_3_, int p_78370_4_) {}
public void func_154352_a(byte p_154352_1_, byte p_154352_2_, byte p_154352_3_) {}
/**
* Adds a vertex specifying both x,y,z and the texture u,v for it.
*/
public void addVertexWithUV(
double p_78374_1_, double p_78374_3_, double p_78374_5_, double p_78374_7_, double p_78374_9_) {}
/**
* Adds a vertex with the specified x,y,z to the current draw call. It will trigger a draw() if the buffer gets
* full.
*/
public void addVertex(double p_78377_1_, double p_78377_3_, double p_78377_5_) {}
/**
* Sets the color to the given opaque value (stored as byte values packed in an integer).
*/
public void setColorOpaque_I(int p_78378_1_) {}
/**
* Sets the color to the given color (packed as bytes in integer) and alpha values.
*/
public void setColorRGBA_I(int p_78384_1_, int p_78384_2_) {}
/**
* Disables colors for the current draw call.
*/
public void disableColor() {}
/**
* Sets the normal for the current draw call.
*/
public void setNormal(float p_78375_1_, float p_78375_2_, float p_78375_3_) {}
/**
* Sets the translation for all vertices in the current draw call.
*/
public void setTranslation(double p_78373_1_, double p_78373_3_, double p_78373_5_) {}
/**
* Offsets the translation for all vertices in the current draw call.
*/
public void addTranslation(float p_78372_1_, float p_78372_2_, float p_78372_3_) {}
}
@@ -3,6 +3,7 @@ package net.minecraft.client.renderer;
import net.minecraft.client.renderer.culling.ICamera;
public class WorldRenderer {
public boolean isInFrustum;
public boolean skipAllRenderPasses() {
@@ -1,3 +1,4 @@
package net.minecraft.client.renderer.culling;
public interface ICamera {}
public interface ICamera {
}
@@ -1,3 +0,0 @@
package net.minecraft.client.renderer.entity;
public abstract class Render {}
@@ -1,10 +0,0 @@
package net.minecraft.client.renderer.entity;
import net.minecraft.client.model.ModelBase;
public abstract class RendererLivingEntity extends Render {
public ModelBase mainModel;
/** The model to be used during the render passes. */
public ModelBase renderPassModel;
}
@@ -1,6 +1,7 @@
package net.minecraft.client.renderer.texture;
public class DynamicTexture extends AbstractTexture {
public DynamicTexture(int i, int i1) {
super();
}
@@ -1,3 +1,4 @@
package com.gtnewhorizons.angelica.client;
public class MultiTexID {}
public class MultiTexID {
}
@@ -1,3 +1,4 @@
package net.minecraft.client.shader;
public class TesselatorVertexState {}
public class TesselatorVertexState {
}
@@ -1,3 +1,4 @@
package net.minecraft.util;
public class ResourceLocation {}
public class ResourceLocation {
}
@@ -0,0 +1,12 @@
package com.gtnewhorizons.angelica;
import cpw.mods.fml.common.Mod;
@Mod(
modid = "angelica",
name = "Angelica",
version = Tags.VERSION,
acceptedMinecraftVersions = "[1.7.10,)",
acceptableRemoteVersions = "*")
public class AngelicaMod {
}
@@ -1,12 +0,0 @@
package com.gtnewhorizons.angelica;
// Use this class for Strings only. Do not import any classes here. It will lead to issues with Mixins if in use!
public class Tags {
// GRADLETOKEN_* will be replaced by your configuration values at build time
public static final String MODID = "GRADLETOKEN_MODID";
public static final String MODNAME = "GRADLETOKEN_MODNAME";
public static final String VERSION = "GRADLETOKEN_VERSION";
public static final String GROUPNAME = "GRADLETOKEN_GROUPNAME";
}
@@ -4,13 +4,16 @@ import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.settings.GameSettings;
import org.lwjgl.Sys;
public class GuiShaders extends GuiScreen {
/** This GUI's parent GUI. */
protected GuiScreen parentGui;
@@ -18,33 +21,15 @@ public class GuiShaders extends GuiScreen {
public boolean needReinit;
/*
private class GuiListShaderpacks {
int posX,posY,sizeX,sizeY;
int viewPosY;
int itemHeight = 20;
int selection;
ArrayList<String> listShaderpacks;
public void draw() {
Tessellator tess = Tessellator.instance;
int listSize = listShaderpacks.size();
int i,j;
for (i=viewPosY/itemHeight, j=Math.min((viewPosY+sizeY)/itemHeight,listSize); i<j; ++i)
{
int itemY = posY-viewPosY+itemHeight*i;
boolean selected = i==selection;
tess.startDrawingQuads();
tess.setColorRGBA(0,0,selected?128:0,128);
tess.addVertex(posX,itemY,0);
tess.addVertex(posX,itemY+itemHeight,0);
tess.addVertex(posX+sizeX,itemY+itemHeight,0);
tess.addVertex(posX+sizeX,itemY,0);
tess.draw();
field_146289_q.drawString(listShaderpacks.get(i), posX, itemY, 0xFFFFFFFF, true);
}
}
}
private GuiListShaderpacks guiListShaderpacks;
*/
* private class GuiListShaderpacks { int posX,posY,sizeX,sizeY; int viewPosY; int itemHeight = 20; int selection;
* ArrayList<String> listShaderpacks; public void draw() { Tessellator tess = Tessellator.instance; int listSize =
* listShaderpacks.size(); int i,j; for (i=viewPosY/itemHeight, j=Math.min((viewPosY+sizeY)/itemHeight,listSize);
* i<j; ++i) { int itemY = posY-viewPosY+itemHeight*i; boolean selected = i==selection; tess.startDrawingQuads();
* tess.setColorRGBA(0,0,selected?128:0,128); tess.addVertex(posX,itemY,0); tess.addVertex(posX,itemY+itemHeight,0);
* tess.addVertex(posX+sizeX,itemY+itemHeight,0); tess.addVertex(posX+sizeX,itemY,0); tess.draw();
* field_146289_q.drawString(listShaderpacks.get(i), posX, itemY, 0xFFFFFFFF, true); } } } private
* GuiListShaderpacks guiListShaderpacks;
*/
private GuiSlotShaders shaderList;
@@ -68,44 +53,72 @@ public class GuiShaders extends GuiScreen {
List buttonList = this.buttonList;
int width = this.width;
int height = this.height;
buttonList.add(new GuiButton(
17, width * 3 / 4 - 60, 30, 160, 18, "NormapMap: " + toStringOnOff(Shaders.configNormalMap)));
buttonList.add(new GuiButton(
18, width * 3 / 4 - 60, 50, 160, 18, "SpecularMap: " + toStringOnOff(Shaders.configSpecularMap)));
buttonList.add(new GuiButton(
15,
width * 3 / 4 - 60,
70,
160,
18,
"RenderResMul: " + String.format("%.04f", Shaders.configRenderResMul)));
buttonList.add(new GuiButton(
16,
width * 3 / 4 - 60,
90,
160,
18,
"ShadowResMul: " + String.format("%.04f", Shaders.configShadowResMul)));
buttonList.add(new GuiButton(
10,
width * 3 / 4 - 60,
110,
160,
18,
"HandDepth: " + String.format("%.04f", Shaders.configHandDepthMul)));
buttonList.add(new GuiButton(
9, width * 3 / 4 - 60, 130, 160, 18, "CloudShadow: " + toStringOnOff(Shaders.configCloudShadow)));
buttonList.add(
new GuiButton(
17,
width * 3 / 4 - 60,
30,
160,
18,
"NormapMap: " + toStringOnOff(Shaders.configNormalMap)));
buttonList.add(
new GuiButton(
18,
width * 3 / 4 - 60,
50,
160,
18,
"SpecularMap: " + toStringOnOff(Shaders.configSpecularMap)));
buttonList.add(
new GuiButton(
15,
width * 3 / 4 - 60,
70,
160,
18,
"RenderResMul: " + String.format("%.04f", Shaders.configRenderResMul)));
buttonList.add(
new GuiButton(
16,
width * 3 / 4 - 60,
90,
160,
18,
"ShadowResMul: " + String.format("%.04f", Shaders.configShadowResMul)));
buttonList.add(
new GuiButton(
10,
width * 3 / 4 - 60,
110,
160,
18,
"HandDepth: " + String.format("%.04f", Shaders.configHandDepthMul)));
buttonList.add(
new GuiButton(
9,
width * 3 / 4 - 60,
130,
160,
18,
"CloudShadow: " + toStringOnOff(Shaders.configCloudShadow)));
// buttonList.add(new GuiButton(14, width *3 /4 -60, 150, 160, 18, "ShadowClipFrustrum: "
// +toStringOnOff(Shaders.configShadowClipFrustrum)));
buttonList.add(new GuiButton(
4,
width * 3 / 4 - 60,
170,
160,
18,
"tweakBlockDamage: " + toStringOnOff(Shaders.configTweakBlockDamage)));
buttonList.add(new GuiButton(
19, width * 3 / 4 - 60, 190, 160, 18, "OldLighting: " + toStringOnOff(Shaders.configOldLighting)));
buttonList.add(
new GuiButton(
4,
width * 3 / 4 - 60,
170,
160,
18,
"tweakBlockDamage: " + toStringOnOff(Shaders.configTweakBlockDamage)));
buttonList.add(
new GuiButton(
19,
width * 3 / 4 - 60,
190,
160,
18,
"OldLighting: " + toStringOnOff(Shaders.configOldLighting)));
// buttonList.add(new GuiButton(11, width *3 /4 -60, 210, 160, 18, "Tex Min: "
// +Shaders.texMinFilDesc[Shaders.configTexMinFilB]));
// buttonList.add(new GuiButton(12, width *3 /4 -60, 230, 160, 18, "Tex_n Mag: "
@@ -120,8 +133,9 @@ public class GuiShaders extends GuiScreen {
}
@Override
/** actionPerformed
* Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e).
/**
* actionPerformed Fired when a control is clicked. This is the equivalent of
* ActionListener.actionPerformed(ActionEvent e).
*/
protected void actionPerformed(GuiButton par1GuiButton) {
if (par1GuiButton.enabled) // enabled
@@ -141,7 +155,7 @@ public class GuiShaders extends GuiScreen {
case 10: /* Hand Depth */ {
float val = Shaders.configHandDepthMul;
float[] choices = {0.0625f, 0.125f, 0.25f, 0.5f, 1.0f};
float[] choices = { 0.0625f, 0.125f, 0.25f, 0.5f, 1.0f };
int i;
if (!isShiftKeyDown()) { // isShiftKeyDown
for (i = 0; i < choices.length && choices[i] <= val; ++i) {}
@@ -157,7 +171,7 @@ public class GuiShaders extends GuiScreen {
case 15: /* Render Resolution Multiplier */ {
float val = Shaders.configRenderResMul;
float[] choices = {0.25f, 0.3333333333f, 0.5f, 0.7071067812f, 1.0f, 1.414213562f, 2.0f};
float[] choices = { 0.25f, 0.3333333333f, 0.5f, 0.7071067812f, 1.0f, 1.414213562f, 2.0f };
int i;
if (!isShiftKeyDown()) {
for (i = 0; i < choices.length && choices[i] <= val; ++i) {}
@@ -174,7 +188,8 @@ public class GuiShaders extends GuiScreen {
case 16: /* Shadow Resolution Multiplier */ {
float val = Shaders.configShadowResMul;
float[] choices = {0.25f, 0.3333333333f, 0.5f, 0.7071067812f, 1.0f, 1.414213562f, 2.0f, 3.0f, 4.0f};
float[] choices = { 0.25f, 0.3333333333f, 0.5f, 0.7071067812f, 1.0f, 1.414213562f, 2.0f, 3.0f,
4.0f };
int i;
if (!isShiftKeyDown()) {
for (i = 0; i < choices.length && choices[i] <= val; ++i) {}
@@ -238,39 +253,36 @@ public class GuiShaders extends GuiScreen {
case 14: /* shadow frustum clipping */ {
Shaders.configShadowClipFrustrum = !Shaders.configShadowClipFrustrum;
par1GuiButton.displayString =
"ShadowClipFrustrum: " + toStringOnOff(Shaders.configShadowClipFrustrum);
par1GuiButton.displayString = "ShadowClipFrustrum: "
+ toStringOnOff(Shaders.configShadowClipFrustrum);
ShadersTex.updateTextureMinMagFilter();
break;
}
case 5: /* Open shaderpacks folder */
switch (net.minecraft.util.Util.getOSType()) {
case OSX:
{
try {
Runtime.getRuntime().exec(new String[] {
"/usr/bin/open", Shaders.shaderpacksdir.getAbsolutePath()
});
return;
} catch (IOException var7) {
var7.printStackTrace();
}
case OSX: {
try {
Runtime.getRuntime().exec(
new String[] { "/usr/bin/open", Shaders.shaderpacksdir.getAbsolutePath() });
return;
} catch (IOException var7) {
var7.printStackTrace();
}
}
break;
case WINDOWS:
{
String var2 = String.format(
"cmd.exe /C start \"Open file\" \"%s\"",
new Object[] {Shaders.shaderpacksdir.getAbsolutePath()});
case WINDOWS: {
String var2 = String.format(
"cmd.exe /C start \"Open file\" \"%s\"",
new Object[] { Shaders.shaderpacksdir.getAbsolutePath() });
try {
Runtime.getRuntime().exec(var2);
return;
} catch (IOException var6) {
var6.printStackTrace();
}
try {
Runtime.getRuntime().exec(var2);
return;
} catch (IOException var6) {
var6.printStackTrace();
}
}
break;
default:
break;
@@ -280,9 +292,9 @@ public class GuiShaders extends GuiScreen {
try {
Class var3 = Class.forName("java.awt.Desktop");
Object var4 = var3.getMethod("getDesktop", new Class[0]).invoke((Object) null, new Object[0]);
var3.getMethod("browse", new Class[] {URI.class})
.invoke(var4, new Object[] {(new File(mc.mcDataDir, Shaders.shaderpacksdirname)).toURI()
});
var3.getMethod("browse", new Class[] { URI.class }).invoke(
var4,
new Object[] { (new File(mc.mcDataDir, Shaders.shaderpacksdirname)).toURI() });
} catch (Throwable var5) {
var5.printStackTrace();
var8 = true;
@@ -298,8 +310,7 @@ public class GuiShaders extends GuiScreen {
File confshader = new File(Shaders.shadersdir, "current.cfg");
try {
Shaders.storeConfig();
} catch (Exception ex) {
}
} catch (Exception ex) {}
if (needReinit) {
needReinit = false;
Shaders.loadShaderPack();
@@ -1,10 +1,12 @@
package com.gtnewhorizons.angelica.client;
import java.util.ArrayList;
import net.minecraft.client.gui.GuiSlot;
import net.minecraft.client.renderer.Tessellator;
class GuiSlotShaders extends GuiSlot {
private ArrayList shaderslist;
final GuiShaders shadersGui;
@@ -70,6 +72,9 @@ class GuiSlotShaders extends GuiSlot {
/** drawSlot */
protected void drawSlot(int par1, int par2, int par3, int par4, Tessellator par5, int par6, int par7) {
this.shadersGui.drawCenteredString(
(String) this.shaderslist.get(par1), this.shadersGui.width / 4 + 10, par3 + 1, 0xffffff);
(String) this.shaderslist.get(par1),
this.shadersGui.width / 4 + 10,
par3 + 1,
0xffffff);
}
}
@@ -1,6 +1,7 @@
package com.gtnewhorizons.angelica.client;
import java.nio.ByteBuffer;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;
@@ -9,6 +10,7 @@ import org.lwjgl.opengl.GL11;
* @author Nathanael Lane
*/
public class HFNoiseTexture {
public int texID;
public int textureUnit;
@@ -24,7 +26,15 @@ public class HFNoiseTexture {
// GL13.glActiveTexture(GL13.GL_TEXTURE0 + this.textureUnit);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, texID);
GL11.glTexImage2D(
GL11.GL_TEXTURE_2D, 0, GL11.GL_RGB, width, height, 0, GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, data);
GL11.GL_TEXTURE_2D,
0,
GL11.GL_RGB,
width,
height,
0,
GL11.GL_RGB,
GL11.GL_UNSIGNED_BYTE,
data);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
@@ -1,6 +1,7 @@
package com.gtnewhorizons.angelica.client;
public class MultiTexID {
public int base;
public int norm;
public int spec;
@@ -23,8 +23,7 @@ public class ShaderPackFolder implements IShaderPack {
if (resFile != null) {
return new BufferedInputStream(new FileInputStream(resFile));
}
} catch (Exception excp) {
}
} catch (Exception excp) {}
return null;
}
}
@@ -20,8 +20,7 @@ public class ShaderPackZip implements IShaderPack {
if (packZipFile != null) {
try {
packZipFile.close();
} catch (Exception excp) {
}
} catch (Exception excp) {}
packZipFile = null;
}
}
@@ -31,8 +30,7 @@ public class ShaderPackZip implements IShaderPack {
if (packZipFile == null) {
try {
packZipFile = new ZipFile(packFile);
} catch (Exception excp) {
}
} catch (Exception excp) {}
}
if (packZipFile != null) {
try {
@@ -40,8 +38,7 @@ public class ShaderPackZip implements IShaderPack {
if (entry != null) {
return packZipFile.getInputStream(entry);
}
} catch (Exception excp) {
}
} catch (Exception excp) {}
}
return null;
}
File diff suppressed because it is too large. Load diff
@@ -1,6 +1,7 @@
package com.gtnewhorizons.angelica.client;
import java.nio.IntBuffer;
import net.minecraft.block.Block;
import net.minecraft.block.BlockIce;
import net.minecraft.client.renderer.EntityRenderer;
@@ -10,8 +11,11 @@ import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.culling.Frustrum;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import org.lwjgl.opengl.GL11;
import com.gtnewhorizons.angelica.mixins.early.accessors.WorldRenderersAccessor;
public class ShadersRender {
public static void setFrustrumPosition(Frustrum frustrum, double x, double y, double z) {
@@ -20,18 +24,17 @@ public class ShadersRender {
public static void clipRenderersByFrustrum(RenderGlobal renderGlobal, Frustrum frustrum, float par2) {
Shaders.checkGLError("pre clip");
WorldRenderer[] worldRenderers = ((WorldRenderersAccessor) renderGlobal).getWorldRenderers();
if (!Shaders.isShadowPass) {
WorldRenderer[] worldRenderers = renderGlobal.worldRenderers;
for (int i = 0; i < worldRenderers.length; ++i) {
if (!worldRenderers[i].skipAllRenderPasses()) {
worldRenderers[i].updateInFrustum(frustrum);
for (WorldRenderer worldRenderer : worldRenderers) {
if (!worldRenderer.skipAllRenderPasses()) {
worldRenderer.updateInFrustum(frustrum);
}
}
} else {
WorldRenderer[] worldRenderers = renderGlobal.worldRenderers;
for (int i = 0; i < worldRenderers.length; ++i) {
if (!worldRenderers[i].skipAllRenderPasses()) {
worldRenderers[i].isInFrustum = true;
for (WorldRenderer worldRenderer : worldRenderers) {
if (!worldRenderer.skipAllRenderPasses()) {
worldRenderer.isInFrustum = true;
}
}
}
@@ -4,20 +4,25 @@ import static org.lwjgl.opengl.ARBVertexShader.glDisableVertexAttribArrayARB;
import static org.lwjgl.opengl.ARBVertexShader.glEnableVertexAttribArrayARB;
import static org.lwjgl.opengl.ARBVertexShader.glVertexAttribPointerARB;
import com.gtnewhorizons.angelica.transform.ALog;
import java.nio.FloatBuffer;
import java.nio.ShortBuffer;
import java.util.Arrays;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL13;
import com.gtnewhorizons.angelica.mixins.interfaces.TessellatorAccessor;
import com.gtnewhorizons.angelica.transform.ALog;
public class ShadersTess {
public static final int vertexStride = 16;
public static int draw(Tessellator tess) {
final TessellatorAccessor tessa = (TessellatorAccessor) tess;
if (!tess.isDrawing) {
throw new IllegalStateException("Not tesselating!");
} else {
@@ -29,40 +34,42 @@ public class ShadersTess {
int realDrawMode = tess.drawMode;
while (voffset < tess.vertexCount) {
int vcount;
vcount = Math.min(tess.vertexCount - voffset, tess.byteBuffer.capacity() / (vertexStride * 4));
vcount = Math.min(
tess.vertexCount - voffset,
tessa.getAngelica$byteBuffer().capacity() / (vertexStride * 4));
if (realDrawMode == GL11.GL_QUADS) vcount = vcount / 4 * 4;
tess.floatBuffer.clear();
tess.shortBuffer.clear();
tess.intBuffer.clear();
tess.intBuffer.put(tess.rawBuffer, voffset * vertexStride, vcount * vertexStride);
tess.byteBuffer.position(0);
tess.byteBuffer.limit(vcount * (vertexStride * 4));
tessa.getAngelica$floatBuffer().clear();
tessa.getAngelica$shortBuffer().clear();
tessa.getAngelica$intBuffer().clear();
tessa.getAngelica$intBuffer().put(tess.rawBuffer, voffset * vertexStride, vcount * vertexStride);
tessa.getAngelica$byteBuffer().position(0);
tessa.getAngelica$byteBuffer().limit(vcount * (vertexStride * 4));
voffset += vcount;
if (tess.hasTexture) {
tess.floatBuffer.position(3);
GL11.glTexCoordPointer(2, (vertexStride * 4), tess.floatBuffer);
tessa.getAngelica$floatBuffer().position(3);
GL11.glTexCoordPointer(2, (vertexStride * 4), tessa.getAngelica$floatBuffer());
GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
}
if (tess.hasBrightness) {
OpenGlHelper.setClientActiveTexture(OpenGlHelper.lightmapTexUnit);
tess.shortBuffer.position(6 * 2);
GL11.glTexCoordPointer(2, (vertexStride * 4), tess.shortBuffer);
tessa.getAngelica$shortBuffer().position(6 * 2);
GL11.glTexCoordPointer(2, (vertexStride * 4), tessa.getAngelica$shortBuffer());
GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit);
}
if (tess.hasColor) {
tess.byteBuffer.position(5 * 4);
GL11.glColorPointer(4, true, (vertexStride * 4), tess.byteBuffer);
tessa.getAngelica$byteBuffer().position(5 * 4);
GL11.glColorPointer(4, true, (vertexStride * 4), tessa.getAngelica$byteBuffer());
GL11.glEnableClientState(GL11.GL_COLOR_ARRAY);
}
if (tess.hasNormals) {
tess.floatBuffer.position(9);
GL11.glNormalPointer((vertexStride * 4), tess.floatBuffer);
tessa.getAngelica$floatBuffer().position(9);
GL11.glNormalPointer((vertexStride * 4), tessa.getAngelica$floatBuffer());
GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY);
}
tess.floatBuffer.position(0);
GL11.glVertexPointer(3, (vertexStride * 4), tess.floatBuffer);
tessa.getAngelica$floatBuffer().position(0);
GL11.glVertexPointer(3, (vertexStride * 4), tessa.getAngelica$floatBuffer());
ShadersTess.preDrawArray(tess);
GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
@@ -94,21 +101,31 @@ public class ShadersTess {
}
public static void preDrawArray(Tessellator tess) {
final TessellatorAccessor tessa = (TessellatorAccessor) tess;
// Shaders.checkGLError("preDrawArray");
if (Shaders.useMultiTexCoord3Attrib && tess.hasTexture) {
GL13.glClientActiveTexture(GL13.GL_TEXTURE3);
GL11.glTexCoordPointer(2, (vertexStride * 4), (FloatBuffer) tess.floatBuffer.position(12));
GL11.glTexCoordPointer(2, (vertexStride * 4), (FloatBuffer) tessa.getAngelica$floatBuffer().position(12));
GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
GL13.glClientActiveTexture(GL13.GL_TEXTURE0);
}
if (Shaders.useMidTexCoordAttrib && tess.hasTexture) {
glVertexAttribPointerARB(
Shaders.midTexCoordAttrib, 2, false, vertexStride * 4, (FloatBuffer) tess.floatBuffer.position(12));
Shaders.midTexCoordAttrib,
2,
false,
vertexStride * 4,
(FloatBuffer) tessa.getAngelica$floatBuffer().position(12));
glEnableVertexAttribArrayARB(Shaders.midTexCoordAttrib);
}
if (Shaders.useEntityAttrib) {
glVertexAttribPointerARB(Shaders.entityAttrib, 3, false, false, vertexStride * 4, (ShortBuffer)
tess.shortBuffer.position(7 * 2));
glVertexAttribPointerARB(
Shaders.entityAttrib,
3,
false,
false,
vertexStride * 4,
(ShortBuffer) tessa.getAngelica$shortBuffer().position(7 * 2));
glEnableVertexAttribArrayARB(Shaders.entityAttrib);
}
// Shaders.checkGLError("preDrawArray");
@@ -150,6 +167,7 @@ public class ShadersTess {
}
public static void addVertex(Tessellator tess, double parx, double pary, double parz) {
final TessellatorAccessor tessa = (TessellatorAccessor) (Object) tess;
int[] rawBuffer = tess.rawBuffer;
int rbi = tess.rawBufferIndex;
float fx = (float) (parx + tess.xOffset);
@@ -158,7 +176,7 @@ public class ShadersTess {
// Check if buffer is nearly full
if (rbi >= tess.bufferSize - vertexStride * 4) {
if (tess.bufferSize >= 0x1000000) {
// Max size reached. Just draw.
// Max size reached. Just draw.
if (tess.addedVertices % 4 == 0) {
tess.draw();
tess.isDrawing = true;
@@ -178,7 +196,7 @@ public class ShadersTess {
// shaders mod calculate normal and mid UV
if (tess.drawMode == 7) {
int i = tess.addedVertices % 4;
float[] vertexPos = tess.vertexPos;
float[] vertexPos = tessa.getAngelica$vertexPos();
vertexPos[i * 4 + 0] = fx;
vertexPos[i * 4 + 1] = fy;
vertexPos[i * 4 + 2] = fz;
@@ -195,28 +213,34 @@ public class ShadersTess {
float vnz = x1 * y2 - x2 * y1;
float lensq = vnx * vnx + vny * vny + vnz * vnz;
float mult = (lensq != 0.0) ? (float) (1f / Math.sqrt(lensq)) : 1f;
rawBuffer[rbi + (9 - vertexStride * 3)] = rawBuffer[rbi + (9 - vertexStride * 2)] =
rawBuffer[rbi + (9 - vertexStride * 1)] = Float.floatToRawIntBits(tess.normalX = vnx * mult);
rawBuffer[rbi + (10 - vertexStride * 3)] = rawBuffer[rbi + (10 - vertexStride * 2)] =
rawBuffer[rbi + (10 - vertexStride * 1)] = Float.floatToRawIntBits(tess.normalY = vny * mult);
rawBuffer[rbi + (11 - vertexStride * 3)] = rawBuffer[rbi + (11 - vertexStride * 2)] =
rawBuffer[rbi + (11 - vertexStride * 1)] = Float.floatToRawIntBits(tess.normalZ = vnz * mult);
float normalX = vnx * mult;
float normalY = vny * mult;
float normalZ = vnz * mult;
tessa.setAngelica$normalX(normalX);
tessa.setAngelica$normalY(normalY);
tessa.setAngelica$normalZ(normalZ);
rawBuffer[rbi + (9 - vertexStride * 3)] = rawBuffer[rbi + (9 - vertexStride * 2)] = rawBuffer[rbi
+ (9 - vertexStride * 1)] = Float.floatToRawIntBits(normalX);
rawBuffer[rbi + (10 - vertexStride * 3)] = rawBuffer[rbi + (10 - vertexStride * 2)] = rawBuffer[rbi
+ (10 - vertexStride * 1)] = Float.floatToRawIntBits(normalY);
rawBuffer[rbi + (11 - vertexStride * 3)] = rawBuffer[rbi + (11 - vertexStride * 2)] = rawBuffer[rbi
+ (11 - vertexStride * 1)] = Float.floatToRawIntBits(normalZ);
tess.hasNormals = true;
// mid UV
tess.midTextureU = (Float.intBitsToFloat(rawBuffer[rbi + (3 - vertexStride * 3)])
tessa.setAngelica$midTextureU(
(Float.intBitsToFloat(rawBuffer[rbi + (3 - vertexStride * 3)])
+ Float.intBitsToFloat(rawBuffer[rbi + (3 - vertexStride * 2)])
+ Float.intBitsToFloat(rawBuffer[rbi + (3 - vertexStride * 1)])
+ (float) tess.textureU)
/ 4;
tess.midTextureV = (Float.intBitsToFloat(rawBuffer[rbi + (4 - vertexStride * 3)])
+ (float) tess.textureU) / 4);
tessa.setAngelica$midTextureV(
(Float.intBitsToFloat(rawBuffer[rbi + (4 - vertexStride * 3)])
+ Float.intBitsToFloat(rawBuffer[rbi + (4 - vertexStride * 2)])
+ Float.intBitsToFloat(rawBuffer[rbi + (4 - vertexStride * 1)])
+ (float) tess.textureV)
/ 4;
rawBuffer[rbi + (12 - vertexStride * 3)] = rawBuffer[rbi + (12 - vertexStride * 2)] =
rawBuffer[rbi + (12 - vertexStride * 1)] = Float.floatToRawIntBits(tess.midTextureU);
rawBuffer[rbi + (13 - vertexStride * 3)] = rawBuffer[rbi + (13 - vertexStride * 2)] =
rawBuffer[rbi + (13 - vertexStride * 1)] = Float.floatToRawIntBits(tess.midTextureV);
+ (float) tess.textureV) / 4);
rawBuffer[rbi + (12 - vertexStride * 3)] = rawBuffer[rbi + (12 - vertexStride * 2)] = rawBuffer[rbi
+ (12 - vertexStride * 1)] = Float.floatToRawIntBits(tessa.getAngelica$midTextureU());
rawBuffer[rbi + (13 - vertexStride * 3)] = rawBuffer[rbi + (13 - vertexStride * 2)] = rawBuffer[rbi
+ (13 - vertexStride * 1)] = Float.floatToRawIntBits(tessa.getAngelica$midTextureV());
}
}
// end normal and mid UV calculation
@@ -231,11 +255,11 @@ public class ShadersTess {
rawBuffer[rbi + 6] = tess.brightness;
rawBuffer[rbi + 7] = Shaders.getEntityData();
rawBuffer[rbi + 8] = Shaders.getEntityData2();
rawBuffer[rbi + 9] = Float.floatToRawIntBits((float) tess.normalX);
rawBuffer[rbi + 10] = Float.floatToRawIntBits((float) tess.normalY);
rawBuffer[rbi + 11] = Float.floatToRawIntBits((float) tess.normalZ);
rawBuffer[rbi + 12] = Float.floatToRawIntBits((float) tess.midTextureU);
rawBuffer[rbi + 13] = Float.floatToRawIntBits((float) tess.midTextureV);
rawBuffer[rbi + 9] = Float.floatToRawIntBits((float) tessa.getAngelica$normalX());
rawBuffer[rbi + 10] = Float.floatToRawIntBits((float) tessa.getAngelica$normalY());
rawBuffer[rbi + 11] = Float.floatToRawIntBits((float) tessa.getAngelica$normalZ());
rawBuffer[rbi + 12] = Float.floatToRawIntBits((float) tessa.getAngelica$midTextureU());
rawBuffer[rbi + 13] = Float.floatToRawIntBits((float) ((TessellatorAccessor) tess).getAngelica$midTextureV());
tess.rawBufferIndex = rbi += vertexStride;
++tess.vertexCount;
@@ -10,7 +10,9 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.imageio.ImageIO;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.AbstractTexture;
import net.minecraft.client.renderer.texture.DynamicTexture;
@@ -24,6 +26,7 @@ import net.minecraft.client.renderer.texture.TextureUtil;
import net.minecraft.client.resources.IResource;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
@@ -31,6 +34,7 @@ import org.lwjgl.opengl.GL13;
import org.lwjgl.opengl.GL30.*;
public class ShadersTex {
public static final int initialBufferSize = 1048576;
public static ByteBuffer byteBuffer = BufferUtils.createByteBuffer(initialBufferSize * 4);
public static IntBuffer intBuffer = byteBuffer.asIntBuffer();
@@ -205,7 +209,7 @@ public class ShadersTex {
public static void allocTexStorage(int width, int height, int maxLevel) {
Shaders.checkGLError("pre allocTexStorage");
int level;
for (level = 0; (width >> level) > 0 && (height >> level) > 0 /*&& level<=maxLevel*/; ++level) {
for (level = 0; (width >> level) > 0 && (height >> level) > 0 /* && level<=maxLevel */; ++level) {
GL11.glTexImage2D(
GL11.GL_TEXTURE_2D,
level,
@@ -221,7 +225,7 @@ public class ShadersTex {
Shaders.checkGLError("allocTexStorage");
// clear unused level otherwise glTexSubImage2D will crash on AMD when reallocation texture of different size.
// for ( ; level < 16 ; ++level) {
// GL11.glTexImage2D(GL11.GL_TEXTURE_2D, level, GL11.GL_RGBA, 0, 0, 0, GL12.GL_BGRA,
// GL11.glTexImage2D(GL11.GL_TEXTURE_2D, level, GL11.GL_RGBA, 0, 0, 0, GL12.GL_BGRA,
// GL12.GL_UNSIGNED_INT_8_8_8_8_REV, (IntBuffer)null);
// }
GL11.glGetError(); // It usually returns error 0x0501 Invalid value for width 0 height 0. Ignore it.
@@ -273,10 +277,11 @@ public class ShadersTex {
}
// for TextureMap
public static void allocateTextureMap(
int texID, int mipmapLevels, int width, int height, float anisotropy, Stitcher stitcher, TextureMap tex) {
System.out.println("allocateTextureMap " + tex.getTextureType() + " " + mipmapLevels + " " + width + " "
+ height + " " + anisotropy + " ");
public static void allocateTextureMap(int texID, int mipmapLevels, int width, int height, float anisotropy,
Stitcher stitcher, TextureMap tex) {
System.out.println(
"allocateTextureMap " + tex
.getTextureType() + " " + mipmapLevels + " " + width + " " + height + " " + anisotropy + " ");
updatingTextureMap = tex;
tex.atlasWidth = width;
tex.atlasHeight = height;
@@ -298,8 +303,8 @@ public class ShadersTex {
return iconName = name;
}
public static void uploadTexSubForLoadAtlas(
int[][] data, int width, int height, int xoffset, int yoffset, boolean linear, boolean clamp) {
public static void uploadTexSubForLoadAtlas(int[][] data, int width, int height, int xoffset, int yoffset,
boolean linear, boolean clamp) {
TextureUtil.uploadTextureMipmap(data, width, height, xoffset, yoffset, linear, clamp);
boolean border = updatingSprite.useAnisotropicFiltering;
int[][] aaint;
@@ -319,8 +324,8 @@ public class ShadersTex {
GL11.glBindTexture(GL11.GL_TEXTURE_2D, updatingTex.base);
}
public static int[][] readImageAndMipmaps(
String name, int width, int height, int numLevels, boolean border, int defColor) {
public static int[][] readImageAndMipmaps(String name, int width, int height, int numLevels, boolean border,
int defColor) {
int[][] aaint = new int[numLevels][];
int[] aint;
aaint[0] = aint = new int[width * height];
@@ -350,13 +355,11 @@ public class ShadersTex {
try {
istr = resManager.getResource(resLoc).getInputStream();
image = ImageIO.read(istr);
} catch (IOException e) {
}
} catch (IOException e) {}
if (istr != null) {
try {
istr.close();
} catch (IOException e) {
}
} catch (IOException e) {}
istr = null;
}
}
@@ -375,8 +378,11 @@ public class ShadersTex {
for (y = 0; y < cw; ++y) {
for (x = 0; x < cw; ++x) {
int ppos = y * 2 * pw + x * 2;
aintc[y * cw + x] =
blend4Simple(aintp[ppos], aintp[ppos + 1], aintp[ppos + pw], aintp[ppos + pw + 1]);
aintc[y * cw + x] = blend4Simple(
aintp[ppos],
aintp[ppos + 1],
aintp[ppos + pw],
aintp[ppos + pw + 1]);
}
}
}
@@ -384,8 +390,8 @@ public class ShadersTex {
return data;
}
public static void uploadTexSub(
int[][] data, int width, int height, int xoffset, int yoffset, boolean linear, boolean clamp) {
public static void uploadTexSub(int[][] data, int width, int height, int xoffset, int yoffset, boolean linear,
boolean clamp) {
TextureUtil.uploadTextureMipmap(data, width, height, xoffset, yoffset, linear, clamp);
}
@@ -405,35 +411,26 @@ public class ShadersTex {
a3 = a2 = a1 = a0 = 1;
}
int frac = (dv + 1) / 2;
// return (((Math.min(Math.min(Math.min(a0,a1),a2),a3)/ 4) << 24) |
// return (((Math.min(Math.min(Math.min(a0,a1),a2),a3)/ 4) << 24) |
int color = (an << 24)
| (((((c0 >>> 16) & 255) * a0
+ ((c1 >>> 16) & 255) * a1
+ ((c2 >>> 16) & 255) * a2
+ ((c3 >>> 16) & 255) * a3
+ frac)
/ dv)
<< 16)
| (((((c0 >>> 8) & 255) * a0
+ ((c1 >>> 8) & 255) * a1
+ ((c2 >>> 8) & 255) * a2
+ ((c3 >>> 8) & 255) * a3
+ frac)
/ dv)
<< 8)
| (((((c0 >>> 0) & 255) * a0
+ ((c1 >>> 0) & 255) * a1
+ ((c2 >>> 0) & 255) * a2
+ ((c3 >>> 0) & 255) * a3
+ frac)
/ dv)
<< 0);
| (((((c0 >>> 16) & 255) * a0 + ((c1 >>> 16) & 255) * a1
+ ((c2 >>> 16) & 255) * a2
+ ((c3 >>> 16) & 255) * a3
+ frac) / dv) << 16)
| (((((c0 >>> 8) & 255) * a0 + ((c1 >>> 8) & 255) * a1
+ ((c2 >>> 8) & 255) * a2
+ ((c3 >>> 8) & 255) * a3
+ frac) / dv) << 8)
| (((((c0 >>> 0) & 255) * a0 + ((c1 >>> 0) & 255) * a1
+ ((c2 >>> 0) & 255) * a2
+ ((c3 >>> 0) & 255) * a3
+ frac) / dv) << 0);
return color;
}
public static int blend4Simple(int c0, int c1, int c2, int c3) {
int color = (((((c0 >>> 24) & 255) + ((c1 >>> 24) & 255) + ((c2 >>> 24) & 255) + ((c3 >>> 24) & 255) + 2) / 4)
<< 24)
<< 24)
| (((((c0 >>> 16) & 255) + ((c1 >>> 16) & 255) + ((c2 >>> 16) & 255) + ((c3 >>> 16) & 255) + 2) / 4)
<< 16)
| (((((c0 >>> 8) & 255) + ((c1 >>> 8) & 255) + ((c2 >>> 8) & 255) + ((c3 >>> 8) & 255) + 2) / 4) << 8)
@@ -566,17 +563,25 @@ public class ShadersTex {
Arrays.fill(aint, color);
}
//
// if (page == 0)
// if (page == 0)
genMipmapAlpha(aint, 0, width, height);
// else
// genMipmapSimple(aint,0,width,height);
// else
// genMipmapSimple(aint,0,width,height);
//
for (int level = 0, offset = 0, lw = width, lh = height, px = posX, py = posY; lw > 0 && lh > 0; ++level) {
int lsize = lw * lh;
intBuf.clear();
intBuf.put(aint, offset, lsize).position(0).limit(lsize);
GL11.glTexSubImage2D(
GL11.GL_TEXTURE_2D, level, px, py, lw, lh, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, intBuf);
GL11.GL_TEXTURE_2D,
level,
px,
py,
lw,
lh,
GL12.GL_BGRA,
GL12.GL_UNSIGNED_INT_8_8_8_8_REV,
intBuf);
offset += lsize;
lw /= 2;
lh /= 2;
@@ -592,9 +597,8 @@ public class ShadersTex {
int ch;
int cx;
int cy;
for (level = 0, cw = width, ch = height, cx = posX, cy = posY;
cw > 0 && ch > 0;
++level, cw /= 2, ch /= 2, cx /= 2, cy /= 2) {
for (level = 0, cw = width, ch = height, cx = posX, cy = posY; cw > 0
&& ch > 0; ++level, cw /= 2, ch /= 2, cx /= 2, cy /= 2) {
GL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, level, cx, cy, 0, 0, cw, ch);
}
}
@@ -605,17 +609,20 @@ public class ShadersTex {
IntBuffer intBuf = getIntBuffer(size);
int numLevel = src.length;
for (int level = 0, // offset=0,
lw = width,
lh = height,
px = posX,
py = posY;
lw > 0 && lh > 0 && level < numLevel;
++level) {
lw = width, lh = height, px = posX, py = posY; lw > 0 && lh > 0 && level < numLevel; ++level) {
int lsize = lw * lh;
intBuf.clear();
intBuf.put(src[level], 0 /*offset*/, lsize).position(0).limit(lsize);
intBuf.put(src[level], 0 /* offset */, lsize).position(0).limit(lsize);
GL11.glTexSubImage2D(
GL11.GL_TEXTURE_2D, level, px, py, lw, lh, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, intBuf);
GL11.GL_TEXTURE_2D,
level,
px,
py,
lw,
lh,
GL12.GL_BGRA,
GL12.GL_UNSIGNED_INT_8_8_8_8_REV,
intBuf);
// offset += lsize;
lw /= 2;
lh /= 2;
@@ -627,14 +634,11 @@ public class ShadersTex {
public static void setupTextureMipmap(TextureMap tex) {
/*
MultiTexID multiTex = tex.getMultiTexID();
GL11.glBindTexture(GL11.GL_TEXTURE_2D, multiTex.norm);
GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, multiTex.spec);
GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, multiTex.base);
GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D);
*/
* MultiTexID multiTex = tex.getMultiTexID(); GL11.glBindTexture(GL11.GL_TEXTURE_2D, multiTex.norm);
* GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D); GL11.glBindTexture(GL11.GL_TEXTURE_2D, multiTex.spec);
* GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D); GL11.glBindTexture(GL11.GL_TEXTURE_2D, multiTex.base);
* GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D);
*/
}
public static void updateDynamicTexture(int texID, int[] src, int width, int height, DynamicTexture tex) {
@@ -647,8 +651,8 @@ public class ShadersTex {
updateSubImage1(src, width, height, 0, 0, 0, defBaseTexColor);
}
public static void updateSubImage(
int[] src, int width, int height, int posX, int posY, boolean linear, boolean clamp) {
public static void updateSubImage(int[] src, int width, int height, int posX, int posY, boolean linear,
boolean clamp) {
if (updatingTex != null) {
GL11.glBindTexture(GL11.GL_TEXTURE_2D, updatingTex.norm);
updateSubImage1(src, width, height, posX, posY, 1, defNormTexColor);
@@ -664,24 +668,24 @@ public class ShadersTex {
Iterator<TextureAtlasSprite> iterator;
MultiTexID multiTex = tex.getMultiTexID();
GL11.glBindTexture(GL11.GL_TEXTURE_2D, multiTex.norm);
for (iterator = tasList.iterator(); iterator.hasNext(); ) {
for (iterator = tasList.iterator(); iterator.hasNext();) {
TextureAtlasSprite tas = iterator.next();
tas.updateAnimation();
}
GL11.glBindTexture(GL11.GL_TEXTURE_2D, multiTex.norm);
for (iterator = tasList.iterator(); iterator.hasNext(); ) {
for (iterator = tasList.iterator(); iterator.hasNext();) {
TextureAtlasSprite tas = iterator.next();
tas.updateAnimation();
}
GL11.glBindTexture(GL11.GL_TEXTURE_2D, multiTex.norm);
for (iterator = tasList.iterator(); iterator.hasNext(); ) {
for (iterator = tasList.iterator(); iterator.hasNext();) {
TextureAtlasSprite tas = iterator.next();
tas.updateAnimation();
}
}
public static void setupTexture(
MultiTexID multiTex, int[] src, int width, int height, boolean linear, boolean clamp) {
public static void setupTexture(MultiTexID multiTex, int[] src, int width, int height, boolean linear,
boolean clamp) {
int mmfilter = linear ? GL11.GL_LINEAR : GL11.GL_NEAREST;
int wraptype = clamp ? GL11.GL_CLAMP : GL11.GL_REPEAT;
int size = width * height;
@@ -743,8 +747,8 @@ public class ShadersTex {
}
/* currently not used */
public static void updateSubImage(
MultiTexID multiTex, int[] src, int width, int height, int posX, int posY, boolean linear, boolean clamp) {
public static void updateSubImage(MultiTexID multiTex, int[] src, int width, int height, int posX, int posY,
boolean linear, boolean clamp) {
int size = width * height;
IntBuffer intBuf = getIntBuffer(size);
//
@@ -816,24 +820,28 @@ public class ShadersTex {
return new ResourceLocation(location.getResourceDomain(), basenameNoFileType + "_" + mapName + ".png");
}
public static void loadNSMap(
IResourceManager manager, ResourceLocation location, int width, int height, int[] aint) {
if (Shaders.configNormalMap)
ShadersTex.loadNSMap1(
manager, getNSMapLocation(location, "n"), width, height, aint, width * height, defNormTexColor);
if (Shaders.configSpecularMap)
ShadersTex.loadNSMap1(
manager, getNSMapLocation(location, "s"), width, height, aint, width * height * 2, defSpecTexColor);
public static void loadNSMap(IResourceManager manager, ResourceLocation location, int width, int height,
int[] aint) {
if (Shaders.configNormalMap) ShadersTex.loadNSMap1(
manager,
getNSMapLocation(location, "n"),
width,
height,
aint,
width * height,
defNormTexColor);
if (Shaders.configSpecularMap) ShadersTex.loadNSMap1(
manager,
getNSMapLocation(location, "s"),
width,
height,
aint,
width * height * 2,
defSpecTexColor);
}
public static void loadNSMap1(
IResourceManager manager,
ResourceLocation location,
int width,
int height,
int[] aint,
int offset,
int defaultColor) {
public static void loadNSMap1(IResourceManager manager, ResourceLocation location, int width, int height,
int[] aint, int offset, int defaultColor) {
boolean good = false;
try {
IResource res = manager.getResource(location);
@@ -842,25 +850,19 @@ public class ShadersTex {
bufferedimage.getRGB(0, 0, width, height, aint, offset, width);
good = true;
}
} catch (IOException ex) {
}
} catch (IOException ex) {}
if (!good) {
java.util.Arrays.fill(aint, offset, offset + width * height, defaultColor);
}
}
/** init and upload from BufferedImage */
/* Replacement for TextureUtil.func_110989_a call in SimpleTexture.func_110551_a.
Keep par0...par5 the same as func_110989_a for easy patching.
More parameters added for reading N-S-Map. */
public static int loadSimpleTexture(
int textureID,
BufferedImage bufferedimage,
boolean linear,
boolean clamp,
IResourceManager resourceManager,
ResourceLocation location,
MultiTexID multiTex) {
/*
* Replacement for TextureUtil.func_110989_a call in SimpleTexture.func_110551_a. Keep par0...par5 the same as
* func_110989_a for easy patching. More parameters added for reading N-S-Map.
*/
public static int loadSimpleTexture(int textureID, BufferedImage bufferedimage, boolean linear, boolean clamp,
IResourceManager resourceManager, ResourceLocation location, MultiTexID multiTex) {
int width = bufferedimage.getWidth();
int height = bufferedimage.getHeight();
int size = width * height;
@@ -887,7 +889,7 @@ public class ShadersTex {
int size = 0;
int[] image = null;
Iterator<String> iterator;
for (iterator = list.iterator(); iterator.hasNext(); ) {
for (iterator = list.iterator(); iterator.hasNext();) {
String s = iterator.next();
if (s != null) {
try {
@@ -929,22 +931,34 @@ public class ShadersTex {
// base texture
GL11.glBindTexture(GL11.GL_TEXTURE_2D, multiTex.base);
GL11.glTexParameteri(
GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, Shaders.texMinFilValue[Shaders.configTexMinFilB]);
GL11.GL_TEXTURE_2D,
GL11.GL_TEXTURE_MIN_FILTER,
Shaders.texMinFilValue[Shaders.configTexMinFilB]);
GL11.glTexParameteri(
GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, Shaders.texMagFilValue[Shaders.configTexMagFilB]);
GL11.GL_TEXTURE_2D,
GL11.GL_TEXTURE_MAG_FILTER,
Shaders.texMagFilValue[Shaders.configTexMagFilB]);
// norm texture
GL11.glBindTexture(GL11.GL_TEXTURE_2D, multiTex.norm);
GL11.glTexParameteri(
GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, Shaders.texMinFilValue[Shaders.configTexMinFilN]);
GL11.GL_TEXTURE_2D,
GL11.GL_TEXTURE_MIN_FILTER,
Shaders.texMinFilValue[Shaders.configTexMinFilN]);
GL11.glTexParameteri(
GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, Shaders.texMagFilValue[Shaders.configTexMagFilN]);
GL11.GL_TEXTURE_2D,
GL11.GL_TEXTURE_MAG_FILTER,
Shaders.texMagFilValue[Shaders.configTexMagFilN]);
// spec texture
GL11.glBindTexture(GL11.GL_TEXTURE_2D, multiTex.spec);
GL11.glTexParameteri(
GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, Shaders.texMinFilValue[Shaders.configTexMinFilS]);
GL11.GL_TEXTURE_2D,
GL11.GL_TEXTURE_MIN_FILTER,
Shaders.texMinFilValue[Shaders.configTexMinFilS]);
GL11.glTexParameteri(
GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, Shaders.texMagFilValue[Shaders.configTexMagFilS]);
GL11.GL_TEXTURE_2D,
GL11.GL_TEXTURE_MAG_FILTER,
Shaders.texMagFilValue[Shaders.configTexMagFilS]);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);
}
@@ -960,8 +974,8 @@ public class ShadersTex {
return manager.getResource(location);
}
public static int[] loadAtlasSprite(
BufferedImage bufferedimage, int startX, int startY, int w, int h, int[] aint, int offset, int scansize) {
public static int[] loadAtlasSprite(BufferedImage bufferedimage, int startX, int startY, int w, int h, int[] aint,
int offset, int scansize) {
imageSize = w * h;
bufferedimage.getRGB(startX, startY, w, h, aint, offset, scansize);
loadNSMap(resManager, resLocation, w, h, aint);
@@ -1,55 +0,0 @@
package com.gtnewhorizons.angelica.loading;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.launchwrapper.ITweaker;
import net.minecraft.launchwrapper.Launch;
import net.minecraft.launchwrapper.LaunchClassLoader;
public class ATweaker implements ITweaker {
public List<String> args;
public File gameDir;
public File assetsDir;
public String version;
@Override
public void acceptOptions(List<String> args, File gameDir, File assetsDir, String version) {
this.args = args;
this.gameDir = gameDir;
this.assetsDir = assetsDir;
this.version = version;
}
@Override
public void injectIntoClassLoader(LaunchClassLoader launchClassLoader) {
launchClassLoader.addTransformerExclusion("com.gtnewhorizons.angelica.loading.");
launchClassLoader.addTransformerExclusion("com.gtnewhorizons.angelica.transform.");
launchClassLoader.registerTransformer("com.gtnewhorizons.angelica.transform.AClassTransformer");
}
@Override
public String[] getLaunchArguments() {
ArrayList argumentList = (ArrayList) Launch.blackboard.get("ArgumentList");
if (argumentList.isEmpty()) {
List<String> argsList = new ArrayList();
if (gameDir != null) {
argumentList.add("--gameDir");
argumentList.add(gameDir.getPath());
}
if (assetsDir != null) {
argumentList.add("--assetsDir");
argumentList.add(assetsDir.getPath());
}
argumentList.add("--version");
argumentList.add(version);
argumentList.addAll(args);
}
return new String[0];
}
@Override
public String getLaunchTarget() {
return "net.minecraft.client.main.Main";
}
}
@@ -0,0 +1,75 @@
package com.gtnewhorizons.angelica.loading;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.spongepowered.asm.launch.GlobalProperties;
import org.spongepowered.asm.service.mojang.MixinServiceLaunchWrapper;
import com.gtnewhorizon.gtnhmixins.IEarlyMixinLoader;
import com.gtnewhorizons.angelica.mixins.Mixins;
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
@IFMLLoadingPlugin.MCVersion("1.7.10")
@IFMLLoadingPlugin.SortingIndex(1100)
public class AngelicaTweaker implements IFMLLoadingPlugin, IEarlyMixinLoader {
public static final Logger log = LogManager.getLogger("AngelicaTweaker");
@Override
public String[] getASMTransformerClass() {
List<String> tweakClasses = GlobalProperties.get(MixinServiceLaunchWrapper.BLACKBOARD_KEY_TWEAKCLASSES);
if (tweakClasses != null) {
tweakClasses.add(MixinCompatHackTweaker.class.getName());
}
return null;
}
@Override
public String getModContainerClass() {
return null;
}
@Override
public String getSetupClass() {
return null;
}
@Override
public void injectData(Map<String, Object> data) {
// no-op
}
@Override
public String getAccessTransformerClass() {
return null;
}
@Override
public String getMixinConfig() {
return "mixins.angelica.early.json";
}
@Override
public List<String> getMixins(Set<String> loadedCoreMods) {
final List<String> mixins = new ArrayList<>();
final List<String> notLoading = new ArrayList<>();
for (Mixins mixin : Mixins.values()) {
if (mixin.phase == Mixins.Phase.EARLY) {
if (mixin.shouldLoad(loadedCoreMods, Collections.emptySet())) {
mixins.addAll(mixin.mixinClasses);
} else {
notLoading.addAll(mixin.mixinClasses);
}
}
}
log.info("Not loading the following EARLY mixins: {}", notLoading.toString());
return mixins;
}
}
@@ -0,0 +1,54 @@
package com.gtnewhorizons.angelica.loading;
import java.io.File;
import java.lang.reflect.Field;
import java.util.List;
import net.minecraft.launchwrapper.IClassTransformer;
import net.minecraft.launchwrapper.ITweaker;
import net.minecraft.launchwrapper.Launch;
import net.minecraft.launchwrapper.LaunchClassLoader;
import com.gtnewhorizons.angelica.transform.AClassTransformer;
import com.gtnewhorizons.angelica.transform.ALog;
import cpw.mods.fml.common.asm.transformers.TerminalTransformer;
public class MixinCompatHackTweaker implements ITweaker {
@Override
public void acceptOptions(List<String> args, File gameDir, File assetsDir, String profile) {
LaunchClassLoader lcl = Launch.classLoader;
try {
Field xformersField = lcl.getClass().getDeclaredField("transformers");
xformersField.setAccessible(true);
@SuppressWarnings("unchecked")
List<IClassTransformer> xformers = (List<IClassTransformer>) xformersField.get(lcl);
int terminalIndex;
for (terminalIndex = 1; terminalIndex < xformers.size(); terminalIndex++) {
if (xformers.get(terminalIndex) instanceof TerminalTransformer) {
break;
}
}
xformers.add(terminalIndex - 1, new AClassTransformer());
ALog.info("Hacked in asm class transformer in position %d", terminalIndex - 1);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
@Override
public void injectIntoClassLoader(LaunchClassLoader classLoader) {
// no-op
}
@Override
public String getLaunchTarget() {
return null;
}
@Override
public String[] getLaunchArguments() {
return new String[0];
}
}
@@ -0,0 +1,170 @@
package com.gtnewhorizons.angelica.mixins;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.function.Supplier;
import cpw.mods.fml.relauncher.FMLLaunchHandler;
public enum Mixins {
ANGELICA_STARTUP(new Builder("Start Angelica").addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT)
.setPhase(Phase.EARLY).addMixinClasses("shaders.MixinMinecraft").setApplyIf(() -> true)),
ANGELICA_ACCESSORS(new Builder("Angelica Accessors").addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT)
.setPhase(Phase.EARLY)
.addMixinClasses(
"accessors.ModelRendererAccessor",
"accessors.RendererEntityLivingAccessor",
"accessors.WorldRenderersAccessor")
.setApplyIf(() -> true)),
ANGELICA_SHADERS_BUTTON(new Builder("Add Shaders Button").addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT)
.setPhase(Phase.EARLY).addMixinClasses("settings.MixinGuiVideoSettings").setApplyIf(() -> true)),
ANGELICA_LIGHTING(
new Builder("Lighting").addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT).setPhase(Phase.EARLY)
.addMixinClasses("lighting.MixinBlock", "lighting.MixinRenderBlocks").setApplyIf(() -> true)),
ANGELICA_RENDERER(
new Builder("Renderer").addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT).setPhase(Phase.EARLY)
.addMixinClasses(
"renderer.MixinOpenGlHelper",
"renderer.MixinEntityRender",
"renderer.MixinEntityRenderer",
"renderer.MixinRenderBlocks",
"renderer.MixinRenderGlobal",
"renderer.MixinModelRenderer",
"renderer.MixinTextureClock",
"renderer.MixinTextureCompass",
"renderer.MixinSimpleTexture",
"renderer.MixinTessellator")
.setApplyIf(() -> true))
;
public final String name;
public final List<String> mixinClasses;
private final Supplier<Boolean> applyIf;
public final Phase phase;
private final Side side;
public final List<TargetedMod> targetedMods;
public final List<TargetedMod> excludedMods;
private static class Builder {
private final String name;
private final List<String> mixinClasses = new ArrayList<>();
private Supplier<Boolean> applyIf;
private Side side = Side.BOTH;
private Phase phase = Phase.LATE;
private final List<TargetedMod> targetedMods = new ArrayList<>();
private final List<TargetedMod> excludedMods = new ArrayList<>();
public Builder(String name) {
this.name = name;
}
public Builder addMixinClasses(String... mixinClasses) {
this.mixinClasses.addAll(Arrays.asList(mixinClasses));
return this;
}
public Builder setPhase(Phase phase) {
this.phase = phase;
return this;
}
public Builder setSide(Side side) {
this.side = side;
return this;
}
public Builder setApplyIf(Supplier<Boolean> applyIf) {
this.applyIf = applyIf;
return this;
}
public Builder addTargetedMod(TargetedMod mod) {
this.targetedMods.add(mod);
return this;
}
public Builder addExcludedMod(TargetedMod mod) {
this.excludedMods.add(mod);
return this;
}
}
Mixins(Builder builder) {
this.name = builder.name;
this.mixinClasses = builder.mixinClasses;
this.applyIf = builder.applyIf;
this.side = builder.side;
this.targetedMods = builder.targetedMods;
this.excludedMods = builder.excludedMods;
this.phase = builder.phase;
if (this.targetedMods.isEmpty()) {
throw new RuntimeException("No targeted mods specified for " + this.name);
}
if (this.applyIf == null) {
throw new RuntimeException("No ApplyIf function specified for " + this.name);
}
}
private boolean shouldLoadSide() {
return (side == Side.BOTH || (side == Side.SERVER && FMLLaunchHandler.side().isServer())
|| (side == Side.CLIENT && FMLLaunchHandler.side().isClient()));
}
private boolean allModsLoaded(List<TargetedMod> targetedMods, Set<String> loadedCoreMods, Set<String> loadedMods) {
if (targetedMods.isEmpty()) return false;
for (TargetedMod target : targetedMods) {
if (target == TargetedMod.VANILLA) continue;
// Check coremod first
if (!loadedCoreMods.isEmpty() && target.coreModClass != null
&& !loadedCoreMods.contains(target.coreModClass))
return false;
else if (!loadedMods.isEmpty() && target.modId != null && !loadedMods.contains(target.modId)) return false;
}
return true;
}
private boolean noModsLoaded(List<TargetedMod> targetedMods, Set<String> loadedCoreMods, Set<String> loadedMods) {
if (targetedMods.isEmpty()) return true;
for (TargetedMod target : targetedMods) {
if (target == TargetedMod.VANILLA) continue;
// Check coremod first
if (!loadedCoreMods.isEmpty() && target.coreModClass != null
&& loadedCoreMods.contains(target.coreModClass))
return false;
else if (!loadedMods.isEmpty() && target.modId != null && loadedMods.contains(target.modId)) return false;
}
return true;
}
public boolean shouldLoad(Set<String> loadedCoreMods, Set<String> loadedMods) {
return (shouldLoadSide() && applyIf.get()
&& allModsLoaded(targetedMods, loadedCoreMods, loadedMods)
&& noModsLoaded(excludedMods, loadedCoreMods, loadedMods));
}
enum Side {
BOTH,
CLIENT,
SERVER
}
public enum Phase {
EARLY,
LATE,
}
}
@@ -0,0 +1,32 @@
package com.gtnewhorizons.angelica.mixins;
public enum TargetedMod {
VANILLA("Minecraft", null),
FASTCRAFT("FastCraft", "fastcraft.Tweaker"),
OPTIFINE("Optifine", "optifine.OptiFineForgeTweaker", "Optifine"),
GTNHLIB("GTNHLib", "com.gtnewhorizon.gtnhlib.core.GTNHLibCore", "gtnhlib"),
LWJGL3IFY("lwjgl3ify", "me.eigenraven.lwjgl3ify.core.Lwjgl3ifyCoremod", "lwjgl3ify");
/** The "name" in the @Mod annotation */
public final String modName;
/** Class that implements the IFMLLoadingPlugin interface */
public final String coreModClass;
/** The "modid" in the @Mod annotation */
public final String modId;
TargetedMod(String modName, String coreModClass) {
this(modName, coreModClass, null);
}
TargetedMod(String modName, String coreModClass, String modId) {
this.modName = modName;
this.coreModClass = coreModClass;
this.modId = modId;
}
@Override
public String toString() {
return "TargetedMod{modName='" + modName + "', coreModClass='" + coreModClass + "', modId='" + modId + "'}";
}
}
@@ -0,0 +1,23 @@
package com.gtnewhorizons.angelica.mixins.early.accessors;
import net.minecraft.client.model.ModelRenderer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
@Mixin(ModelRenderer.class)
public interface ModelRendererAccessor {
@Accessor()
boolean getCompiled();
@Accessor()
int getDisplayList();
@Accessor()
void setCompiled(boolean compiled);
@Accessor()
void setDisplayList(int displayList);
}
@@ -0,0 +1,17 @@
package com.gtnewhorizons.angelica.mixins.early.accessors;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.entity.RendererLivingEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
@Mixin(RendererLivingEntity.class)
public interface RendererEntityLivingAccessor {
@Accessor
ModelBase getMainModel();
@Accessor
ModelBase getRenderPassModel();
}
@@ -0,0 +1,14 @@
package com.gtnewhorizons.angelica.mixins.early.accessors;
import net.minecraft.client.renderer.RenderGlobal;
import net.minecraft.client.renderer.WorldRenderer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
@Mixin(RenderGlobal.class)
public interface WorldRenderersAccessor {
@Accessor
WorldRenderer[] getWorldRenderers();
}
@@ -0,0 +1,19 @@
package com.gtnewhorizons.angelica.mixins.early.lighting;
import net.minecraft.block.Block;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
import com.gtnewhorizons.angelica.client.Shaders;
@Mixin(Block.class)
public class MixinBlock {
@ModifyConstant(method = "getAmbientOcclusionLightValue()F", constant = @Constant(floatValue = 0.2f))
public float angelica$blockAoLight(float constant) {
return Shaders.blockAoLight;
}
}
@@ -0,0 +1,109 @@
package com.gtnewhorizons.angelica.mixins.early.lighting;
import net.minecraft.client.renderer.RenderBlocks;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
import org.spongepowered.asm.mixin.injection.Slice;
import com.gtnewhorizons.angelica.client.Shaders;
@Mixin(RenderBlocks.class)
public class MixinRenderBlocks {
// All of these expect 1 replacement only
@ModifyConstant(
method = { "renderBlockBed(Lnet/minecraft/block/Block;III)Z",
"renderBlockDoor(Lnet/minecraft/block/Block;III)Z",
"renderBlockLiquid(Lnet/minecraft/block/Block;III)Z",
"renderBlockCactusImpl(Lnet/minecraft/block/Block;IIIFFF)Z",
"renderStandardBlockWithColorMultiplier(Lnet/minecraft/block/Block;IIIFFF)Z",
"renderBlockSandFalling(Lnet/minecraft/block/Block;Lnet/minecraft/world/World;IIII)V" },
constant = @Constant(floatValue = 0.5F),
expect = 1)
public float angelica$blockSingleLightLevel05(float constant) {
return Shaders.blockLightLevel05;
}
@ModifyConstant(
method = { "renderBlockBed(Lnet/minecraft/block/Block;III)Z",
"renderBlockLiquid(Lnet/minecraft/block/Block;III)Z",
"renderBlockDoor(Lnet/minecraft/block/Block;III)Z",
"renderBlockCactusImpl(Lnet/minecraft/block/Block;IIIFFF)Z",
"renderStandardBlockWithColorMultiplier(Lnet/minecraft/block/Block;IIIFFF)Z",
"renderBlockSandFalling(Lnet/minecraft/block/Block;Lnet/minecraft/world/World;IIII)V" },
constant = @Constant(floatValue = 0.6F),
expect = 1)
public float angelica$blockSingleLightLevel06(float constant) {
return Shaders.blockLightLevel06;
}
@ModifyConstant(
method = { "renderBlockBed(Lnet/minecraft/block/Block;III)Z",
"renderBlockLiquid(Lnet/minecraft/block/Block;III)Z",
"renderBlockDoor(Lnet/minecraft/block/Block;III)Z",
"renderBlockCactusImpl(Lnet/minecraft/block/Block;IIIFFF)Z",
"renderStandardBlockWithColorMultiplier(Lnet/minecraft/block/Block;IIIFFF)Z",
"renderBlockSandFalling(Lnet/minecraft/block/Block;Lnet/minecraft/world/World;IIII)V" },
constant = @Constant(floatValue = 0.8F),
expect = 1)
public float angelica$blockSingleLightLevel08(float constant) {
return Shaders.blockLightLevel08;
}
// Piston Extension - Differing expectations, and slicing required
@ModifyConstant(
method = "renderPistonExtension(Lnet/minecraft/block/Block;IIIZ)Z",
constant = @Constant(floatValue = 0.5F),
expect = 3,
slice = @Slice(from = @At(value = "CONSTANT", args = "doubleValue=8.0D", ordinal = 0)))
public float angelica$pistonBlockLightLevel05(float constant) {
return Shaders.blockLightLevel05;
}
@ModifyConstant(
method = "renderPistonExtension(Lnet/minecraft/block/Block;IIIZ)Z",
constant = @Constant(floatValue = 0.6F),
expect = 12)
public float angelica$pistonBlockLightLevel06(float constant) {
return Shaders.blockLightLevel06;
}
@ModifyConstant(
method = "renderPistonExtension(Lnet/minecraft/block/Block;IIIZ)Z",
constant = @Constant(floatValue = 0.8F),
expect = 4)
public float angelica$pistonBlockLightLevel08(float constant) {
return Shaders.blockLightLevel08;
}
// BlockWithAmbientOcclusion
@ModifyConstant(
method = { "renderStandardBlockWithAmbientOcclusionPartial(Lnet/minecraft/block/Block;IIIFFF)Z",
"renderStandardBlockWithAmbientOcclusion(Lnet/minecraft/block/Block;IIIFFF)Z" },
constant = @Constant(floatValue = 0.5F))
public float angelica$multipleBlockLightLevel05(float constant) {
return Shaders.blockLightLevel05;
}
@ModifyConstant(
method = { "renderStandardBlockWithAmbientOcclusionPartial(Lnet/minecraft/block/Block;IIIFFF)Z",
"renderStandardBlockWithAmbientOcclusion(Lnet/minecraft/block/Block;IIIFFF)Z" },
constant = @Constant(floatValue = 0.6F))
public float angelica$multipleBlockLightLevel06(float constant) {
return Shaders.blockLightLevel06;
}
@ModifyConstant(
method = { "renderStandardBlockWithAmbientOcclusionPartial(Lnet/minecraft/block/Block;IIIFFF)Z",
"renderStandardBlockWithAmbientOcclusion(Lnet/minecraft/block/Block;IIIFFF)Z" },
constant = @Constant(floatValue = 0.8F))
public float angelica$multipleBlockLightLevel08(float constant) {
return Shaders.blockLightLevel08;
}
}
@@ -0,0 +1,19 @@
package com.gtnewhorizons.angelica.mixins.early.renderer;
import net.minecraft.client.renderer.entity.Render;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.gtnewhorizons.angelica.client.Shaders;
@Mixin(Render.class)
public class MixinEntityRender {
@Inject(method = "renderShadow(Lnet/minecraft/entity/Entity;DDDFF)V", at = @At("HEAD"), cancellable = true)
public void angelica$checkSkipShadow(CallbackInfo ci) {
if (Shaders.shouldSkipDefaultShadow) ci.cancel();
}
}
@@ -0,0 +1,56 @@
package com.gtnewhorizons.angelica.mixins.early.renderer;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.renderer.ItemRenderer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.gtnewhorizons.angelica.client.Shaders;
import com.gtnewhorizons.angelica.client.ShadersRender;
@Mixin(EntityRenderer.class)
public abstract class MixinEntityRenderer {
@Shadow
public abstract void disableLightmap(double p_78483_1_);
@Inject(
method = "Lnet/minecraft/client/renderer/EntityRenderer;renderHand(FI)V",
at = @At(
value = "INVOKE",
shift = At.Shift.BEFORE,
target = "Lorg/lwjgl/util/glu/Project;gluPerspective(FFFF)V",
remap = false))
public void angelica$applyHandDepth(CallbackInfo ci) {
Shaders.applyHandDepth();
}
@Inject(
method = "Lnet/minecraft/client/renderer/EntityRenderer;renderHand(FI)V",
at = @At(
value = "FIELD",
shift = At.Shift.BEFORE,
target = "Lnet/minecraft/client/settings/GameSettings;thirdPersonView:I",
ordinal = 1),
cancellable = true)
public void angelica$checkCompositeRendered(float p_78476_1_, int p_78476_2_, CallbackInfo ci) {
if (!Shaders.isCompositeRendered) {
ci.cancel();
}
this.disableLightmap(p_78476_1_);
}
@Redirect(
method = "Lnet/minecraft/client/renderer/EntityRenderer;renderHand(FI)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/ItemRenderer;renderItemInFirstPerson(F)V"))
public void angelica$renderItemInFirstPerson(ItemRenderer itemRenderer, float partialTicks) {
ShadersRender.renderItemFP(itemRenderer, partialTicks);
}
}
@@ -0,0 +1,27 @@
package com.gtnewhorizons.angelica.mixins.early.renderer;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.renderer.GLAllocation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import com.gtnewhorizons.angelica.mixins.interfaces.IModelRenderer;
@Mixin(ModelRenderer.class)
public class MixinModelRenderer implements IModelRenderer {
@Shadow
private boolean compiled;
@Shadow
private int displayList;
public void resetDisplayList() {
if (!compiled && displayList != 0) {
GLAllocation.deleteDisplayLists(displayList);
displayList = 0;
compiled = false;
}
}
}
@@ -0,0 +1,19 @@
package com.gtnewhorizons.angelica.mixins.early.renderer;
import net.minecraft.client.renderer.OpenGlHelper;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.gtnewhorizons.angelica.client.Shaders;
@Mixin(OpenGlHelper.class)
public class MixinOpenGlHelper {
@Inject(method = "setActiveTexture(I)V", at = @At("HEAD"))
private static void angelica$setActiveTexUnit(int activeTexture, CallbackInfo ci) {
Shaders.activeTexUnit = activeTexture;
}
}
@@ -0,0 +1,68 @@
package com.gtnewhorizons.angelica.mixins.early.renderer;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFlowerPot;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.item.Item;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import com.gtnewhorizon.mixinextras.injector.wrapoperation.Operation;
import com.gtnewhorizon.mixinextras.injector.wrapoperation.WrapOperation;
import com.gtnewhorizons.angelica.client.Shaders;
@Mixin(RenderBlocks.class)
public class MixinRenderBlocks {
// Block
@Inject(method = "renderBlockByRenderType(Lnet/minecraft/block/Block;III)Z", at = @At("HEAD"))
private void angelica$injectShadersBlockPushEntity(Block block, int x, int y, int z,
CallbackInfoReturnable<Boolean> cir) {
Shaders.pushEntity((RenderBlocks) ((Object) this), block, x, y, z);
}
@Inject(method = "renderBlockByRenderType(Lnet/minecraft/block/Block;III)Z", at = @At("RETURN"))
private void angelica$injectShadersPopEntityBlock(Block block, int x, int y, int z,
CallbackInfoReturnable<Boolean> cir) {
Shaders.popEntity();
}
// BlockFlowerPot
@Inject(method = "renderBlockFlowerpot(Lnet/minecraft/block/BlockFlowerPot;III)Z", at = @At("HEAD"))
private void angelica$injectShadersFlowerpotPushEntity(BlockFlowerPot blockFlowerPot, int x, int y, int z,
CallbackInfoReturnable<Boolean> cir) {
Shaders.pushEntity((RenderBlocks) ((Object) this), blockFlowerPot, x, y, z);
}
@Inject(method = "renderBlockFlowerpot(Lnet/minecraft/block/BlockFlowerPot;III)Z", at = @At("RETURN"))
private void angelica$injectShadersFlowerpotPopEntity(BlockFlowerPot blockFlowerPot, int x, int y, int z,
CallbackInfoReturnable<Boolean> cir) {
Shaders.popEntity();
}
@WrapOperation(
method = "renderBlockFlowerpot(Lnet/minecraft/block/BlockFlowerPot;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/block/Block;getBlockFromItem(Lnet/minecraft/item/Item;)Lnet/minecraft/block/Block;"))
private Block angelica$injectShadersFlowerpotItemBlockPushEntity(Item itemIn, Operation<Block> original) {
final Block block = original.call(itemIn);
Shaders.pushEntity(block);
return block;
}
@Inject(
method = "renderBlockFlowerpot(Lnet/minecraft/block/BlockFlowerPot;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;addTranslation(FFF)V",
shift = At.Shift.AFTER,
ordinal = 1))
private void angelica$injectShadersFlowerpotItemBlockPopEntity(BlockFlowerPot blockFlowerPot, int x, int y, int z,
CallbackInfoReturnable<Boolean> cir) {
Shaders.popEntity();
}
}
@@ -0,0 +1,249 @@
package com.gtnewhorizons.angelica.mixins.early.renderer;
import net.minecraft.client.renderer.RenderGlobal;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.culling.ICamera;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.MovingObjectPosition;
import org.lwjgl.opengl.GL11;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import com.gtnewhorizon.mixinextras.injector.wrapoperation.Operation;
import com.gtnewhorizon.mixinextras.injector.wrapoperation.WrapOperation;
import com.gtnewhorizons.angelica.client.Shaders;
@Mixin(RenderGlobal.class)
public class MixinRenderGlobal {
@Inject(
method = "renderEntities(Lnet/minecraft/entity/EntityLivingBase;Lnet/minecraft/client/renderer/culling/ICamera;F)V",
at = @At(
value = "INVOKE_STRING",
target = "Lnet/minecraft/profiler/Profiler;endStartSection(Ljava/lang/String;)V",
args = "ldc=entities"))
private void angelica$beginEntities(EntityLivingBase entity, ICamera camera, float p_147589_3_, CallbackInfo ci) {
Shaders.beginEntities();
}
@Inject(
method = "renderEntities(Lnet/minecraft/entity/EntityLivingBase;Lnet/minecraft/client/renderer/culling/ICamera;F)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/entity/RenderManager;renderEntitySimple(Lnet/minecraft/entity/Entity;F)Z",
ordinal = 1,
shift = At.Shift.AFTER))
private void angelica$nextEntity(EntityLivingBase entity, ICamera camera, float p_147589_3_, CallbackInfo ci) {
Shaders.nextEntity();
}
@Inject(
method = "renderEntities(Lnet/minecraft/entity/EntityLivingBase;Lnet/minecraft/client/renderer/culling/ICamera;F)V",
at = @At(
value = "INVOKE_STRING",
target = "Lnet/minecraft/profiler/Profiler;endStartSection(Ljava/lang/String;)V",
args = "ldc=blockentities",
shift = At.Shift.AFTER))
private void angelica$blockEntities(EntityLivingBase entity, ICamera camera, float p_147589_3_, CallbackInfo ci) {
Shaders.endEntities();
Shaders.beginBlockEntities();
}
@Inject(
method = "Lnet/minecraft/client/renderer/RenderGlobal;renderEntities(Lnet/minecraft/entity/EntityLivingBase;Lnet/minecraft/client/renderer/culling/ICamera;F)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/EntityRenderer;disableLightmap(D)V",
shift = At.Shift.AFTER))
private void angelica$endBlockEntities(EntityLivingBase entity, ICamera camera, float p_147589_3_,
CallbackInfo ci) {
Shaders.endBlockEntities();
}
// Texture 2D
@Inject(
method = "sortAndRender(Lnet/minecraft/entity/EntityLivingBase;ID)I",
at = @At(
value = "INVOKE",
target = "Lorg/lwjgl/opengl/GL11;glDisable(I)V",
remap = false,
ordinal = 0,
shift = At.Shift.AFTER),
expect = 1)
private void angelica$sortandRenderDisableTexture2D(EntityLivingBase p_72719_1_, int p_72719_2_, double p_72719_3_,
CallbackInfoReturnable<Integer> cir) {
Shaders.disableTexture2D();
}
@Inject(
method = "drawSelectionBox(Lnet/minecraft/entity/player/EntityPlayer;Lnet/minecraft/util/MovingObjectPosition;IF)V",
at = @At(
value = "INVOKE",
target = "Lorg/lwjgl/opengl/GL11;glDisable(I)V",
remap = false,
ordinal = 0,
shift = At.Shift.AFTER),
expect = 1)
private void angelica$drawSelectionBoxDisableTexture2D(CallbackInfo ci) {
Shaders.disableTexture2D();
}
@Inject(
method = "sortAndRender(Lnet/minecraft/entity/EntityLivingBase;ID)I",
at = @At(
value = "INVOKE",
target = "Lorg/lwjgl/opengl/GL11;glEnable(I)V",
remap = false,
ordinal = 0,
shift = At.Shift.AFTER))
private void angelica$sortAndRenderEnableTexture2D(CallbackInfoReturnable<Integer> cir) {
Shaders.enableTexture2D();
}
@Inject(
method = "drawSelectionBox(Lnet/minecraft/entity/player/EntityPlayer;Lnet/minecraft/util/MovingObjectPosition;IF)V",
at = @At(
value = "INVOKE",
target = "Lorg/lwjgl/opengl/GL11;glEnable(I)V",
remap = false,
ordinal = 1,
shift = At.Shift.AFTER),
expect = 1)
private void angelica$drawSelectionBoxEnableTexture2D(EntityPlayer p_72731_1_, MovingObjectPosition p_72731_2_,
int p_72731_3_, float p_72731_4_, CallbackInfo ci) {
Shaders.enableTexture2D();
}
// Fog
@Inject(
method = "sortAndRender(Lnet/minecraft/entity/EntityLivingBase;ID)I",
at = @At(
value = "INVOKE",
target = "Lorg/lwjgl/opengl/GL11;glDisable(I)V",
remap = false,
ordinal = 3,
shift = At.Shift.AFTER))
private void angelica$sortAndRenderDisableFog(CallbackInfoReturnable<Integer> cir) {
Shaders.disableFog();
}
@Inject(
method = "sortAndRender(Lnet/minecraft/entity/EntityLivingBase;ID)I",
at = @At(
value = "INVOKE",
target = "Lorg/lwjgl/opengl/GL11;glEnable(I)V",
remap = false,
ordinal = 2,
shift = At.Shift.AFTER))
private void angelica$sortAndRenderEnableFog(CallbackInfoReturnable<Integer> cir) {
Shaders.enableFog();
}
// RenderSky
@WrapOperation(
method = "renderSky(F)V",
at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glDisable(I)V", remap = false))
private void angelica$renderSkyDisable(int cap, Operation<Void> original) {
original.call(cap);
if (cap == GL11.GL_FOG) Shaders.disableFog();
else if (cap == GL11.GL_TEXTURE_2D) Shaders.disableTexture2D();
}
@WrapOperation(
method = "renderSky(F)V",
at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glEnable(I)V", remap = false))
private void angelica$renderSkyEnable(int cap, Operation<Void> original) {
original.call(cap);
if (cap == GL11.GL_FOG) Shaders.enableFog();
else if (cap == GL11.GL_TEXTURE_2D) Shaders.enableTexture2D();
}
@Inject(
method = "renderSky(F)V",
at = @At(
value = "INVOKE",
target = "Lorg/lwjgl/opengl/GL11;glCallList(I)V",
remap = false,
ordinal = 0,
shift = At.Shift.BEFORE,
by = 2))
private void angelica$renderSkyPreSkyList(float p_72714_1_, CallbackInfo ci) {
Shaders.preSkyList();
}
@Inject(
method = "renderSky(F)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/multiplayer/WorldClient;getCelestialAngle(F)F",
ordinal = 1,
shift = At.Shift.BY,
by = -2))
private void angelica$renderSkyBeforeCelestialAngle(float p_72714_1_, CallbackInfo ci) {
Shaders.preCelestialRotate();
}
@Inject(
method = "renderSky(F)V",
at = @At(
value = "INVOKE",
target = "Lorg/lwjgl/opengl/GL11;glRotatef(FFFF)V",
remap = false,
ordinal = 9,
shift = At.Shift.AFTER))
private void angelica$renderSkyAfterCelestialAngle(float p_72714_1_, CallbackInfo ci) {
Shaders.postCelestialRotate();
}
// drawBlockDamageTexture
@WrapOperation(
method = "Lnet/minecraft/client/renderer/RenderGlobal;drawBlockDamageTexture(Lnet/minecraft/client/renderer/Tessellator;Lnet/minecraft/entity/EntityLivingBase;F)V",
remap = false,
at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glDisable(I)V", remap = false))
private void angelica$drawBlockDamageTextureDisable(int cap, Operation<Void> original) {
original.call(cap);
if (cap == GL11.GL_TEXTURE_2D) Shaders.disableTexture2D();
}
@WrapOperation(
method = "Lnet/minecraft/client/renderer/RenderGlobal;drawBlockDamageTexture(Lnet/minecraft/client/renderer/Tessellator;Lnet/minecraft/entity/EntityLivingBase;F)V",
remap = false,
at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glEnable(I)V", remap = false))
private void angelica$drawBlockDamageTextureSkyEnable(int cap, Operation<Void> original) {
original.call(cap);
if (cap == GL11.GL_TEXTURE_2D) Shaders.enableTexture2D();
}
@Inject(
method = "Lnet/minecraft/client/renderer/RenderGlobal;drawBlockDamageTexture(Lnet/minecraft/client/renderer/Tessellator;Lnet/minecraft/entity/EntityLivingBase;F)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;startDrawingQuads()V",
ordinal = 0,
shift = At.Shift.BEFORE))
private void angelica$beginBlockDestroyProgress(Tessellator p_72717_1_, EntityLivingBase p_72717_2_,
float p_72717_3_, CallbackInfo ci) {
Shaders.beginBlockDestroyProgress();
}
@Inject(
method = "Lnet/minecraft/client/renderer/RenderGlobal;drawBlockDamageTexture(Lnet/minecraft/client/renderer/Tessellator;Lnet/minecraft/entity/EntityLivingBase;F)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/Tessellator;setTranslation(DDD)V",
ordinal = 1,
shift = At.Shift.AFTER))
private void angelica$endBlockDestroyProgress(Tessellator p_72717_1_, EntityLivingBase p_72717_2_, float p_72717_3_,
CallbackInfo ci) {
Shaders.endBlockDestroyProgress();
}
}
@@ -0,0 +1,48 @@
package com.gtnewhorizons.angelica.mixins.early.renderer;
import java.awt.image.BufferedImage;
import net.minecraft.client.renderer.texture.AbstractTexture;
import net.minecraft.client.renderer.texture.SimpleTexture;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.util.ResourceLocation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.gtnewhorizons.angelica.client.ShadersTex;
@Mixin(value = SimpleTexture.class)
public class MixinSimpleTexture extends AbstractTexture {
private IResourceManager passedResourceManager;
@Shadow
protected ResourceLocation textureLocation;
@Inject(method = "loadTexture(Lnet/minecraft/client/resources/IResourceManager;)V", at = @At("HEAD"))
private void getResourceManager(IResourceManager p_110551_1_, CallbackInfo cbi) {
passedResourceManager = p_110551_1_;
}
@Redirect(
method = "loadTexture(Lnet/minecraft/client/resources/IResourceManager;)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/texture/TextureUtil;uploadTextureImageAllocate(ILjava/awt/image/BufferedImage;ZZ)I"))
private int angelica$loadTexture(int textureID, BufferedImage bufferedImage, boolean flag, boolean flag1) {
ShadersTex.loadSimpleTexture(
textureID,
bufferedImage,
flag,
flag1,
passedResourceManager,
this.textureLocation,
ShadersTex.getMultiTexID(this));
return 0;
}
}
@@ -0,0 +1,261 @@
package com.gtnewhorizons.angelica.mixins.early.renderer;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.nio.ShortBuffer;
import java.util.PriorityQueue;
import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.shader.TesselatorVertexState;
import net.minecraft.client.util.QuadComparator;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.gtnewhorizons.angelica.client.ShadersTess;
import com.gtnewhorizons.angelica.mixins.interfaces.TessellatorAccessor;
@Mixin(Tessellator.class)
public abstract class MixinTessellator implements TessellatorAccessor {
@Shadow(remap = false)
public boolean defaultTexture;
@Shadow(remap = false)
private int rawBufferSize;
@Shadow(remap = false)
public int textureID;
@Shadow
public int[] rawBuffer;
@Shadow
public int vertexCount;
@Shadow
public int rawBufferIndex;
@Shadow
public int addedVertices;
@Shadow
public boolean hasTexture;
@Shadow
public boolean hasBrightness;
@Shadow
public boolean hasNormals;
@Shadow
public boolean hasColor;
@Shadow
public double xOffset;
@Shadow
public double yOffset;
@Shadow
public double zOffset;
private ByteBuffer angelica$byteBuffer;
private IntBuffer angelica$intBuffer;
private FloatBuffer angelica$floatBuffer;
private ShortBuffer angelica$shortBuffer;
public float[] angelica$vertexPos;
public float angelica$normalX;
public float angelica$normalY;
public float angelica$normalZ;
public float angelica$midTextureU;
public float angelica$midTextureV;
@Inject(method = "<init>(I)V", at = @At("TAIL"))
private void angelica$extendBufferConstructor(int bufferSize, CallbackInfo ci) {
angelica$byteBuffer = GLAllocation.createDirectByteBuffer(bufferSize * 4);
angelica$intBuffer = angelica$byteBuffer.asIntBuffer();
angelica$floatBuffer = angelica$byteBuffer.asFloatBuffer();
angelica$shortBuffer = angelica$byteBuffer.asShortBuffer();
rawBuffer = new int[bufferSize];
vertexCount = 0;
angelica$vertexPos = new float[16];
}
@Inject(method = "<init>()V", at = @At("TAIL"))
private void angelica$extendEmptyConstructor(CallbackInfo ci) {
this.angelica$extendBufferConstructor(65536, null);
this.defaultTexture = false;
this.rawBufferSize = 0;
this.textureID = 0;
}
/**
* @author eigenraven
* @reason The entire drawing process must be redirected to go through an alternative renderer
*/
@Overwrite
public int draw() {
return ShadersTess.draw((Tessellator) (Object) this);
}
/**
* @author eigenraven
* @reason byteBuffer->angelica$byteBuffer
*/
@Overwrite
public void reset() {
this.vertexCount = 0;
this.angelica$byteBuffer.clear();
this.rawBufferIndex = 0;
this.addedVertices = 0;
}
/**
* @author eigenraven
* @reason The entire drawing process must be redirected to go through an alternative renderer
*/
@Overwrite
public void addVertex(double x, double y, double z) {
ShadersTess.addVertex((Tessellator) (Object) this, x, y, z);
}
/**
* @author eigenraven
* @reason Modify 32->64, ModifyConstant causes an internal mixin crash in this method
*/
@Overwrite
public TesselatorVertexState getVertexState(float x, float y, float z) {
int[] tmpCopyBuffer = new int[this.rawBufferIndex];
@SuppressWarnings("unchecked")
PriorityQueue<Integer> pQueue = new PriorityQueue<>(
this.rawBufferIndex,
new QuadComparator(
this.rawBuffer,
x + (float) this.xOffset,
y + (float) this.yOffset,
z + (float) this.zOffset));
byte batchSize = 64;
for (int vidx = 0; vidx < this.rawBufferIndex; vidx += batchSize) {
pQueue.add(vidx);
}
for (int batchVidx = 0; !pQueue.isEmpty(); batchVidx += batchSize) {
int queuedVidx = pQueue.remove();
for (int batchElement = 0; batchElement < batchSize; ++batchElement) {
tmpCopyBuffer[batchVidx + batchElement] = this.rawBuffer[queuedVidx + batchElement];
}
}
System.arraycopy(tmpCopyBuffer, 0, this.rawBuffer, 0, tmpCopyBuffer.length);
return new TesselatorVertexState(
tmpCopyBuffer,
this.rawBufferIndex,
this.vertexCount,
this.hasTexture,
this.hasBrightness,
this.hasNormals,
this.hasColor);
}
@Inject(method = "setNormal(FFF)V", at = @At("HEAD"))
private void angelica$captureNormalComponents(float x, float y, float z, CallbackInfo ci) {
this.angelica$normalX = x;
this.angelica$normalY = y;
this.angelica$normalZ = z;
}
@Override
public ByteBuffer getAngelica$byteBuffer() {
return angelica$byteBuffer;
}
@Override
public IntBuffer getAngelica$intBuffer() {
return angelica$intBuffer;
}
@Override
public FloatBuffer getAngelica$floatBuffer() {
return angelica$floatBuffer;
}
@Override
public ShortBuffer getAngelica$shortBuffer() {
return angelica$shortBuffer;
}
@Override
public float[] getAngelica$vertexPos() {
return angelica$vertexPos;
}
@Override
public float getAngelica$normalX() {
return angelica$normalX;
}
@Override
public float getAngelica$normalY() {
return angelica$normalY;
}
@Override
public float getAngelica$normalZ() {
return angelica$normalZ;
}
@Override
public float getAngelica$midTextureU() {
return angelica$midTextureU;
}
@Override
public float getAngelica$midTextureV() {
return angelica$midTextureV;
}
@Override
public void setAngelica$byteBuffer(ByteBuffer angelica$byteBuffer) {
this.angelica$byteBuffer = angelica$byteBuffer;
}
@Override
public void setAngelica$intBuffer(IntBuffer angelica$intBuffer) {
this.angelica$intBuffer = angelica$intBuffer;
}
@Override
public void setAngelica$floatBuffer(FloatBuffer angelica$floatBuffer) {
this.angelica$floatBuffer = angelica$floatBuffer;
}
@Override
public void setAngelica$shortBuffer(ShortBuffer angelica$shortBuffer) {
this.angelica$shortBuffer = angelica$shortBuffer;
}
@Override
public void setAngelica$vertexPos(float[] angelica$vertexPos) {
this.angelica$vertexPos = angelica$vertexPos;
}
@Override
public void setAngelica$normalX(float angelica$normalX) {
this.angelica$normalX = angelica$normalX;
}
@Override
public void setAngelica$normalY(float angelica$normalY) {
this.angelica$normalY = angelica$normalY;
}
@Override
public void setAngelica$normalZ(float angelica$normalZ) {
this.angelica$normalZ = angelica$normalZ;
}
@Override
public void setAngelica$midTextureU(float angelica$midTextureU) {
this.angelica$midTextureU = angelica$midTextureU;
}
@Override
public void setAngelica$midTextureV(float angelica$midTextureV) {
this.angelica$midTextureV = angelica$midTextureV;
}
}
@@ -0,0 +1,24 @@
package com.gtnewhorizons.angelica.mixins.early.renderer;
import net.minecraft.client.renderer.texture.TextureClock;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import com.gtnewhorizons.angelica.client.ShadersTex;
@Mixin(value = TextureClock.class)
public class MixinTextureClock {
@Redirect(
method = "updateAnimation()V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/texture/TextureUtil;uploadTextureMipmap([[IIIIIZZ)V"))
private void angelica$updateAnimation(int[][] data, int width, int height, int xoffset, int yoffset, boolean linear,
boolean clamp) {
ShadersTex.uploadTexSub(data, width, height, xoffset, yoffset, linear, clamp);
}
}
@@ -0,0 +1,24 @@
package com.gtnewhorizons.angelica.mixins.early.renderer;
import net.minecraft.client.renderer.texture.TextureCompass;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import com.gtnewhorizons.angelica.client.ShadersTex;
@Mixin(value = TextureCompass.class)
public class MixinTextureCompass {
@Redirect(
method = "updateCompass(Lnet/minecraft/world/World;DDDZZ)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/texture/TextureUtil;uploadTextureMipmap([[IIIIIZZ)V"))
private void angelica$updateCompass(int[][] data, int width, int height, int xoffset, int yoffset, boolean linear,
boolean clamp) {
ShadersTex.uploadTexSub(data, width, height, xoffset, yoffset, linear, clamp);
}
}
@@ -0,0 +1,44 @@
package com.gtnewhorizons.angelica.mixins.early.settings;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiVideoSettings;
import net.minecraft.client.settings.GameSettings;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.gtnewhorizons.angelica.client.GuiShaders;
@Mixin(GuiVideoSettings.class)
abstract public class MixinGuiVideoSettings extends GuiScreen {
private static final int SHADER_BUTTON_ID = 190;
@Shadow
private GameSettings guiGameSettings;
@Inject(method = "initGui()V", at = @At(value = "TAIL"))
private void angelica$addShadersButton(CallbackInfo ci) {
// Add the Shaders Button to the bottom of Video Options
final GuiButton shaderButton = new GuiButton(
SHADER_BUTTON_ID,
this.width / 2 - 190,
this.height - 27,
70,
20,
"Shaders...");
this.buttonList.add(shaderButton);
}
@Inject(method = "actionPerformed(Lnet/minecraft/client/gui/GuiButton;)V", at = @At(value = "HEAD"))
private void angelica$actionPerformed(GuiButton button, CallbackInfo ci) {
if (button.id == SHADER_BUTTON_ID) {
this.mc.gameSettings.saveOptions();
this.mc.displayGuiScreen(new GuiShaders(this, this.guiGameSettings));
}
}
}
@@ -0,0 +1,27 @@
package com.gtnewhorizons.angelica.mixins.early.shaders;
import net.minecraft.client.Minecraft;
import net.minecraft.profiler.IPlayerUsage;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.gtnewhorizons.angelica.client.Shaders;
@Mixin(Minecraft.class)
public abstract class MixinMinecraft implements IPlayerUsage {
@Inject(
method = "startGame()V",
at = @At(
ordinal = 1,
shift = At.Shift.AFTER,
value = "INVOKE",
target = "Lnet/minecraft/client/Minecraft;checkGLError(Ljava/lang/String;)V"))
private void angelica$Startup(CallbackInfo ci) {
// Start the Shaders
Shaders.startup(((Minecraft) ((Object) this)));
}
}
@@ -0,0 +1,6 @@
package com.gtnewhorizons.angelica.mixins.interfaces;
public interface IModelRenderer {
void resetDisplayList();
}
@@ -0,0 +1,49 @@
package com.gtnewhorizons.angelica.mixins.interfaces;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.nio.ShortBuffer;
public interface TessellatorAccessor {
ByteBuffer getAngelica$byteBuffer();
IntBuffer getAngelica$intBuffer();
FloatBuffer getAngelica$floatBuffer();
ShortBuffer getAngelica$shortBuffer();
float[] getAngelica$vertexPos();
float getAngelica$normalX();
float getAngelica$normalY();
float getAngelica$normalZ();
float getAngelica$midTextureU();
float getAngelica$midTextureV();
void setAngelica$byteBuffer(ByteBuffer angelica$byteBuffer);
void setAngelica$intBuffer(IntBuffer angelica$intBuffer);
void setAngelica$floatBuffer(FloatBuffer angelica$floatBuffer);
void setAngelica$shortBuffer(ShortBuffer angelica$shortBuffer);
void setAngelica$vertexPos(float[] angelica$vertexPos);
void setAngelica$normalX(float angelica$normalX);
void setAngelica$normalY(float angelica$normalY);
void setAngelica$normalZ(float angelica$normalZ);
void setAngelica$midTextureU(float angelica$midTextureU);
void setAngelica$midTextureV(float angelica$midTextureV);
}
@@ -1,66 +0,0 @@
package com.gtnewhorizons.angelica.transform;
import static org.objectweb.asm.Opcodes.*;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
public class ACTBlock implements IClassTransformer {
@Override
public byte[] transform(String par1, String par2, byte[] par3) {
ALog.fine("transforming %s %s", par1, par2);
ClassReader cr = new ClassReader(par3);
ClassWriter cw = new ClassWriter(cr, 0);
CVTransform cv = new CVTransform(cw);
cr.accept(cv, 0);
return cw.toByteArray();
}
private static class CVTransform extends ClassVisitor {
String classname;
public CVTransform(ClassVisitor cv) {
super(Opcodes.ASM4, cv);
}
@Override
public void visit(
int version, int access, String name, String signature, String superName, String[] interfaces) {
this.classname = name;
// SMCLog.info(" class %s",name);
super.visit(version, access, name, signature, superName, interfaces);
}
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
if (Names.block_getAoLight.equalsNameDesc(name, desc)) {
// SMCLog.info(" patching");
return new MVgetAoLight(cv.visitMethod(access, name, desc, signature, exceptions));
}
return cv.visitMethod(access, name, desc, signature, exceptions);
}
}
private static class MVgetAoLight extends MethodVisitor {
public MVgetAoLight(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
}
@Override
public void visitLdcInsn(Object cst) {
if (cst instanceof Float) {
if (((Float) cst).floatValue() == 0.2f) {
mv.visitFieldInsn(GETSTATIC, "com/gtnewhorizons/angelica/client/Shaders", "blockAoLight", "F");
ALog.info(" blockAoLight");
return;
}
}
mv.visitLdcInsn(cst);
}
}
}
@@ -3,6 +3,7 @@ package com.gtnewhorizons.angelica.transform;
import static org.objectweb.asm.Opcodes.*;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
@@ -24,6 +25,7 @@ public class ACTEntityRenderer implements IClassTransformer {
}
private static class CVTransform extends ClassVisitor {
String classname;
public CVTransform(ClassVisitor cv) {
@@ -31,10 +33,10 @@ public class ACTEntityRenderer implements IClassTransformer {
}
@Override
public void visit(
int version, int access, String name, String signature, String superName, String[] interfaces) {
public void visit(int version, int access, String name, String signature, String superName,
String[] interfaces) {
classname = name;
// SMCLog.info(" class %s",name);
// ALog.info(" class %s",name);
cv.visit(version, access, name, signature, superName, interfaces);
}
@@ -71,6 +73,7 @@ public class ACTEntityRenderer implements IClassTransformer {
}
private static class MVdisableLightmap extends MethodVisitor {
public MVdisableLightmap(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
}
@@ -85,6 +88,7 @@ public class ACTEntityRenderer implements IClassTransformer {
}
private static class MVenableLightmap extends MethodVisitor {
public MVenableLightmap(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
}
@@ -99,6 +103,7 @@ public class ACTEntityRenderer implements IClassTransformer {
}
private static class MVupdateFogColor extends MethodVisitor {
public MVupdateFogColor(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
}
@@ -107,7 +112,10 @@ public class ACTEntityRenderer implements IClassTransformer {
public void visitMethodInsn(int opcode, String owner, String name, String desc) {
if (Names.equals("org/lwjgl/opengl/GL11", "glClearColor", "(FFFF)V", owner, name, desc)) {
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "setClearColor", "(FFFF)V");
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"setClearColor",
"(FFFF)V");
return;
}
mv.visitMethodInsn(opcode, owner, name, desc);
@@ -115,6 +123,7 @@ public class ACTEntityRenderer implements IClassTransformer {
}
private static class MVsetFogColorBuffer extends MethodVisitor {
public MVsetFogColorBuffer(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
}
@@ -130,6 +139,7 @@ public class ACTEntityRenderer implements IClassTransformer {
}
private static class MVsetupFog extends MethodVisitor {
public MVsetupFog(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
}
@@ -145,6 +155,7 @@ public class ACTEntityRenderer implements IClassTransformer {
}
private static class MVrenderCloudsCheck extends MethodVisitor {
public MVrenderCloudsCheck(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
}
@@ -169,6 +180,7 @@ public class ACTEntityRenderer implements IClassTransformer {
}
private static class MVrenderHand extends MethodVisitor {
Label la1, la2;
public MVrenderHand(MethodVisitor mv) {
@@ -179,11 +191,7 @@ public class ACTEntityRenderer implements IClassTransformer {
@Override
public void visitMethodInsn(int opcode, String owner, String name, String desc) {
if (Names.equals("org/lwjgl/util/glu/Project", "gluPerspective", "(FFFF)V", owner, name, desc)) {
mv.visitMethodInsn(INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "applyHandDepth", "()V");
mv.visitMethodInsn(opcode, owner, name, desc);
return;
} else if (Names.equals("org/lwjgl/opengl/GL11", "glPushMatrix", "()V", owner, name, desc)) {
if (Names.equals("org/lwjgl/opengl/GL11", "glPushMatrix", "()V", owner, name, desc)) {
mv.visitFieldInsn(GETSTATIC, "com/gtnewhorizons/angelica/client/Shaders", "isHandRendered", "Z");
mv.visitJumpInsn(IFNE, la1);
mv.visitMethodInsn(opcode, owner, name, desc);
@@ -192,26 +200,6 @@ public class ACTEntityRenderer implements IClassTransformer {
mv.visitMethodInsn(opcode, owner, name, desc);
mv.visitLabel(la1);
mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null);
mv.visitFieldInsn(GETSTATIC, "com/gtnewhorizons/angelica/client/Shaders", "isCompositeRendered", "Z");
mv.visitJumpInsn(IFNE, la2);
mv.visitInsn(RETURN);
mv.visitLabel(la2);
mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null);
mv.visitVarInsn(ALOAD, 0);
mv.visitVarInsn(FLOAD, 1);
mv.visitInsn(F2D);
mv.visitMethodInsn(
INVOKEVIRTUAL,
Names.entityRenderer_disableLightmap.clas,
Names.entityRenderer_disableLightmap.name,
Names.entityRenderer_disableLightmap.desc);
return;
} else if (Names.itemRenderer_renderItemInFirstPerson.equals(owner, name, desc)) {
mv.visitMethodInsn(
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/ShadersRender",
"renderItemFP",
"(" + Names.itemRenderer_.desc + "F)V");
return;
}
mv.visitMethodInsn(opcode, owner, name, desc);
@@ -219,6 +207,7 @@ public class ACTEntityRenderer implements IClassTransformer {
}
private static class MVrenderWorld extends MethodVisitor {
public MVrenderWorld(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
}
@@ -235,7 +224,10 @@ public class ACTEntityRenderer implements IClassTransformer {
mv.visitCode();
mv.visitVarInsn(ALOAD, 0);
mv.visitFieldInsn(
GETFIELD, Names.entityRenderer_mc.clas, Names.entityRenderer_mc.name, Names.entityRenderer_mc.desc);
GETFIELD,
Names.entityRenderer_mc.clas,
Names.entityRenderer_mc.name,
Names.entityRenderer_mc.desc);
mv.visitVarInsn(FLOAD, 1);
mv.visitVarInsn(LLOAD, 2);
mv.visitMethodInsn(
@@ -249,7 +241,7 @@ public class ACTEntityRenderer implements IClassTransformer {
public void visitLdcInsn(Object cst) {
if (cst instanceof String) {
String scst = (String) cst;
// SMCLog.finest(" %d Ldc %s", state, scst);
// ALog.finest(" %d Ldc %s", state, scst);
section = scst;
}
mv.visitLdcInsn(cst);
@@ -257,23 +249,23 @@ public class ACTEntityRenderer implements IClassTransformer {
@Override
public void visitIntInsn(int opcode, int operand) {
// SMCLog.finest(" %d Int %d %d", state ,opcode, operand);
// ALog.finest(" %d Int %d %d", state ,opcode, operand);
// switch (state) {
// case 23:
// case 25:
// if (opcode == SIPUSH && operand == 256) {
// state = 26;
// mv.visitInsn(ICONST_0);
// return;
// }
// break;
// if (opcode == SIPUSH && operand == 256) {
// state = 26;
// mv.visitInsn(ICONST_0);
// return;
// }
// break;
// }
mv.visitIntInsn(opcode, operand);
}
@Override
public void visitJumpInsn(int opcode, Label label) {
// SMCLog.finest(" %d, Jump %d", state, opcode);
// ALog.finest(" %d, Jump %d", state, opcode);
switch (state) {
case 4:
if (opcode == IF_ICMPLT) {
@@ -291,7 +283,10 @@ public class ACTEntityRenderer implements IClassTransformer {
labelEndUpdate = new Label();
mv.visitJumpInsn(opcode, label);
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "beginUpdateChunks", "()V");
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"beginUpdateChunks",
"()V");
return;
}
break;
@@ -307,17 +302,17 @@ public class ACTEntityRenderer implements IClassTransformer {
mv.visitJumpInsn(opcode, label);
mv.visitFieldInsn(GETSTATIC, "com/gtnewhorizons/angelica/client/Shaders", "isShadowPass", "Z");
mv.visitJumpInsn(IFNE, label);
// mv.visitMethodInsn(INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders",
// mv.visitMethodInsn(INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders",
// "readCenterDepth",
// "()V");
// mv.visitMethodInsn(INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders",
// mv.visitMethodInsn(INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders",
// "beginHand", "()V");
// mv.visitVarInsn(ALOAD, 0);
// mv.visitVarInsn(FLOAD, 1);
// mv.visitVarInsn(ILOAD, 13);
// mv.visitMethodInsn(INVOKESPECIAL, Names.EntityRenderer_, Names.EntityRenderer_renderHand,
// mv.visitVarInsn(ALOAD, 0);
// mv.visitVarInsn(FLOAD, 1);
// mv.visitVarInsn(ILOAD, 13);
// mv.visitMethodInsn(INVOKESPECIAL, Names.EntityRenderer_, Names.EntityRenderer_renderHand,
// Names.EntityRenderer_renderHand_desc);
// mv.visitMethodInsn(INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "endHand",
// mv.visitMethodInsn(INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "endHand",
// "()V");
mv.visitVarInsn(ALOAD, 0);
mv.visitVarInsn(FLOAD, 1);
@@ -347,7 +342,10 @@ public class ACTEntityRenderer implements IClassTransformer {
++state;
mv.visitLabel(labelEndUpdate);
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "endUpdateChunks", "()V");
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"endUpdateChunks",
"()V");
mv.visitLabel(label);
labelAfterUpdate = labelEndUpdate = null;
return;
@@ -358,7 +356,7 @@ public class ACTEntityRenderer implements IClassTransformer {
@Override
public void visitFrame(int type, int nLocal, Object[] local, int nStack, Object[] stack) {
// SMCLog.finest(" %d, Frame",state);
// ALog.finest(" %d, Frame",state);
switch (state) {
case 7: {
state = 8;
@@ -380,7 +378,7 @@ public class ACTEntityRenderer implements IClassTransformer {
@Override
public void visitFieldInsn(int opcode, String owner, String name, String desc) {
// SMCLog.finest(" %d F %d %s.%s %s", state, opcode, ownerM, nameM, descM);
// ALog.finest(" %d F %d %s.%s %s", state, opcode, ownerM, nameM, descM);
switch (state) {
case 3:
if (Names.gameSettings_renderDistance.equals(owner, name)) {
@@ -415,13 +413,16 @@ public class ACTEntityRenderer implements IClassTransformer {
@Override
public void visitMethodInsn(int opcode, String owner, String name, String desc) {
// SMCLog.finest(" %d M %d %s.%s%s", state, opcode, ownerM, nameM, descM);
// ALog.finest(" %d M %d %s.%s%s", state, opcode, ownerM, nameM, descM);
switch (state) {
case 0:
if (Names.equals("org/lwjgl/opengl/GL11", "glViewport", "(IIII)V", owner, name, desc)) {
++state;
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "setViewport", "(IIII)V");
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"setViewport",
"(IIII)V");
return;
}
break;
@@ -430,7 +431,10 @@ public class ACTEntityRenderer implements IClassTransformer {
++state;
mv.visitMethodInsn(opcode, owner, name, desc);
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "clearRenderBuffer", "()V");
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"clearRenderBuffer",
"()V");
return;
}
break;
@@ -440,7 +444,10 @@ public class ACTEntityRenderer implements IClassTransformer {
mv.visitMethodInsn(opcode, owner, name, desc);
mv.visitVarInsn(FLOAD, 1);
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "setCamera", "(F)V");
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"setCamera",
"(F)V");
return;
}
break;
@@ -458,7 +465,10 @@ public class ACTEntityRenderer implements IClassTransformer {
if (Names.renderGlobal_renderSky.equals(owner, name, desc)) {
state = 8;
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "beginSky", "()V");
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"beginSky",
"()V");
mv.visitMethodInsn(opcode, owner, name, desc);
mv.visitMethodInsn(INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "endSky", "()V");
return;
@@ -468,7 +478,10 @@ public class ACTEntityRenderer implements IClassTransformer {
if (Names.renderGlobal_renderSky.equals(owner, name, desc)) {
++state;
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "beginSky", "()V");
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"beginSky",
"()V");
mv.visitMethodInsn(opcode, owner, name, desc);
mv.visitMethodInsn(INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "endSky", "()V");
return;
@@ -501,10 +514,16 @@ public class ACTEntityRenderer implements IClassTransformer {
if (Names.renderGlobal_sortAndRender.equals(owner, name, desc)) {
++state;
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "beginTerrain", "()V");
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"beginTerrain",
"()V");
mv.visitMethodInsn(opcode, owner, name, desc);
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "endTerrain", "()V");
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"endTerrain",
"()V");
return;
}
break;
@@ -513,7 +532,10 @@ public class ACTEntityRenderer implements IClassTransformer {
// vanilla or forge. not optfine
++state;
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "beginLitParticles", "()V");
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"beginLitParticles",
"()V");
mv.visitMethodInsn(opcode, owner, name, desc);
return;
} else if (Names.equals("org/lwjgl/opengl/GL11", "glDisable", "(I)V", owner, name, desc)) {
@@ -526,10 +548,16 @@ public class ACTEntityRenderer implements IClassTransformer {
if (Names.effectRenderer_renderParticles.equals(owner, name, desc)) {
++state;
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "beginParticles", "()V");
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"beginParticles",
"()V");
mv.visitMethodInsn(opcode, owner, name, desc);
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "endParticles", "()V");
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"endParticles",
"()V");
return;
}
break;
@@ -543,10 +571,16 @@ public class ACTEntityRenderer implements IClassTransformer {
if (Names.entityRenderer_renderRainSnow.equals(owner, name, desc)) {
++state;
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "beginWeather", "()V");
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"beginWeather",
"()V");
mv.visitMethodInsn(opcode, owner, name, desc);
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "endWeather", "()V");
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"endWeather",
"()V");
return;
}
break;
@@ -563,7 +597,10 @@ public class ACTEntityRenderer implements IClassTransformer {
"renderHand0",
"(" + Names.entityRenderer_.desc + "FI)V");
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "preWater", "()V");
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"preWater",
"()V");
return;
}
case 18:
@@ -572,21 +609,33 @@ public class ACTEntityRenderer implements IClassTransformer {
if (Names.renderGlobal_sortAndRender.equals(owner, name, desc)) {
++state;
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "beginWater", "()V");
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"beginWater",
"()V");
mv.visitMethodInsn(opcode, owner, name, desc);
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "endWater", "()V");
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"endWater",
"()V");
return;
} else if (Names.equals(
Names.renderGlobal_.clas, "renderAllSortedRenderers", "(ID)I", owner, name, desc)) {
++state;
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "beginWater", "()V");
mv.visitMethodInsn(opcode, owner, name, desc);
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "endWater", "()V");
return;
}
} else if (Names
.equals(Names.renderGlobal_.clas, "renderAllSortedRenderers", "(ID)I", owner, name, desc)) {
++state;
mv.visitMethodInsn(
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"beginWater",
"()V");
mv.visitMethodInsn(opcode, owner, name, desc);
mv.visitMethodInsn(
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"endWater",
"()V");
return;
}
break;
case 21:
if (Names.equals("org/lwjgl/opengl/GL11", "glDepthMask", "(Z)V", owner, name, desc)) {
@@ -607,7 +656,10 @@ public class ACTEntityRenderer implements IClassTransformer {
++state;
mv.visitMethodInsn(opcode, owner, name, desc);
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "disableFog", "()V");
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"disableFog",
"()V");
return;
}
break;
@@ -615,7 +667,10 @@ public class ACTEntityRenderer implements IClassTransformer {
if (Names.effectRenderer_renderLitParticles.equals(owner, name, desc)) {
++state;
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "beginLitParticles", "()V");
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"beginLitParticles",
"()V");
mv.visitMethodInsn(opcode, owner, name, desc);
return;
}
@@ -624,10 +679,16 @@ public class ACTEntityRenderer implements IClassTransformer {
if (Names.effectRenderer_renderParticles.equals(owner, name, desc)) {
++state;
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "beginParticles", "()V");
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"beginParticles",
"()V");
mv.visitMethodInsn(opcode, owner, name, desc);
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "endParticles", "()V");
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"endParticles",
"()V");
return;
}
break;
@@ -644,21 +705,11 @@ public class ACTEntityRenderer implements IClassTransformer {
break;
}
/*
case :
if (Namer.equals(SMCNames.,SMCNames.,SMCNames._desc,owner,name,desc)) {
++state;
mv.visitMethodInsn(opcode, owner, name, desc);
return;
}
break;
case :
if (Namer.equals("","","",owner,name,desc)) {
++state;
mv.visitMethodInsn(opcode, owner, name, desc);
return;
}
break;
*/
* case : if (Namer.equals(SMCNames.,SMCNames.,SMCNames._desc,owner,name,desc)) { ++state;
* mv.visitMethodInsn(opcode, owner, name, desc); return; } break; case : if
* (Namer.equals("","","",owner,name,desc)) { ++state; mv.visitMethodInsn(opcode, owner, name, desc);
* return; } break;
*/
mv.visitMethodInsn(opcode, owner, name, desc);
}
@@ -1,181 +0,0 @@
package com.gtnewhorizons.angelica.transform;
import static org.objectweb.asm.Opcodes.*;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
public class ACTGuiOptions implements IClassTransformer {
@Override
public byte[] transform(String par1, String par2, byte[] par3) {
ALog.fine("transforming %s %s", par1, par2);
ClassReader cr = new ClassReader(par3);
ClassWriter cw = new ClassWriter(cr, ClassWriter.COMPUTE_MAXS);
CVTransform cv = new CVTransform(cw);
cr.accept(cv, 0);
return cw.toByteArray();
}
private static class CVTransform extends ClassVisitor {
String classname;
public CVTransform(ClassVisitor cv) {
super(Opcodes.ASM4, cv);
}
@Override
public void visit(
int version, int access, String name, String signature, String superName, String[] interfaces) {
this.classname = name;
// SMCLog.info(" class %s",name);
cv.visit(version, access, name, signature, superName, interfaces);
}
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
// SMCLog.info(" method %s.%s%s = %s",classname,name,desc,remappedName);
if (Names.guiOptions_initGui.equalsNameDesc(name, desc)) {
// SMCLog.info(" patching");
return new MVinitGui(cv.visitMethod(access, name, desc, signature, exceptions));
}
if (Names.guiOptions_actionPerformed.equalsNameDesc(name, desc)) {
// SMCLog.info(" patching");
return new MVactionPerformed(cv.visitMethod(access, name, desc, signature, exceptions));
}
return cv.visitMethod(access, name, desc, signature, exceptions);
}
}
private static class MVinitGui extends MethodVisitor {
int state = 0;
public MVinitGui(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
}
@Override
public void visitInsn(int opcode) {
super.visitInsn(opcode);
if (opcode == Opcodes.POP) {
if (state == 1) {
state = 2;
mv.visitVarInsn(ALOAD, 0);
mv.visitFieldInsn(
GETFIELD,
Names.guiOptions_buttonList.clas,
Names.guiOptions_buttonList.name,
Names.guiOptions_buttonList.desc);
mv.visitTypeInsn(NEW, Names.guiButton_.clas);
mv.visitInsn(DUP);
mv.visitIntInsn(SIPUSH, 190);
mv.visitVarInsn(ALOAD, 0);
mv.visitFieldInsn(
GETFIELD,
Names.guiOptions_width.clas,
Names.guiOptions_width.name,
Names.guiOptions_width.desc);
mv.visitInsn(ICONST_2);
mv.visitInsn(IDIV);
mv.visitIntInsn(SIPUSH, 155);
mv.visitInsn(ISUB);
mv.visitIntInsn(BIPUSH, 76);
mv.visitInsn(IADD);
mv.visitVarInsn(ALOAD, 0);
mv.visitFieldInsn(
GETFIELD,
Names.guiOptions_height.clas,
Names.guiOptions_height.name,
Names.guiOptions_height.desc);
mv.visitIntInsn(BIPUSH, 6);
mv.visitInsn(IDIV);
mv.visitIntInsn(BIPUSH, 120);
mv.visitInsn(IADD);
mv.visitIntInsn(BIPUSH, 6);
mv.visitInsn(ISUB);
mv.visitIntInsn(BIPUSH, 74);
mv.visitIntInsn(BIPUSH, 20);
mv.visitLdcInsn("Shaders...");
mv.visitMethodInsn(INVOKESPECIAL, Names.guiButton_.clas, "<init>", "(IIIIILjava/lang/String;)V");
mv.visitMethodInsn(INVOKEINTERFACE, "java/util/List", "add", "(Ljava/lang/Object;)Z");
mv.visitInsn(POP);
ALog.finest(" add shaders button");
}
}
}
@Override
public void visitLdcInsn(Object cst) {
if (cst instanceof String) {
if (((String) cst).equals("options.language")) {
if (state == 0) {
state = 1;
mv.visitInsn(POP);
mv.visitInsn(POP);
mv.visitIntInsn(BIPUSH, 74);
mv.visitIntInsn(BIPUSH, 20);
ALog.finest(" decrease language button size");
}
}
}
super.visitLdcInsn(cst);
}
}
private static class MVactionPerformed extends MethodVisitor {
public MVactionPerformed(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
}
@Override
public void visitCode() {
super.visitCode();
mv.visitVarInsn(ALOAD, 1);
mv.visitFieldInsn(GETFIELD, Names.guiButton_id.clas, Names.guiButton_id.name, Names.guiButton_id.desc);
mv.visitIntInsn(SIPUSH, 190);
Label l1 = new Label();
mv.visitJumpInsn(IF_ICMPNE, l1);
mv.visitVarInsn(ALOAD, 0);
mv.visitFieldInsn(GETFIELD, Names.guiOptions_mc.clas, Names.guiOptions_mc.name, Names.guiOptions_mc.desc);
mv.visitFieldInsn(
GETFIELD,
Names.minecraft_gameSettings.clas,
Names.minecraft_gameSettings.name,
Names.minecraft_gameSettings.desc);
mv.visitMethodInsn(
INVOKEVIRTUAL,
Names.gameSettings_saveOptions.clas,
Names.gameSettings_saveOptions.name,
Names.gameSettings_saveOptions.desc);
mv.visitVarInsn(ALOAD, 0);
mv.visitFieldInsn(GETFIELD, Names.guiOptions_mc.clas, Names.guiOptions_mc.name, Names.guiOptions_mc.desc);
mv.visitTypeInsn(NEW, "com/gtnewhorizons/angelica/client/GuiShaders");
mv.visitInsn(DUP);
mv.visitVarInsn(ALOAD, 0);
mv.visitVarInsn(ALOAD, 0);
mv.visitFieldInsn(
GETFIELD,
Names.guiOptions_options.clas,
Names.guiOptions_options.name,
Names.guiOptions_options.desc);
mv.visitMethodInsn(
INVOKESPECIAL,
"com/gtnewhorizons/angelica/client/GuiShaders",
"<init>",
"(" + Names.guiScreen_.desc + Names.gameSettings_.desc + ")V");
mv.visitMethodInsn(
INVOKEVIRTUAL,
Names.minecraft_displayGuiScreen.clas,
Names.minecraft_displayGuiScreen.name,
Names.minecraft_displayGuiScreen.desc);
mv.visitLabel(l1);
mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null);
ALog.finest(" shaders button action");
}
}
}
@@ -1,47 +0,0 @@
package com.gtnewhorizons.angelica.transform;
import static org.objectweb.asm.Opcodes.*;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.FieldVisitor;
import org.objectweb.asm.Opcodes;
public class ACTItemBlock implements IClassTransformer {
@Override
public byte[] transform(String par1, String par2, byte[] par3) {
ALog.fine("transforming %s %s", par1, par2);
ClassReader cr = new ClassReader(par3);
ClassWriter cw = new ClassWriter(cr, ClassWriter.COMPUTE_MAXS);
CVTransform cv = new CVTransform(cw);
cr.accept(cv, 0);
return cw.toByteArray();
}
private static class CVTransform extends ClassVisitor {
String classname;
public CVTransform(ClassVisitor cv) {
super(Opcodes.ASM4, cv);
}
@Override
public void visit(
int version, int access, String name, String signature, String superName, String[] interfaces) {
classname = name;
// SMCLog.info(" class %s",name);
cv.visit(version, access, name, signature, superName, interfaces);
}
@Override
public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) {
if (Names.itemBlock_block.name.equals(name)) {
access = access & ~(ACC_PUBLIC | ACC_PRIVATE | ACC_PROTECTED) | ACC_PUBLIC;
}
return cv.visitField(access, name, desc, signature, value);
}
}
}
@@ -3,6 +3,7 @@ package com.gtnewhorizons.angelica.transform;
import static org.objectweb.asm.Opcodes.*;
import net.minecraft.launchwrapper.IClassTransformer;
import org.lwjgl.opengl.GL11;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
@@ -23,6 +24,7 @@ public class ACTItemRenderer implements IClassTransformer {
}
private static class CVTransform extends ClassVisitor {
String classname;
public CVTransform(ClassVisitor cv) {
@@ -32,20 +34,21 @@ public class ACTItemRenderer implements IClassTransformer {
Names.Meth renderItemIrt = new Names.Meth(
Names.itemRenderer_,
"renderItem",
"(" + Names.entityLivingBase_.desc + Names.itemStack_.desc
"(" + Names.entityLivingBase_.desc
+ Names.itemStack_.desc
+ "ILnet/minecraftforge/client/IItemRenderer$ItemRenderType;)V");
@Override
public void visit(
int version, int access, String name, String signature, String superName, String[] interfaces) {
public void visit(int version, int access, String name, String signature, String superName,
String[] interfaces) {
classname = name;
// SMCLog.info(" class %s",name);
// ALog.info(" class %s",name);
cv.visit(version, access, name, signature, superName, interfaces);
}
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
// SMCLog.info(" method %s.%s%s",classname,name,desc);
// ALog.info(" method %s.%s%s",classname,name,desc);
if (Names.itemRenderer_updateEquipped.equalsNameDesc(name, desc)) {
ALog.finer(" patch method %s.%s%s", classname, name, desc);
return new MVupdate(cv.visitMethod(access, name, desc, signature, exceptions));
@@ -61,6 +64,7 @@ public class ACTItemRenderer implements IClassTransformer {
}
private static class MVupdate extends MethodVisitor {
public MVupdate(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
}
@@ -70,13 +74,17 @@ public class ACTItemRenderer implements IClassTransformer {
if (opcode == PUTFIELD && Names.itemRenderer_itemToRender.equals(owner, name, desc)) {
mv.visitInsn(DUP);
mv.visitFieldInsn(
PUTSTATIC, "com/gtnewhorizons/angelica/client/Shaders", "itemToRender", Names.itemStack_.desc);
PUTSTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"itemToRender",
Names.itemStack_.desc);
}
mv.visitFieldInsn(opcode, owner, name, desc);
}
}
private static class MVrenderItem extends MethodVisitor {
public MVrenderItem(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
}
@@ -1,88 +0,0 @@
package com.gtnewhorizons.angelica.transform;
import static org.objectweb.asm.Opcodes.*;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
public class ACTMinecraft implements IClassTransformer {
@Override
public byte[] transform(String par1, String par2, byte[] par3) {
ALog.fine("transforming %s %s", par1, par2);
ClassReader cr = new ClassReader(par3);
ClassWriter cw = new ClassWriter(cr, ClassWriter.COMPUTE_MAXS);
CVTransform cv = new CVTransform(cw);
cr.accept(cv, 0);
return cw.toByteArray();
}
private static class CVTransform extends ClassVisitor {
String classname;
public CVTransform(ClassVisitor cv) {
super(Opcodes.ASM4, cv);
}
@Override
public void visit(
int version, int access, String name, String signature, String superName, String[] interfaces) {
this.classname = name;
// SMCLog.info(" class %s",name);
super.visit(version, access, name, signature, superName, interfaces);
}
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
// SMCLog.info(" method %s.%s%s = %s",classname,name,desc,remappedName);
if (Names.minecraft_startGame.equalsNameDesc(name, desc)) {
// SMCLog.info(" patching");
return new MVstartGame(super.visitMethod(access, name, desc, signature, exceptions));
}
return super.visitMethod(access, name, desc, signature, exceptions);
}
}
private static class MVstartGame extends MethodVisitor {
int state = 0;
public MVstartGame(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
}
@Override
public void visitLdcInsn(Object cst) {
if (cst instanceof String) {
if (((String) cst).equals("Startup")) {
if (state == 0) {
state = 1;
}
}
}
super.visitLdcInsn(cst);
}
@Override
public void visitVarInsn(int opcode, int var) {
if (opcode == Opcodes.ALOAD) {
if (var == 0) {
if (state == 1) {
state = 2;
mv.visitVarInsn(ALOAD, 0);
mv.visitMethodInsn(
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"startup",
"(" + Names.minecraft_.desc + ")V");
// SMCLog.finest(" startup");
}
}
}
super.visitVarInsn(opcode, var);
}
}
}
@@ -1,149 +0,0 @@
package com.gtnewhorizons.angelica.transform;
import static org.objectweb.asm.Opcodes.*;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
public class ACTModelRenderer implements IClassTransformer {
@Override
public byte[] transform(String par1, String par2, byte[] par3) {
ALog.fine("transforming %s %s", par1, par2);
ClassReader cr = new ClassReader(par3);
ClassWriter cw = new ClassWriter(cr, ClassWriter.COMPUTE_MAXS);
CVTransform cv = new CVTransform(cw);
cr.accept(cv, 0);
return cw.toByteArray();
}
private static class CVTransform extends ClassVisitor {
String classname;
public CVTransform(ClassVisitor cv) {
super(Opcodes.ASM4, cv);
}
@Override
public void visit(
int version, int access, String name, String signature, String superName, String[] interfaces) {
classname = name;
// SMCLog.info(" class %s",name);
cv.visit(version, access, name, signature, superName, interfaces);
}
// @Override
// public FieldVisitor visitField(int access, String name, String desc,
// String signature, Object value) {
// if (Names.modelRenderer_compiled.name.equals(name) ||
// Names.modelRenderer_displayList.name.equals(name)) {
// access = access & ~(ACC_PUBLIC|ACC_PRIVATE|ACC_PROTECTED) | ACC_PUBLIC;
// }
// return cv.visitField(access, name, desc, signature, value);
// }
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
// SMCLog.info(" method %s.%s%s = %s",classname,name,desc,remappedName);
// if (Names.modelRenderer_render.equalsNameDesc(name, desc))
// {
// //SMCLog.finer(" patching method %s.%s%s = %s",classname,name,desc,remappedName);
// return new MVrender(
// cv.visitMethod(access, name, desc, signature, exceptions));
// }
// else
// if (Names.modelRenderer_renderWithRotation.equalsNameDesc(name, desc))
// {
// //SMCLog.finer(" patching method %s.%s%s = %s",classname,name,desc,remappedName);
// return new MVrender(
// cv.visitMethod(access, name, desc, signature, exceptions));
// }
// else
if ("resetDisplayList".equals(name) && "()V".equals(desc)
|| "getCompiled".equals(name) && "()Z".equals(desc)
|| "getDisplayList".equals(name) && "()I".equals(desc)) {
return null;
}
return cv.visitMethod(access, name, desc, signature, exceptions);
}
@Override
public void visitEnd() {
MethodVisitor mv;
{
mv = cv.visitMethod(ACC_PUBLIC, "getCompiled", "()Z", null, null);
mv.visitCode();
mv.visitVarInsn(ALOAD, 0);
mv.visitFieldInsn(
GETFIELD,
Names.modelRenderer_compiled.clas,
Names.modelRenderer_compiled.name,
Names.modelRenderer_compiled.desc);
mv.visitInsn(IRETURN);
mv.visitMaxs(1, 1);
mv.visitEnd();
}
{
mv = cv.visitMethod(ACC_PUBLIC, "getDisplayList", "()I", null, null);
mv.visitCode();
mv.visitVarInsn(ALOAD, 0);
mv.visitFieldInsn(
GETFIELD,
Names.modelRenderer_displayList.clas,
Names.modelRenderer_displayList.name,
Names.modelRenderer_displayList.desc);
mv.visitInsn(IRETURN);
mv.visitMaxs(1, 1);
mv.visitEnd();
}
{
mv = cv.visitMethod(ACC_PUBLIC, "resetDisplayList", "()V", null, null);
mv.visitCode();
mv.visitVarInsn(ALOAD, 0);
mv.visitFieldInsn(
GETFIELD,
Names.modelRenderer_compiled.clas,
Names.modelRenderer_compiled.name,
Names.modelRenderer_compiled.desc);
Label l1 = new Label();
mv.visitJumpInsn(IFEQ, l1);
mv.visitVarInsn(ALOAD, 0);
mv.visitFieldInsn(
GETFIELD,
Names.modelRenderer_displayList.clas,
Names.modelRenderer_displayList.name,
Names.modelRenderer_displayList.desc);
mv.visitMethodInsn(
INVOKESTATIC,
Names.glAllocation_deleteDisplayLists.clas,
Names.glAllocation_deleteDisplayLists.name,
Names.glAllocation_deleteDisplayLists.desc);
mv.visitVarInsn(ALOAD, 0);
mv.visitInsn(ICONST_0);
mv.visitFieldInsn(
PUTFIELD,
Names.modelRenderer_displayList.clas,
Names.modelRenderer_displayList.name,
Names.modelRenderer_displayList.desc);
mv.visitVarInsn(ALOAD, 0);
mv.visitInsn(ICONST_0);
mv.visitFieldInsn(
PUTFIELD,
Names.modelRenderer_compiled.clas,
Names.modelRenderer_compiled.name,
Names.modelRenderer_compiled.desc);
mv.visitLabel(l1);
mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null);
mv.visitInsn(RETURN);
mv.visitMaxs(2, 1);
mv.visitEnd();
}
super.visitEnd();
}
}
}
@@ -1,81 +0,0 @@
package com.gtnewhorizons.angelica.transform;
import static org.objectweb.asm.Opcodes.*;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
public class ACTOpenGlHelper implements IClassTransformer {
@Override
public byte[] transform(String par1, String par2, byte[] par3) {
ALog.fine("transforming %s %s", par1, par2);
ClassReader cr = new ClassReader(par3);
ClassWriter cw = new ClassWriter(cr, ClassWriter.COMPUTE_MAXS);
CVTransform cv = new CVTransform(cw);
cr.accept(cv, 0);
return cw.toByteArray();
}
private static class CVTransform extends ClassVisitor {
String classname;
public CVTransform(ClassVisitor cv) {
super(Opcodes.ASM4, cv);
}
@Override
public void visit(
int version, int access, String name, String signature, String superName, String[] interfaces) {
classname = name;
// SMCLog.info(" class %s",name);
cv.visit(version, access, name, signature, superName, interfaces);
}
// boolean has_activeTexUnit = false;
// @Override
// public FieldVisitor visitField(int access, String name, String desc,
// String signature, Object value) {
// //if (name.equals("activeTexUnit")) {
// // has_activeTexUnit = true;
// //}
// return cv.visitField(access, name, desc, signature, value);
// }
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
// if (!has_activeTexUnit) {
// has_activeTexUnit = true;
// FieldVisitor fv = cv.visitField(ACC_PUBLIC + ACC_STATIC, "activeTexUnit", "I", null, null);
// fv.visitEnd();
// SMCLog.finest(" add field activeTexUnit");
// }
// SMCLog.info(" method %s.%s%s = %s",classname,name,desc,remappedName);
if (Names.openGlHelper_setActiveTexture.equalsNameDesc(name, desc)) {
// SMCLog.info(" patching");
return new MVsetActiveTexture(cv.visitMethod(access, name, desc, signature, exceptions));
}
return cv.visitMethod(access, name, desc, signature, exceptions);
}
}
private static class MVsetActiveTexture extends MethodVisitor {
public MVsetActiveTexture(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
}
@Override
public void visitCode() {
mv.visitCode();
mv.visitVarInsn(ILOAD, 0);
mv.visitFieldInsn(PUTSTATIC, "com/gtnewhorizons/angelica/client/Shaders", "activeTexUnit", "I");
ALog.finest(" set activeTexUnit");
}
}
}
@@ -3,6 +3,7 @@ package com.gtnewhorizons.angelica.transform;
import static org.objectweb.asm.Opcodes.INVOKESTATIC;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
@@ -22,6 +23,7 @@ public class ACTPrjRedIlluRenderHalo implements IClassTransformer {
}
private static class CVTransform extends ClassVisitor {
String classname;
public CVTransform(ClassVisitor cv) {
@@ -29,16 +31,16 @@ public class ACTPrjRedIlluRenderHalo implements IClassTransformer {
}
@Override
public void visit(
int version, int access, String name, String signature, String superName, String[] interfaces) {
public void visit(int version, int access, String name, String signature, String superName,
String[] interfaces) {
this.classname = name;
// SMCLog.info(" class %s",name);
// ALog.info(" class %s",name);
super.visit(version, access, name, signature, superName, interfaces);
}
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
// SMCLog.info(" %s%s",name,desc);
// ALog.info(" %s%s",name,desc);
if ("prepareRenderState".equals(name) && "()V".equals(desc)) {
ALog.finer(" patch method %s.%s%s", classname, name, desc);
return new MVprepare(cv.visitMethod(access, name, desc, signature, exceptions));
@@ -52,6 +54,7 @@ public class ACTPrjRedIlluRenderHalo implements IClassTransformer {
}
private static class MVprepare extends MethodVisitor {
public MVprepare(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
}
@@ -61,7 +64,10 @@ public class ACTPrjRedIlluRenderHalo implements IClassTransformer {
if (Names.equals("codechicken/lib/render/CCRenderState", "reset", "()V", owner, name, desc)) {
ALog.info(" beginHalo");
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "beginProjectRedHalo", "()V");
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"beginProjectRedHalo",
"()V");
}
super.visitMethodInsn(opcode, owner, name, desc);
}
@@ -73,6 +79,7 @@ public class ACTPrjRedIlluRenderHalo implements IClassTransformer {
}
private static class MVrestore extends MethodVisitor {
public MVrestore(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
}
@@ -83,7 +90,10 @@ public class ACTPrjRedIlluRenderHalo implements IClassTransformer {
if (Names.equals("org/lwjgl/opengl/GL11", "glDisable", "(I)V", owner, name, desc)) {
ALog.info(" endHalo");
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "endProjectRedHalo", "()V");
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"endProjectRedHalo",
"()V");
}
}
}
@@ -1,69 +0,0 @@
package com.gtnewhorizons.angelica.transform;
import static org.objectweb.asm.Opcodes.*;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
public class ACTRender implements IClassTransformer {
@Override
public byte[] transform(String par1, String par2, byte[] par3) {
ALog.fine("transforming %s %s", par1, par2);
ClassReader cr = new ClassReader(par3);
ClassWriter cw = new ClassWriter(cr, ClassWriter.COMPUTE_MAXS);
CVTransform cv = new CVTransform(cw);
cr.accept(cv, 0);
return cw.toByteArray();
}
private static class CVTransform extends ClassVisitor {
String classname;
public CVTransform(ClassVisitor cv) {
super(Opcodes.ASM4, cv);
}
@Override
public void visit(
int version, int access, String name, String signature, String superName, String[] interfaces) {
classname = name;
// SMCLog.info(" class %s",name);
cv.visit(version, access, name, signature, superName, interfaces);
}
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
// SMCLog.info(" method %s.%s%s = %s",classname,name,desc,remappedName);
if (Names.render_renderShadow.equalsNameDesc(name, desc)) {
// SMCLog.finer(" patching method %s.%s%s = %s",classname,name,desc,nameM);
return new MVrenderShadow(cv.visitMethod(access, name, desc, signature, exceptions));
}
return cv.visitMethod(access, name, desc, signature, exceptions);
}
}
private static class MVrenderShadow extends MethodVisitor {
// protected MethodVisitor mv;
public MVrenderShadow(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
// this.mv = mv;
}
@Override
public void visitCode() {
mv.visitCode();
mv.visitFieldInsn(GETSTATIC, "com/gtnewhorizons/angelica/client/Shaders", "shouldSkipDefaultShadow", "Z");
Label l1 = new Label();
mv.visitJumpInsn(IFEQ, l1);
mv.visitInsn(RETURN);
mv.visitLabel(l1);
ALog.finer(" conditionally skip default shadow");
}
}
}
@@ -1,378 +0,0 @@
package com.gtnewhorizons.angelica.transform;
import static org.objectweb.asm.Opcodes.*;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.AbstractInsnNode;
import org.objectweb.asm.tree.InsnList;
import org.objectweb.asm.tree.MethodNode;
public class ACTRenderBlocks implements IClassTransformer {
@Override
public byte[] transform(String par1, String par2, byte[] par3) {
ALog.fine("transforming %s %s", par1, par2);
ClassReader cr = new ClassReader(par3);
ClassWriter cw = new ClassWriter(cr, ClassWriter.COMPUTE_MAXS);
CVTransform cv = new CVTransform(cw);
cr.accept(cv, 0);
return cw.toByteArray();
}
private static class CVTransform extends ClassVisitor {
String classname;
public CVTransform(ClassVisitor cv) {
super(Opcodes.ASM4, cv);
}
@Override
public void visit(
int version, int access, String name, String signature, String superName, String[] interfaces) {
classname = name;
// SMCLog.info(" class %s",name);
cv.visit(version, access, name, signature, superName, interfaces);
}
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
// SMCLog.info(" method %s.%s%s = %s",classname,name,desc,remappedName);
if (Names.renderBlocks_renderBlockByRenderType.equalsNameDesc(name, desc)) {
// SMCLog.finer(" patching method %s.%s%s = %s",classname,name,desc,remappedName);
return new MVrenBlkByRenType(cv.visitMethod(access, name, desc, signature, exceptions));
} else if (Names.renderBlocks_renderBlockFlowerPot.equalsNameDesc(name, desc)) {
// SMCLog.finer(" patching method %s.%s%s = %s",classname,name,desc,remappedName);
return new MVrenBlkFlowerPot(cv.visitMethod(access, name, desc, signature, exceptions));
} else if (Names.renderBlocks_renderStdBlockWithAOP.equalsNameDesc(name, desc)
|| Names.renderBlocks_renderStdBlockWithAO.equalsNameDesc(name, desc)) {
// SMCLog.finer(" patching method %s.%s%s = %s",classname,name,desc,remappedName);
return new MVrenBlkWithAO(
access,
name,
desc,
signature,
exceptions,
cv.visitMethod(access, name, desc, signature, exceptions));
} else if (Names.renderBlocks_renderStdBlockWithCM.equalsNameDesc(name, desc)
|| Names.renderBlocks_renderBlockCactusImpl.equalsNameDesc(name, desc)
|| Names.renderBlocks_renderBlockBed.equalsNameDesc(name, desc)
|| Names.renderBlocks_renderBlockFluids.equalsNameDesc(name, desc)
|| Names.renderBlocks_renderBlockDoor.equalsNameDesc(name, desc)
|| Names.renderBlocks_renderBlockSandFalling.equalsNameDesc(name, desc)) {
// SMCLog.finer(" patching method %s.%s%s = %s",classname,name,desc,remappedName);
return new MVrenBlkFVar(cv.visitMethod(access, name, desc, signature, exceptions));
} else if (Names.renderBlocks_renderPistonExtension.equalsNameDesc(name, desc)) {
// SMCLog.finer(" patching method %s.%s%s = %s",classname,name,desc,remappedName);
return new MVrenBlkPistonExt(cv.visitMethod(access, name, desc, signature, exceptions));
}
return cv.visitMethod(access, name, desc, signature, exceptions);
}
}
private static class MVrenBlkByRenType extends MethodVisitor {
public MVrenBlkByRenType(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
}
int nPatch = 0;
@Override
public void visitCode() {
mv.visitCode();
mv.visitVarInsn(ALOAD, 0);
mv.visitVarInsn(ALOAD, 1);
mv.visitVarInsn(ILOAD, 2);
mv.visitVarInsn(ILOAD, 3);
mv.visitVarInsn(ILOAD, 4);
mv.visitMethodInsn(
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"pushEntity",
"(" + Names.renderBlocks_.desc + Names.block_.desc + "III)V");
// SMCLog.info(" pushEntity");
++nPatch;
}
@Override
public void visitInsn(int opcode) {
if (opcode == Opcodes.IRETURN) {
mv.visitMethodInsn(INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "popEntity", "()V");
// SMCLog.info(" popEntity");
++nPatch;
}
mv.visitInsn(opcode);
}
@Override
public void visitEnd() {
mv.visitEnd();
// SMCLog.info(" %d", nPatch);
}
}
private static class MVrenBlkFlowerPot extends MethodVisitor {
public MVrenBlkFlowerPot(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
}
int nPatch = 0;
int state = 0;
@Override
public void visitVarInsn(int opcode, int var) {
super.visitVarInsn(opcode, var);
if (state == 1) {
++state;
mv.visitVarInsn(ALOAD, var);
mv.visitMethodInsn(
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"pushEntity",
"(" + Names.block_.desc + ")V");
}
}
@Override
public void visitMethodInsn(int opcode, String owner, String name, String desc) {
super.visitMethodInsn(opcode, owner, name, desc);
switch (state) {
case 0:
if (Names.block_getBlockFromItem.equals(owner, name, desc)) {
++state;
}
break;
case 2:
if (Names.tessellator_addTranslation.equals(owner, name, desc)) {
++state;
}
break;
case 3:
if (Names.tessellator_addTranslation.equals(owner, name, desc)) {
++state;
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "popEntity", "()V");
}
break;
}
}
@Override
public void visitCode() {
mv.visitCode();
mv.visitVarInsn(ALOAD, 0);
mv.visitVarInsn(ALOAD, 1);
mv.visitVarInsn(ILOAD, 2);
mv.visitVarInsn(ILOAD, 3);
mv.visitVarInsn(ILOAD, 4);
mv.visitMethodInsn(
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"pushEntity",
"(" + Names.renderBlocks_.desc + Names.block_.desc + "III)V");
// SMCLog.info(" pushEntity");
++nPatch;
}
@Override
public void visitInsn(int opcode) {
if (opcode == Opcodes.IRETURN) {
mv.visitMethodInsn(INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "popEntity", "()V");
// SMCLog.info(" popEntity");
++nPatch;
}
mv.visitInsn(opcode);
}
@Override
public void visitEnd() {
mv.visitEnd();
// SMCLog.info(" %d", nPatch);
}
}
static final String[] fieldsBlockLightLevel = {null, "blockLightLevel05", "blockLightLevel06", "blockLightLevel08"};
private static class MVrenBlkWithAO extends MethodVisitor {
MethodVisitor mv1;
MethodNode mn;
int nPatch = 0;
public MVrenBlkWithAO(
final int access,
final String name,
final String desc,
final String signature,
final String[] exceptions,
MethodVisitor mv) {
super(Opcodes.ASM4);
super.mv = this.mn = new MethodNode(access, name, desc, signature, exceptions);
this.mv1 = mv;
}
@Override
public void visitEnd() {
mn.visitEnd();
mn.accept(mv1);
// SMCLog.info(" %d", nPatch);
}
@Override
public void visitLdcInsn(Object cst) {
int match1 = 0;
if (cst instanceof Float) {
float fcst = ((Float) cst).floatValue();
if (fcst == 0.5f) match1 = 1;
else if (fcst == 0.6f) match1 = 2;
else if (fcst == 0.8f) match1 = 3;
}
if (match1 != 0) {
int match2 = 0;
InsnList insns = mn.instructions;
AbstractInsnNode insn = insns.getLast();
if (insn != null && insn.getOpcode() == Opcodes.FLOAD) {
insn = insn.getPrevious();
if (insn != null && insn.getOpcode() == Opcodes.ALOAD) {
insn = insn.getPrevious();
if (insn != null && insn.getOpcode() == Opcodes.ALOAD) {
insn = insn.getPrevious();
if (insn != null && insn.getOpcode() == Opcodes.ALOAD) {
insn = insn.getPrevious();
if (insn != null && insn.getOpcode() == Opcodes.ALOAD) {
match2 = match1;
}
}
}
}
}
if (insn != null && insn.getOpcode() == Opcodes.ALOAD) {
insn = insn.getPrevious();
if (insn != null && insn.getOpcode() == Opcodes.ALOAD) {
insn = insn.getPrevious();
if (insn != null && insn.getOpcode() == Opcodes.ALOAD) {
insn = insn.getPrevious();
if (insn != null && insn.getOpcode() == Opcodes.ALOAD) {
match2 = match1;
}
}
}
}
if (match2 != 0) {
String fieldName = fieldsBlockLightLevel[match2];
mn.visitFieldInsn(GETSTATIC, "com/gtnewhorizons/angelica/client/Shaders", fieldName, "F");
// SMCLog.info(" %s", fieldName);
++nPatch;
return;
}
}
mn.visitLdcInsn(cst);
}
}
private static class MVrenBlkFVar extends MethodVisitor {
int nPatch = 0;
public MVrenBlkFVar(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
}
int state = 0;
@Override
public void visitLdcInsn(Object cst) {
int match1 = 0;
if (cst instanceof Float) {
float fcst = ((Float) cst).floatValue();
if (fcst == 0.5f) match1 = 1;
else if (fcst == 0.6f) match1 = 2;
else if (fcst == 0.8f) match1 = 3;
}
if (match1 != 0 && state < 3) {
++state;
String fieldName = fieldsBlockLightLevel[match1];
mv.visitFieldInsn(GETSTATIC, "com/gtnewhorizons/angelica/client/Shaders", fieldName, "F");
// SMCLog.info(" %s", fieldName);
++nPatch;
return;
}
mv.visitLdcInsn(cst);
}
@Override
public void visitEnd() {
mv.visitEnd();
// SMCLog.info(" %d", nPatch);
}
}
private static class MVrenBlkPistonExt extends MethodVisitor {
int nPatch = 0;
public MVrenBlkPistonExt(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
}
int state = 0;
@Override
public void visitTableSwitchInsn(int min, int max, Label dflt, Label... labels) {
state = 1;
mv.visitTableSwitchInsn(min, max, dflt, labels);
}
@Override
public void visitLdcInsn(Object cst) {
int match1 = 0;
if (cst instanceof Float) {
float fcst = ((Float) cst).floatValue();
if (fcst == 0.5f) match1 = 1;
else if (fcst == 0.6f) match1 = 2;
else if (fcst == 0.8f) match1 = 3;
}
if (match1 != 0 && state == 1) {
String fieldName = fieldsBlockLightLevel[match1];
mv.visitFieldInsn(GETSTATIC, "com/gtnewhorizons/angelica/client/Shaders", fieldName, "F");
// SMCLog.info(" %s", fieldName);
++nPatch;
return;
}
mv.visitLdcInsn(cst);
}
@Override
public void visitEnd() {
mv.visitEnd();
// SMCLog.info(" %d", nPatch);
}
}
// private static class MVNTransform extends MethodVisitor
// {
// protected MethodVisitor mv;
// protected MethodNode mn;
// public MVNTransform(MethodNode mn, MethodVisitor mv) {
// super(Opcodes.ASM4);
// super.mv = this.mn = mn;
// this.mv = mv;
// }
//
// @Override
// public void visitEnd() {
// super.visitEnd();
// Iterator<AbstractInsnNode> it = mn.instructions.iterator();
// while (it.hasNext())
// {
// AbstractInsnNode node = it.next();
// System.out.println(node.toString());
// }
// // send to target
// mn.accept(mv);
// }
// }
}
@@ -1,348 +0,0 @@
package com.gtnewhorizons.angelica.transform;
import static org.objectweb.asm.Opcodes.*;
import net.minecraft.launchwrapper.IClassTransformer;
import org.lwjgl.opengl.GL11;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.FieldVisitor;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
public class ACTRenderGlobal implements IClassTransformer {
@Override
public byte[] transform(String par1, String par2, byte[] par3) {
ALog.fine("transforming %s %s", par1, par2);
ClassReader cr = new ClassReader(par3);
ClassWriter cw = new ClassWriter(cr, ClassWriter.COMPUTE_MAXS);
CVTransform cv = new CVTransform(cw);
cr.accept(cv, 0);
return cw.toByteArray();
}
private static class CVTransform extends ClassVisitor {
String classname;
public CVTransform(ClassVisitor cv) {
super(Opcodes.ASM4, cv);
}
@Override
public void visit(
int version, int access, String name, String signature, String superName, String[] interfaces) {
classname = name;
// SMCLog.info(" class %s",name);
cv.visit(version, access, name, signature, superName, interfaces);
}
@Override
public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) {
if (Names.renderGlobal_worldRenderers.name.equals(name)) {
access = access & (~ACC_PRIVATE & ~ACC_PROTECTED) | ACC_PUBLIC;
}
return cv.visitField(access, name, desc, signature, value);
}
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
// String remappedName = SMCRemap.remapper.mapMethodName(classname, name, desc);
// SMCLog.info(" method %s.%s%s = %s",classname,name,desc,remappedName);
if (Names.renderGlobal_renderEntities.equalsNameDesc(name, desc)) {
ALog.finer(" patch method %s.%s%s", classname, name, desc);
return new MVrenderEntities(cv.visitMethod(access, name, desc, signature, exceptions));
} else if (Names.renderGlobal_sortAndRender.equalsNameDesc(name, desc)) {
ALog.finer(" patch method %s.%s%s", classname, name, desc);
return new MVendisTexFog(cv.visitMethod(access, name, desc, signature, exceptions));
} else if (Names.renderGlobal_renderSky.equalsNameDesc(name, desc)) {
ALog.finer(" patch method %s.%s%s", classname, name, desc);
return new MVrenderSky(cv.visitMethod(access, name, desc, signature, exceptions));
} else if (Names.renderGlobal_drawBlockDamageTexture.equalsNameDesc(name, desc)
|| name.equals("drawBlockDamageTexture")) // Optifine
{
ALog.finer(" patch method %s.%s%s", classname, name, desc);
return new MVdrawBlockDamageTexture(cv.visitMethod(access, name, desc, signature, exceptions));
} else if (Names.renderGlobal_drawSelectionBox.equalsNameDesc(name, desc)) {
ALog.finer(" patch method %s.%s%s", classname, name, desc);
return new MVendisTexFog(cv.visitMethod(access, name, desc, signature, exceptions));
}
return cv.visitMethod(access, name, desc, signature, exceptions);
}
}
private static class MVrenderEntities extends MethodVisitor {
public MVrenderEntities(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
}
int state = 0;
@Override
public void visitLdcInsn(Object cst) {
if (cst instanceof String) {
String scst = (String) cst;
if (scst.equals("entities")) {
state = 1;
} else if (scst.equals("blockentities")) {
state = 4;
}
}
mv.visitLdcInsn(cst);
}
@Override
public void visitFieldInsn(int opcode, String owner, String name, String desc) {
if (state == 2) {
if (Names.renderManager_instance.equals(owner, name, desc)) {
state = 3;
mv.visitMethodInsn(INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "nextEntity", "()V");
}
}
mv.visitFieldInsn(opcode, owner, name, desc);
}
@Override
public void visitMethodInsn(int opcode, String owner, String name, String desc) {
mv.visitMethodInsn(opcode, owner, name, desc);
if (state == 1) {
state = 2;
mv.visitMethodInsn(INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "beginEntities", "()V");
ALog.finest(" %s", "beginEntities");
} else if (state == 4) {
state = 5;
mv.visitMethodInsn(INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "endEntities", "()V");
ALog.finest(" %s", "endEntities");
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "beginBlockEntities", "()V");
ALog.finest(" %s", "beginTileEntities");
} else if (state == 5) {
if (Names.entityRenderer_disableLightmap.equals(owner, name, desc)) {
state = 6;
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "endBlockEntities", "()V");
ALog.finest(" %s", "endTileEntities");
}
}
}
}
/* detect glEnable or glDisable (TEXTURE_2D or FOG) */
private static class MVendisTexFog extends MethodVisitor {
public MVendisTexFog(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
}
int lastInt = 0;
@Override
public void visitIntInsn(int opcode, int operand) {
mv.visitIntInsn(opcode, operand);
if (opcode == SIPUSH && (operand == 3553 || operand == 2912)) {
lastInt = operand;
} else {
lastInt = 0;
}
}
@Override
public void visitMethodInsn(int opcode, String owner, String name, String desc) {
mv.visitMethodInsn(opcode, owner, name, desc);
if (owner.equals("org/lwjgl/opengl/GL11")) {
if (name.equals("glEnable")) {
if (lastInt == GL11.GL_TEXTURE_2D) {
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "enableTexture2D", "()V");
ALog.finest(" %s", "enableTexture2D");
} else if (lastInt == GL11.GL_FOG) {
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "enableFog", "()V");
ALog.finest(" %s", "enableFog");
}
} else if (name.equals("glDisable")) {
if (lastInt == GL11.GL_TEXTURE_2D) {
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "disableTexture2D", "()V");
ALog.finest(" %s", "disableTexture2D");
} else if (lastInt == GL11.GL_FOG) {
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "disableFog", "()V");
ALog.finest(" %s", "disableFog");
}
}
}
lastInt = 0;
}
}
/* extends MVenableTF */
private static class MVrenderSky extends MVendisTexFog {
public MVrenderSky(MethodVisitor mv) {
super(mv);
}
int state = 0;
boolean detectedOptifine = false;
int lastInt = 0;
int lastVar = 0;
@Override
public void visitIntInsn(int opcode, int operand) {
mv.visitIntInsn(opcode, operand);
if (opcode == SIPUSH) {
lastInt = operand;
} else {
lastInt = 0;
}
}
@Override
public void visitVarInsn(int opcode, int var) {
mv.visitVarInsn(opcode, var);
if (opcode == ALOAD) {
lastVar = var;
} else {
lastVar = 0;
}
}
@Override
public void visitFieldInsn(int opcode, String owner, String name, String desc) {
switch (state) {
case 0:
if (Names.vec3_xCoord.equals(owner, name)) {
++state;
mv.visitMethodInsn(
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"setSkyColor",
"(" + Names.vec3_.desc + ")V");
mv.visitVarInsn(ALOAD, lastVar);
break;
}
break;
case 1:
if (Names.renderGlobal_glSkyList.equals(owner, name)) {
++state;
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "preSkyList", "()V");
break;
}
break;
}
mv.visitFieldInsn(opcode, owner, name, desc);
}
@Override
public void visitMethodInsn(int opcode, String owner, String name, String desc) {
// SMCLog.info(" %s.%s%s",ownerM,nameM,descM);
switch (state) {
case 0:
if (owner.equals("Config") && name.equals("isSkyEnabled")) {
detectedOptifine = true;
}
break;
case 2:
if (Names.worldClient_getRainStrength.equals(owner, name, desc)) {
++state;
}
break;
}
//
mv.visitMethodInsn(opcode, owner, name, desc);
//
if (owner.equals("org/lwjgl/opengl/GL11")) {
if (name.equals("glEnable")) {
if (lastInt == GL11.GL_TEXTURE_2D) {
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "enableTexture2D", "()V");
ALog.finest(" %s", "enableTexture2D");
} else if (lastInt == GL11.GL_FOG) {
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "enableFog", "()V");
ALog.finest(" %s", "enableFog");
}
} else if (name.equals("glDisable")) {
if (lastInt == GL11.GL_TEXTURE_2D) {
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "disableTexture2D", "()V");
ALog.finest(" %s", "disableTexture2D");
} else if (lastInt == GL11.GL_FOG) {
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "disableFog", "()V");
ALog.finest(" %s", "disableFog");
}
} else if (name.equals("glRotatef")) {
ALog.finest(" *%s %d", "glRotatef", state);
if (state == 3) {
++state;
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "preCelestialRotate", "()V");
ALog.finest(" %s", "preCelestialRotate");
} else if (state == 4) {
++state;
mv.visitMethodInsn(
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"postCelestialRotate",
"()V");
ALog.finest(" %s", "postCelestialRotate");
}
}
}
}
}
private static class MVdrawBlockDamageTexture extends MethodVisitor {
int state = 0;
public MVdrawBlockDamageTexture(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
}
@Override
public void visitIntInsn(int opcode, int operand) {
switch (state) {
case 0:
if (opcode == SIPUSH && operand == GL11.GL_ALPHA_TEST) {
++state;
}
break;
case 2:
if (opcode == SIPUSH && operand == GL11.GL_ALPHA_TEST) {
++state;
mv.visitMethodInsn(
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"endBlockDestroyProgress",
"()V");
ALog.finest(" %s", "endBlockDestroyProgress");
}
break;
}
mv.visitIntInsn(opcode, operand);
}
@Override
public void visitMethodInsn(int opcode, String owner, String name, String desc) {
switch (state) {
case 1:
if (owner.equals("org/lwjgl/opengl/GL11") && name.equals("glEnable")) {
++state;
mv.visitMethodInsn(opcode, owner, name, desc);
mv.visitMethodInsn(
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"beginBlockDestroyProgress",
"()V");
ALog.finest(" %s", "beginBlockDestroyProgress");
return;
}
break;
}
mv.visitMethodInsn(opcode, owner, name, desc);
}
}
}
@@ -3,6 +3,7 @@ package com.gtnewhorizons.angelica.transform;
import static org.objectweb.asm.Opcodes.*;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
@@ -23,6 +24,7 @@ public class ACTRenderManager implements IClassTransformer {
}
private static class CVTransform extends ClassVisitor {
String classname;
boolean endFields = false;
@@ -31,10 +33,10 @@ public class ACTRenderManager implements IClassTransformer {
}
@Override
public void visit(
int version, int access, String name, String signature, String superName, String[] interfaces) {
public void visit(int version, int access, String name, String signature, String superName,
String[] interfaces) {
classname = name;
// SMCLog.info(" class %s",name);
// ALog.info(" class %s",name);
cv.visit(version, access, name, signature, superName, interfaces);
}
@@ -3,6 +3,7 @@ package com.gtnewhorizons.angelica.transform;
import static org.objectweb.asm.Opcodes.*;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
@@ -22,6 +23,7 @@ public class ACTRenderSpider implements IClassTransformer {
}
private static class CVTransform extends ClassVisitor {
String classname;
public CVTransform(ClassVisitor cv) {
@@ -29,26 +31,26 @@ public class ACTRenderSpider implements IClassTransformer {
}
@Override
public void visit(
int version, int access, String name, String signature, String superName, String[] interfaces) {
public void visit(int version, int access, String name, String signature, String superName,
String[] interfaces) {
classname = name;
// SMCLog.info(" class %s",name);
// ALog.info(" class %s",name);
cv.visit(version, access, name, signature, superName, interfaces);
}
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
// SMCLog.info(" method %s.%s%s = %s",classname,name,desc,remappedName);
// ALog.info(" method %s.%s%s = %s",classname,name,desc,remappedName);
if (Names.renderDragon_shouldRenderPass.equalsNameDesc(name, desc)) {
// SMCLog.finer(" patching method %s.%s%s = %s",classname,name,desc,nameM);
// ALog.finer(" patching method %s.%s%s = %s",classname,name,desc,nameM);
return new MVshouldRenderPass(cv.visitMethod(access, name, desc, signature, exceptions));
}
if (Names.renderEnderman_shouldRenderPass.equalsNameDesc(name, desc)) {
// SMCLog.finer(" patching method %s.%s%s = %s",classname,name,desc,nameM);
// ALog.finer(" patching method %s.%s%s = %s",classname,name,desc,nameM);
return new MVshouldRenderPass(cv.visitMethod(access, name, desc, signature, exceptions));
}
if (Names.renderSpider_shouldRenderPass.equalsNameDesc(name, desc)) {
// SMCLog.finer(" patching method %s.%s%s = %s",classname,name,desc,nameM);
// ALog.finer(" patching method %s.%s%s = %s",classname,name,desc,nameM);
return new MVshouldRenderPass(cv.visitMethod(access, name, desc, signature, exceptions));
}
return cv.visitMethod(access, name, desc, signature, exceptions);
@@ -56,6 +58,7 @@ public class ACTRenderSpider implements IClassTransformer {
}
private static class MVshouldRenderPass extends MethodVisitor {
public MVshouldRenderPass(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
}
@@ -3,6 +3,7 @@ package com.gtnewhorizons.angelica.transform;
import static org.objectweb.asm.Opcodes.*;
import net.minecraft.launchwrapper.IClassTransformer;
import org.lwjgl.opengl.GL12;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
@@ -25,6 +26,7 @@ public class ACTRendererLivingEntity implements IClassTransformer {
}
private static class CVTransform extends ClassVisitor {
String classname;
public CVTransform(ClassVisitor cv) {
@@ -32,10 +34,10 @@ public class ACTRendererLivingEntity implements IClassTransformer {
}
@Override
public void visit(
int version, int access, String name, String signature, String superName, String[] interfaces) {
public void visit(int version, int access, String name, String signature, String superName,
String[] interfaces) {
classname = name;
// SMCLog.info(" class %s",name);
// ALog.info(" class %s",name);
cv.visit(version, access, name, signature, superName, interfaces);
}
@@ -50,12 +52,12 @@ public class ACTRendererLivingEntity implements IClassTransformer {
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
// SMCLog.info(" method %s.%s%s = %s",classname,name,desc,remappedName);
// ALog.info(" method %s.%s%s = %s",classname,name,desc,remappedName);
if (Names.rendererLivingE_doRender.equalsNameDesc(name, desc)) {
// SMCLog.finer(" patching method %s.%s%s = %s",classname,name,desc,nameM);
// ALog.finer(" patching method %s.%s%s = %s",classname,name,desc,nameM);
return new MVdoRenderLiving(cv.visitMethod(access, name, desc, signature, exceptions));
} else if (Names.rendererLivingE_renderLabel.equalsNameDesc(name, desc)) {
// SMCLog.finer(" patching method %s.%s%s = %s",classname,name,desc,nameM);
// ALog.finer(" patching method %s.%s%s = %s",classname,name,desc,nameM);
return new MVrenderLivingLabel(cv.visitMethod(access, name, desc, signature, exceptions));
}
return cv.visitMethod(access, name, desc, signature, exceptions);
@@ -63,13 +65,14 @@ public class ACTRendererLivingEntity implements IClassTransformer {
}
private static class MVdoRenderLiving extends MethodVisitor {
public MVdoRenderLiving(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
}
@Override
public void visitCode() {
// SMCLog.info(" insert code");
// ALog.info(" insert code");
mv.visitCode();
mv.visitFieldInsn(GETSTATIC, "com/gtnewhorizons/angelica/client/Shaders", "useEntityHurtFlash", "Z");
Label label1 = new Label();
@@ -99,7 +102,7 @@ public class ACTRendererLivingEntity implements IClassTransformer {
mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null);
mv.visitInsn(ICONST_0);
mv.visitLabel(label4);
mv.visitFrame(Opcodes.F_SAME1, 0, null, 1, new Object[] {Opcodes.INTEGER});
mv.visitFrame(Opcodes.F_SAME1, 0, null, 1, new Object[] { Opcodes.INTEGER });
mv.visitVarInsn(ALOAD, 0);
mv.visitVarInsn(ALOAD, 1);
mv.visitVarInsn(ALOAD, 1);
@@ -116,10 +119,13 @@ public class ACTRendererLivingEntity implements IClassTransformer {
Names.rendererLivingE_getColorMultiplier.name,
Names.rendererLivingE_getColorMultiplier.desc);
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "setEntityHurtFlash", "(II)V");
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"setEntityHurtFlash",
"(II)V");
mv.visitLabel(label1);
mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null);
// SMCLog.info(" end insert");
// ALog.info(" end insert");
}
/** last SIPUSH operand */
@@ -144,9 +150,9 @@ public class ACTRendererLivingEntity implements IClassTransformer {
if (cst instanceof Integer) {
int icst = ((Integer) cst).intValue();
if (icst == GL12.GL_RESCALE_NORMAL) {
// SMCLog.info(" rescale_normal");
// ALog.info(" rescale_normal");
if (labelEndVH != null) {
// SMCLog.info(" jump target");
// ALog.info(" jump target");
mv.visitLabel(labelEndVH);
labelEndVH = null;
}
@@ -157,15 +163,21 @@ public class ACTRendererLivingEntity implements IClassTransformer {
@Override
public void visitMethodInsn(int opcode, String owner, String name, String desc) {
// SMCLog.info(" %s.%s%s",ownerM,nameM,descM);
// ALog.info(" %s.%s%s",ownerM,nameM,descM);
if (opcode == INVOKEVIRTUAL) {
if (Names.rendererLivingE_renderEquippedItems.equals(owner, name, desc)) {
// SMCLog.info(" renderEquippedItems");
// ALog.info(" renderEquippedItems");
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "resetEntityHurtFlash", "()V");
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"resetEntityHurtFlash",
"()V");
mv.visitMethodInsn(opcode, owner, name, desc);
mv.visitFieldInsn(
GETSTATIC, "com/gtnewhorizons/angelica/client/Shaders", "useEntityHurtFlash", "Z");
GETSTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"useEntityHurtFlash",
"Z");
labelEndVH = new Label();
mv.visitJumpInsn(IFNE, labelEndVH);
state = 1;
@@ -177,29 +189,41 @@ public class ACTRendererLivingEntity implements IClassTransformer {
//
if (opcode == INVOKESTATIC) {
if (Names.equals("org/lwjgl/opengl/GL11", "glDepthFunc", "(I)V", owner, name, desc)) {
// SMCLog.info(" glDepthFunc");
// ALog.info(" glDepthFunc");
if (state == 3) {
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "beginLivingDamage", "()V");
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"beginLivingDamage",
"()V");
++state;
} else if (state == 4) {
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "endLivingDamage", "()V");
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"endLivingDamage",
"()V");
++state;
}
} else if (Names.openGlHelper_setActiveTexture.equals(owner, name, desc)) {
// SMCLog.info(" setActiveTexture");
// ALog.info(" setActiveTexture");
if (state == 1) {
++state;
} else if (state == 2) {
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "disableLightmap", "()V");
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"disableLightmap",
"()V");
++state;
} else if (state == 5) {
++state;
} else if (state == 6) {
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/Shaders", "enableLightmap", "()V");
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/Shaders",
"enableLightmap",
"()V");
++state;
}
}
@@ -216,6 +240,7 @@ public class ACTRendererLivingEntity implements IClassTransformer {
}
private static class MVrenderLivingLabel extends MethodVisitor {
public MVrenderLivingLabel(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
}
@@ -246,28 +271,28 @@ public class ACTRendererLivingEntity implements IClassTransformer {
}
}
// private static class MVNTransform extends MethodVisitor
// {
// protected MethodVisitor mv;
// protected MethodNode mn;
// public MVNTransform(MethodNode mn, MethodVisitor mv) {
// super(Opcodes.ASM4);
// super.mv = this.mn = mn;
// this.mv = mv;
// }
// private static class MVNTransform extends MethodVisitor
// {
// protected MethodVisitor mv;
// protected MethodNode mn;
// public MVNTransform(MethodNode mn, MethodVisitor mv) {
// super(Opcodes.ASM4);
// super.mv = this.mn = mn;
// this.mv = mv;
// }
//
// @Override
// public void visitEnd() {
// super.visitEnd();
// Iterator<AbstractInsnNode> it = mn.instructions.iterator();
// while (it.hasNext())
// {
// AbstractInsnNode node = it.next();
// System.out.println(node.toString());
// }
// // send to target
// mn.accept(mv);
// }
// }
// @Override
// public void visitEnd() {
// super.visitEnd();
// Iterator<AbstractInsnNode> it = mn.instructions.iterator();
// while (it.hasNext())
// {
// AbstractInsnNode node = it.next();
// System.out.println(node.toString());
// }
// // send to target
// mn.accept(mv);
// }
// }
}
@@ -3,6 +3,7 @@ package com.gtnewhorizons.angelica.transform;
import static org.objectweb.asm.Opcodes.*;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
@@ -22,6 +23,7 @@ public class ACTSmartMoveModelRotationRenderer implements IClassTransformer {
}
private static class CVTransform extends ClassVisitor {
String classname;
public CVTransform(ClassVisitor cv) {
@@ -29,16 +31,16 @@ public class ACTSmartMoveModelRotationRenderer implements IClassTransformer {
}
@Override
public void visit(
int version, int access, String name, String signature, String superName, String[] interfaces) {
public void visit(int version, int access, String name, String signature, String superName,
String[] interfaces) {
classname = name;
// SMCLog.info(" class %s",name);
// ALog.info(" class %s",name);
cv.visit(version, access, name, signature, superName, interfaces);
}
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
// SMCLog.info(" method %s.%s%s = %s",classname,name,desc,remappedName);
// ALog.info(" method %s.%s%s = %s",classname,name,desc,remappedName);
if ("resetDisplayList".equals(name) && "()V".equals(desc)) {
return null;
}
@@ -57,12 +59,18 @@ public class ACTSmartMoveModelRotationRenderer implements IClassTransformer {
mv.visitInsn(ICONST_0);
// mv.visitFieldInsn(PUTFIELD, "net/smart/render/ModelRotationRenderer", "compiled", "Z");
mv.visitFieldInsn(
PUTFIELD, "net/smart/render/ModelRotationRenderer", Names.modelRenderer_compiled.name, "Z");
PUTFIELD,
"net/smart/render/ModelRotationRenderer",
Names.modelRenderer_compiled.name,
"Z");
mv.visitVarInsn(ALOAD, 0);
mv.visitInsn(ICONST_0);
// mv.visitFieldInsn(PUTFIELD, "net/smart/render/ModelRotationRenderer", "displayList", "I");
mv.visitFieldInsn(
PUTFIELD, "net/smart/render/ModelRotationRenderer", Names.modelRenderer_displayList.name, "I");
PUTFIELD,
"net/smart/render/ModelRotationRenderer",
Names.modelRenderer_displayList.name,
"I");
mv.visitInsn(RETURN);
mv.visitMaxs(2, 1);
mv.visitEnd();
@@ -1,476 +0,0 @@
package com.gtnewhorizons.angelica.transform;
import static org.objectweb.asm.Opcodes.*;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.FieldVisitor;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
/** transformer for net.minecraft.client.renderer.Tessellator */
public class ACTTessellator implements IClassTransformer {
@Override
public byte[] transform(String par1, String par2, byte[] par3) {
ALog.fine("transforming %s %s", par1, par2);
ClassReader cr = new ClassReader(par3);
ClassWriter cw = new ClassWriter(cr, ClassWriter.COMPUTE_MAXS);
CVTransform cv = new CVTransform(cw);
cr.accept(cv, 0);
return cw.toByteArray();
}
private static boolean inputHasStaticBuffer = false;
private static class CVTransform extends ClassVisitor {
String classname;
boolean endFields = false;
public CVTransform(ClassVisitor cv) {
super(Opcodes.ASM4, cv);
}
@Override
public void visit(
int version, int access, String name, String signature, String superName, String[] interfaces) {
classname = name;
// SMCLog.info(" class %s",name);
cv.visit(version, access, name, signature, superName, interfaces);
}
@Override
public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) {
// SMCLog.fine("%x %s %s %s",access,desc,name,nameM);
if (name.equals("vertexPos")
|| name.equals("normalX")
|| name.equals("normalY")
|| name.equals("normalZ")
|| name.equals("midTextureU")
|| name.equals("midTextureV")) {
return null;
} else if (((access & ACC_STATIC) != 0)
&& (Names.tessellator_byteBuffer.name.equals(name)
|| Names.tessellator_intBuffer.name.equals(name)
|| Names.tessellator_floatBuffer.name.equals(name)
|| Names.tessellator_shortBuffer.name.equals(name)
|| Names.tessellator_vertexCount.name.equals(name)
// nameM.equals(Names.Tessellator_useVBO) ||
// nameM.equals(Names.Tessellator_vertexBuffers)
)) {
inputHasStaticBuffer = true;
// SMCLog.finest(" input has static buffer");
access = access & (~ACC_STATIC & ~ACC_PRIVATE & ~ACC_PROTECTED) | ACC_PUBLIC;
} else {
access = access & (~ACC_PRIVATE & ~ACC_PROTECTED) | ACC_PUBLIC;
}
return cv.visitField(access, name, desc, signature, value);
}
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
if (!endFields) {
endFields = true;
FieldVisitor fv;
fv = cv.visitField(ACC_PUBLIC, "vertexPos", "[F", null, null);
fv.visitEnd();
fv = cv.visitField(ACC_PUBLIC, "normalX", "F", null, null);
fv.visitEnd();
fv = cv.visitField(ACC_PUBLIC, "normalY", "F", null, null);
fv.visitEnd();
fv = cv.visitField(ACC_PUBLIC, "normalZ", "F", null, null);
fv.visitEnd();
fv = cv.visitField(ACC_PUBLIC, "midTextureU", "F", null, null);
fv.visitEnd();
fv = cv.visitField(ACC_PUBLIC, "midTextureV", "F", null, null);
fv.visitEnd();
}
// SMCLog.fine(" method %s.%s%s = %s",classname,name,desc,nameM);
if (name.equals("<clinit>")) {
// SMCLog.finer(" patching method %s.%s%s = %s",classname,name,desc,nameM);
return new MVclinit(cv.visitMethod(access, name, desc, signature, exceptions));
} else if (name.equals("<init>") && desc.equals("()V")) {
// SMCLog.finer(" patching method %s.%s%s = %s",classname,name,desc,nameM);
return new MVinit(cv.visitMethod(access, name, desc, signature, exceptions));
} else if (name.equals("<init>") && desc.equals("(I)V")) {
// SMCLog.finer(" patching method %s.%s%s = %s",classname,name,desc,nameM);
return new MVinitI(cv.visitMethod(access, name, desc, signature, exceptions));
} else if (Names.tessellator_draw.equalsNameDesc(name, desc)) {
// SMCLog.finer(" patching method %s.%s%s = %s",classname,name,desc,nameM);
return new MVdraw(cv.visitMethod(access, name, desc, signature, exceptions));
} else if (Names.tessellator_reset.equalsNameDesc(name, desc)) {
// SMCLog.finer(" patching method %s.%s%s = %s",classname,name,desc,nameM);
access = access & ~(ACC_PRIVATE | ACC_PROTECTED) | ACC_PUBLIC;
return new MVreset(cv.visitMethod(access, name, desc, signature, exceptions));
} else if (Names.tessellator_addVertex.equalsNameDesc(name, desc)) {
// SMCLog.finer(" patching method %s.%s%s = %s",classname,name,desc,nameM);
return new MVaddVertex(cv.visitMethod(access, name, desc, signature, exceptions));
} else if (Names.tessellator_setNormal.equalsNameDesc(name, desc)) {
// SMCLog.finer(" patching method %s.%s%s = %s",classname,name,desc,nameM);
return new MVsetNormal(cv.visitMethod(access, name, desc, signature, exceptions));
} else if (Names.tessellator_sortQuad.equalsNameDesc(name, desc)) {
// SMCLog.finer(" patching method %s.%s%s = %s",classname,name,desc,nameM);
return new MVsortQuad(cv.visitMethod(access, name, desc, signature, exceptions));
} else {
access = access & ~(ACC_PRIVATE | ACC_PROTECTED) | ACC_PUBLIC;
}
return cv.visitMethod(access, name, desc, signature, exceptions);
}
}
/*private static class MVclinit extends MethodVisitor
{
public MVclinit(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
}
}
private static class MVinit extends MethodVisitor
{
public MVinit(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
}
@Override
public void visitInsn(int opcode) {
if (opcode == RETURN) {
mv.visitVarInsn(ALOAD, 0);
mv.visitIntInsn(BIPUSH, 16);
mv.visitIntInsn(NEWARRAY, T_FLOAT);
mv.visitFieldInsn(PUTFIELD, SMCNames.Tessellator_, "vertexPos", "[F");
}
mv.visitInsn(opcode);
}
}*/
private static class MVclinit extends MethodVisitor {
public MVclinit(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
}
@Override
public void visitFieldInsn(int opcode, String owner, String name, String desc) {
// SMCLog.finest(" F %d %s.%s %s", opcode, ownerM, nameM, descM);
if (opcode == PUTSTATIC
&& (Names.tessellator_byteBuffer.equals(owner, name)
|| Names.tessellator_intBuffer.equals(owner, name)
|| Names.tessellator_floatBuffer.equals(owner, name)
|| Names.tessellator_shortBuffer.equals(owner, name)
|| Names.tessellator_vertexCount.equals(owner, name)
// nameM.equals(Names.Tessellator_useVBO)||
// nameM.equals(Names.Tessellator_vertexBuffers)
)) {
mv.visitInsn(POP);
return;
} else if (opcode == GETSTATIC
&& (Names.tessellator_byteBuffer.equals(owner, name)
// nameM.equals(Names.Tessellator_vertexBuffers)
)) {
mv.visitInsn(ACONST_NULL);
return;
// } else
// if (opcode==GETSTATIC && (
// nameM.equals(Names.Tessellator_useVBO)
// ))
// {
// mv.visitInsn(ICONST_0);
// return;
}
mv.visitFieldInsn(opcode, owner, name, desc);
}
@Override
public void visitMethodInsn(int opcode, String owner, String name, String desc) {
// SMCLog.finest(" M %d %s.%s %s", opcode, ownerM, nameM, descM);
if (Names.glAllocation_createDirectByteBuffer.equals(owner, name, desc)) {
mv.visitInsn(POP);
mv.visitInsn(ACONST_NULL);
return;
} else if (Names.glAllocation_createDirectIntBuffer.equals(owner, name, desc)) {
mv.visitInsn(POP);
mv.visitInsn(ACONST_NULL);
return;
} else if (Names.equals(
"java/nio/ByteBuffer", "asIntBuffer", "()Ljava/nio/IntBuffer;", owner, name, desc)) {
mv.visitInsn(POP);
mv.visitInsn(ACONST_NULL);
return;
} else if (Names.equals(
"java/nio/ByteBuffer", "asFloatBuffer", "()Ljava/nio/FloatBuffer;", owner, name, desc)) {
mv.visitInsn(POP);
mv.visitInsn(ACONST_NULL);
return;
} else if (Names.equals(
"java/nio/ByteBuffer", "asShortBuffer", "()Ljava/nio/ShortBuffer;", owner, name, desc)) {
mv.visitInsn(POP);
mv.visitInsn(ACONST_NULL);
return;
}
mv.visitMethodInsn(opcode, owner, name, desc);
}
}
private static class MVinit extends MethodVisitor {
public MVinit(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
}
@Override
public void visitMethodInsn(int opcode, String owner, String name, String desc) {
if (opcode == INVOKESPECIAL && Names.equals("java/lang/Object", "<init>", "()V", owner, name, desc)) {
mv.visitLdcInsn(new Integer(65536));
mv.visitMethodInsn(INVOKESPECIAL, Names.tessellator_.clas, "<init>", "(I)V");
return;
}
mv.visitMethodInsn(opcode, owner, name, desc);
}
}
private static class MVinitI extends MethodVisitor {
public MVinitI(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
}
@Override
public void visitInsn(int opcode) {
if (opcode == RETURN) {
if (inputHasStaticBuffer) {
mv.visitVarInsn(ALOAD, 0);
mv.visitVarInsn(ILOAD, 1);
mv.visitInsn(ICONST_4);
mv.visitInsn(IMUL);
mv.visitMethodInsn(
INVOKESTATIC,
Names.glAllocation_createDirectByteBuffer.clas,
Names.glAllocation_createDirectByteBuffer.name,
Names.glAllocation_createDirectByteBuffer.desc);
mv.visitFieldInsn(
PUTFIELD,
Names.tessellator_byteBuffer.clas,
Names.tessellator_byteBuffer.name,
Names.tessellator_byteBuffer.desc);
mv.visitVarInsn(ALOAD, 0);
mv.visitVarInsn(ALOAD, 0);
mv.visitFieldInsn(
GETFIELD,
Names.tessellator_byteBuffer.clas,
Names.tessellator_byteBuffer.name,
Names.tessellator_byteBuffer.desc);
mv.visitMethodInsn(INVOKEVIRTUAL, "java/nio/ByteBuffer", "asIntBuffer", "()Ljava/nio/IntBuffer;");
mv.visitFieldInsn(
PUTFIELD,
Names.tessellator_intBuffer.clas,
Names.tessellator_intBuffer.name,
Names.tessellator_intBuffer.desc);
mv.visitVarInsn(ALOAD, 0);
mv.visitVarInsn(ALOAD, 0);
mv.visitFieldInsn(
GETFIELD,
Names.tessellator_byteBuffer.clas,
Names.tessellator_byteBuffer.name,
Names.tessellator_byteBuffer.desc);
mv.visitMethodInsn(
INVOKEVIRTUAL, "java/nio/ByteBuffer", "asFloatBuffer", "()Ljava/nio/FloatBuffer;");
mv.visitFieldInsn(
PUTFIELD,
Names.tessellator_floatBuffer.clas,
Names.tessellator_floatBuffer.name,
Names.tessellator_floatBuffer.desc);
mv.visitVarInsn(ALOAD, 0);
mv.visitVarInsn(ALOAD, 0);
mv.visitFieldInsn(
GETFIELD,
Names.tessellator_byteBuffer.clas,
Names.tessellator_byteBuffer.name,
Names.tessellator_byteBuffer.desc);
mv.visitMethodInsn(
INVOKEVIRTUAL, "java/nio/ByteBuffer", "asShortBuffer", "()Ljava/nio/ShortBuffer;");
mv.visitFieldInsn(
PUTFIELD,
Names.tessellator_shortBuffer.clas,
Names.tessellator_shortBuffer.name,
Names.tessellator_shortBuffer.desc);
mv.visitVarInsn(ALOAD, 0);
mv.visitVarInsn(ILOAD, 1);
mv.visitIntInsn(NEWARRAY, T_INT);
mv.visitFieldInsn(
PUTFIELD,
Names.tessellator_rawBuffer.clas,
Names.tessellator_rawBuffer.name,
Names.tessellator_rawBuffer.desc);
mv.visitVarInsn(ALOAD, 0);
mv.visitInsn(ICONST_0);
mv.visitFieldInsn(
PUTFIELD,
Names.tessellator_vertexCount.clas,
Names.tessellator_vertexCount.name,
Names.tessellator_vertexCount.desc);
// mv.visitVarInsn(ALOAD, 0);
// mv.visitFieldInsn(GETSTATIC, Names.Tessellator_, Names.Tessellator_tryVBO, "Z");
// Label l28 = new Label();
// mv.visitJumpInsn(IFEQ, l28);
// mv.visitMethodInsn(INVOKESTATIC, "org/lwjgl/opengl/GLContext", "getCapabilities",
// "()Lorg/lwjgl/opengl/ContextCapabilities;");
// mv.visitFieldInsn(GETFIELD, "org/lwjgl/opengl/ContextCapabilities",
// "GL_ARB_vertex_buffer_object", "Z");
// mv.visitJumpInsn(IFEQ, l28);
// mv.visitInsn(ICONST_1);
// Label l29 = new Label();
// mv.visitJumpInsn(GOTO, l29);
// mv.visitLabel(l28);
// mv.visitFrame(Opcodes.F_FULL, 2, new Object[] {Names.Tessellator_, Opcodes.INTEGER}, 1, new
// Object[] {Names.Tessellator_});
// mv.visitInsn(ICONST_0);
// mv.visitLabel(l29);
// mv.visitFrame(Opcodes.F_FULL, 2, new Object[] {Names.Tessellator_, Opcodes.INTEGER}, 2, new
// Object[] {Names.Tessellator_, Opcodes.INTEGER});
// mv.visitFieldInsn(PUTFIELD, Names.Tessellator_, Names.Tessellator_useVBO, "Z");
// mv.visitVarInsn(ALOAD, 0);
// mv.visitFieldInsn(GETFIELD, Names.Tessellator_, Names.Tessellator_useVBO, "Z");
// Label l31 = new Label();
// mv.visitJumpInsn(IFEQ, l31);
// mv.visitVarInsn(ALOAD, 0);
// mv.visitVarInsn(ALOAD, 0);
// mv.visitFieldInsn(GETFIELD, Names.Tessellator_, Names.Tessellator_vboCount, "I");
// mv.visitMethodInsn(INVOKESTATIC, Names.GLAllocation_, Names.GLAllocation_createDirectIntBuffer,
// Names.GLAllocation_createDirectIntBuffer_desc);
// mv.visitFieldInsn(PUTFIELD, Names.Tessellator_, Names.Tessellator_vertexBuffers,
// "Ljava/nio/IntBuffer;");
// mv.visitVarInsn(ALOAD, 0);
// mv.visitFieldInsn(GETFIELD, Names.Tessellator_, Names.Tessellator_vertexBuffers,
// "Ljava/nio/IntBuffer;");
// mv.visitMethodInsn(INVOKESTATIC, "org/lwjgl/opengl/ARBVertexBufferObject", "glGenBuffersARB",
// "(Ljava/nio/IntBuffer;)V");
// mv.visitLabel(l31);
// mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null);
}
mv.visitVarInsn(ALOAD, 0);
mv.visitIntInsn(BIPUSH, 16);
mv.visitIntInsn(NEWARRAY, T_FLOAT);
mv.visitFieldInsn(PUTFIELD, Names.tessellator_.clas, "vertexPos", "[F");
}
mv.visitInsn(opcode);
}
}
private static class MVdraw extends MethodVisitor {
public MVdraw(MethodVisitor mv) {
super(Opcodes.ASM4, null);
mv.visitCode();
Label l0 = new Label();
mv.visitLabel(l0);
mv.visitLineNumber(185, l0);
mv.visitVarInsn(ALOAD, 0);
mv.visitMethodInsn(
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/ShadersTess",
"draw",
"(" + Names.tessellator_.desc + ")I");
mv.visitInsn(IRETURN);
Label l1 = new Label();
mv.visitLabel(l1);
mv.visitLocalVariable("this", Names.tessellator_.desc, null, l0, l1, 0);
mv.visitMaxs(1, 1);
mv.visitEnd();
}
}
private static class MVreset extends MethodVisitor {
public MVreset(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
}
@Override
public void visitFieldInsn(int opcode, String owner, String name, String desc) {
// SMCLog.finest(" F %d %s.%s %s", opcode, ownerM, nameM, descM);
if (opcode == GETSTATIC && Names.tessellator_byteBuffer.equals(owner, name)) {
mv.visitVarInsn(ALOAD, 0);
mv.visitFieldInsn(GETFIELD, owner, name, desc);
return;
}
mv.visitFieldInsn(opcode, owner, name, desc);
}
}
private static class MVaddVertex extends MethodVisitor {
public MVaddVertex(MethodVisitor mv) {
super(Opcodes.ASM4, null);
mv.visitCode();
Label l0 = new Label();
mv.visitLabel(l0);
mv.visitLineNumber(466, l0);
mv.visitVarInsn(ALOAD, 0);
mv.visitVarInsn(DLOAD, 1);
mv.visitVarInsn(DLOAD, 3);
mv.visitVarInsn(DLOAD, 5);
mv.visitMethodInsn(
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/ShadersTess",
"addVertex",
"(" + Names.tessellator_.desc + "DDD)V");
Label l1 = new Label();
mv.visitLabel(l1);
mv.visitLineNumber(467, l1);
mv.visitInsn(RETURN);
Label l2 = new Label();
mv.visitLabel(l2);
mv.visitLocalVariable("this", Names.tessellator_.desc, null, l0, l2, 0);
mv.visitLocalVariable("par1", "D", null, l0, l2, 1);
mv.visitLocalVariable("par3", "D", null, l0, l2, 3);
mv.visitLocalVariable("par5", "D", null, l0, l2, 5);
mv.visitMaxs(7, 7);
mv.visitEnd();
}
}
private static class MVsetNormal extends MethodVisitor {
public MVsetNormal(MethodVisitor mv) {
super(Opcodes.ASM4, null);
mv.visitCode();
Label l0 = new Label();
mv.visitLabel(l0);
mv.visitVarInsn(ALOAD, 0);
mv.visitInsn(ICONST_1);
mv.visitFieldInsn(
PUTFIELD,
Names.tessellator_hasNormals.clas,
Names.tessellator_hasNormals.name,
Names.tessellator_hasNormals.desc);
mv.visitVarInsn(ALOAD, 0);
mv.visitVarInsn(FLOAD, 1);
mv.visitFieldInsn(PUTFIELD, Names.tessellator_.clas, "normalX", "F");
mv.visitVarInsn(ALOAD, 0);
mv.visitVarInsn(FLOAD, 2);
mv.visitFieldInsn(PUTFIELD, Names.tessellator_.clas, "normalY", "F");
mv.visitVarInsn(ALOAD, 0);
mv.visitVarInsn(FLOAD, 3);
mv.visitFieldInsn(PUTFIELD, Names.tessellator_.clas, "normalZ", "F");
mv.visitInsn(RETURN);
Label l5 = new Label();
mv.visitLabel(l5);
mv.visitLocalVariable("this", Names.tessellator_.desc, null, l0, l5, 0);
mv.visitLocalVariable("par1", "F", null, l0, l5, 1);
mv.visitLocalVariable("par2", "F", null, l0, l5, 2);
mv.visitLocalVariable("par3", "F", null, l0, l5, 3);
mv.visitMaxs(2, 4);
mv.visitEnd();
}
}
private static class MVsortQuad extends MethodVisitor {
public MVsortQuad(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
}
@Override
public void visitIntInsn(int opcode, int operand) {
if (opcode == BIPUSH && operand == 32) {
operand = 64;
}
super.visitIntInsn(opcode, operand);
}
}
}
@@ -3,6 +3,7 @@ package com.gtnewhorizons.angelica.transform;
import static org.objectweb.asm.Opcodes.*;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
@@ -24,6 +25,7 @@ public class ACTTextureAbstract implements IClassTransformer {
}
private static class CVTransform extends ClassVisitor {
String classname;
boolean endFields = false;
@@ -32,10 +34,10 @@ public class ACTTextureAbstract implements IClassTransformer {
}
@Override
public void visit(
int version, int access, String name, String signature, String superName, String[] interfaces) {
public void visit(int version, int access, String name, String signature, String superName,
String[] interfaces) {
classname = name;
// SMCLog.info(" class %s",name);
// ALog.info(" class %s",name);
cv.visit(version, access, name, signature, superName, interfaces);
}
@@ -56,17 +58,21 @@ public class ACTTextureAbstract implements IClassTransformer {
FieldVisitor fv;
// multiTex
fv = cv.visitField(
ACC_PUBLIC, "multiTex", "Lcom/gtnewhorizons/angelica/client/MultiTexID;", null, null);
ACC_PUBLIC,
"multiTex",
"Lcom/gtnewhorizons/angelica/client/MultiTexID;",
null,
null);
fv.visitEnd();
}
// SMCLog.info(" method %s.%s%s = %s",classname,name,desc,remappedName);
// ALog.info(" method %s.%s%s = %s",classname,name,desc,remappedName);
if (Names.abstractTexture_deleteGlTexture.equalsNameDesc(name, desc)) {
// SMCLog.finer(" patching method %s.%s%s = %s%s",classname,name,desc,nameM,descM);
// ALog.finer(" patching method %s.%s%s = %s%s",classname,name,desc,nameM,descM);
return new MVdeleteGlTexture(cv.visitMethod(access, name, desc, signature, exceptions));
} else if (name.equals("getMultiTexID")
&& desc.equals("()Lcom/gtnewhorizons/angelica/client/MultiTexID;")) {
return null;
}
} else
if (name.equals("getMultiTexID") && desc.equals("()Lcom/gtnewhorizons/angelica/client/MultiTexID;")) {
return null;
}
return cv.visitMethod(access, name, desc, signature, exceptions);
}
@@ -75,7 +81,11 @@ public class ACTTextureAbstract implements IClassTransformer {
MethodVisitor mv;
// getMultiTexID
mv = cv.visitMethod(
ACC_PUBLIC, "getMultiTexID", "()Lcom/gtnewhorizons/angelica/client/MultiTexID;", null, null);
ACC_PUBLIC,
"getMultiTexID",
"()Lcom/gtnewhorizons/angelica/client/MultiTexID;",
null,
null);
mv.visitCode();
mv.visitVarInsn(ALOAD, 0);
mv.visitMethodInsn(
@@ -92,6 +102,7 @@ public class ACTTextureAbstract implements IClassTransformer {
}
private static class MVdeleteGlTexture extends MethodVisitor {
public MVdeleteGlTexture(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
}
@@ -3,6 +3,7 @@ package com.gtnewhorizons.angelica.transform;
import static org.objectweb.asm.Opcodes.*;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
@@ -25,6 +26,7 @@ public class ACTTextureAtlasSprite implements IClassTransformer {
}
private static class CVTransform extends ClassVisitor {
String classname;
public CVTransform(ClassVisitor cv) {
@@ -32,8 +34,8 @@ public class ACTTextureAtlasSprite implements IClassTransformer {
}
@Override
public void visit(
int version, int access, String name, String signature, String superName, String[] interfaces) {
public void visit(int version, int access, String name, String signature, String superName,
String[] interfaces) {
classname = name;
cv.visit(version, access, name, signature, superName, interfaces);
}
@@ -47,28 +49,30 @@ public class ACTTextureAtlasSprite implements IClassTransformer {
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
// SMCLog.info(" method %s.%s%s = %s",classname,name,desc,remappedName);
// ALog.info(" method %s.%s%s = %s",classname,name,desc,remappedName);
access = access & ~(ACC_PRIVATE | ACC_PROTECTED) | ACC_PUBLIC;
if (Names.textureAtlasSpri_updateAnimation.equalsNameDesc(name, desc)) {
// SMCLog.finer(" patching method %s.%s%s = %s",classname,name,desc,nameM);
// ALog.finer(" patching method %s.%s%s = %s",classname,name,desc,nameM);
return new MVanimation(cv.visitMethod(access, name, desc, signature, exceptions));
} else if (name.equals("load")
&& desc.equals("(" + Names.iResourceManager_.desc + Names.resourceLocation_.desc + ")Z")) {
// SMCLog.finer(" patching method %s.%s%s = %s",classname,name,desc,nameM);
return new MVload(cv.visitMethod(access, name, desc, signature, exceptions));
} else if (Names.textureAtlasSpri_loadSprite.equalsNameDesc(name, desc)) {
// SMCLog.finer(" patching method %s.%s%s = %s",classname,name,desc,nameM);
return new MVloadSprite(cv.visitMethod(access, name, desc, signature, exceptions));
} else if (name.equals("uploadFrameTexture") && desc.equals("(III)V")) {
// SMCLog.finer(" patching method %s.%s%s = %s",classname,name,desc,nameM);
return new MVuploadFrameTexture(cv.visitMethod(access, name, desc, signature, exceptions));
}
// ALog.finer(" patching method %s.%s%s = %s",classname,name,desc,nameM);
return new MVload(cv.visitMethod(access, name, desc, signature, exceptions));
} else
if (Names.textureAtlasSpri_loadSprite.equalsNameDesc(name, desc)) {
// ALog.finer(" patching method %s.%s%s = %s",classname,name,desc,nameM);
return new MVloadSprite(cv.visitMethod(access, name, desc, signature, exceptions));
} else if (name.equals("uploadFrameTexture") && desc.equals("(III)V")) {
// ALog.finer(" patching method %s.%s%s = %s",classname,name,desc,nameM);
return new MVuploadFrameTexture(cv.visitMethod(access, name, desc, signature, exceptions));
}
return cv.visitMethod(access, name, desc, signature, exceptions);
}
}
// also used by clock and compass
protected static class MVanimation extends MethodVisitor {
// protected MethodVisitor mv;
public MVanimation(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
@@ -79,7 +83,10 @@ public class ACTTextureAtlasSprite implements IClassTransformer {
public void visitMethodInsn(int opcode, String owner, String name, String desc) {
if (Names.textureUtil_uploadTexSub.equals(owner, name, desc)) {
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/ShadersTex", "uploadTexSub", "([[IIIIIZZ)V");
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/ShadersTex",
"uploadTexSub",
"([[IIIIIZZ)V");
return;
}
mv.visitMethodInsn(opcode, owner, name, desc);
@@ -87,6 +94,7 @@ public class ACTTextureAtlasSprite implements IClassTransformer {
}
private static class MVload extends MethodVisitor {
// protected MethodVisitor mv;
public MVload(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
@@ -100,7 +108,9 @@ public class ACTTextureAtlasSprite implements IClassTransformer {
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/ShadersTex",
"loadResource",
"(" + Names.iResourceManager_.desc + Names.resourceLocation_.desc + ")"
"(" + Names.iResourceManager_.desc
+ Names.resourceLocation_.desc
+ ")"
+ Names.iResource_.desc);
return;
}
@@ -109,6 +119,7 @@ public class ACTTextureAtlasSprite implements IClassTransformer {
}
private static class MVloadSprite extends MethodVisitor {
// protected MethodVisitor mv;
public MVloadSprite(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
@@ -135,7 +146,10 @@ public class ACTTextureAtlasSprite implements IClassTransformer {
return;
} else if (Names.textureAtlasSpri_getFrameTextureData.equals(owner, name, desc)) {
mv.visitMethodInsn(
INVOKESTATIC, "com/gtnewhorizons/angelica/client/ShadersTex", "extractFrame", "([IIII)[I");
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/ShadersTex",
"extractFrame",
"([IIII)[I");
return;
} else if (Names.equals(Names.textureAtlasSpri_.clas, "fixTransparentColor", "([I)V", owner, name, desc)) {
mv.visitMethodInsn(
@@ -150,6 +164,7 @@ public class ACTTextureAtlasSprite implements IClassTransformer {
}
private static class MVuploadFrameTexture extends MethodVisitor {
public MVuploadFrameTexture(MethodVisitor mv) {
super(Opcodes.ASM4, null);
mv.visitCode();
@@ -1,47 +0,0 @@
package com.gtnewhorizons.angelica.transform;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
public class ACTTextureClock implements IClassTransformer {
@Override
public byte[] transform(String par1, String par2, byte[] par3) {
ALog.fine("transforming %s %s", par1, par2);
ClassReader cr = new ClassReader(par3);
ClassWriter cw = new ClassWriter(cr, ClassWriter.COMPUTE_MAXS);
CVTransform cv = new CVTransform(cw);
cr.accept(cv, 0);
return cw.toByteArray();
}
private static class CVTransform extends ClassVisitor {
String classname;
public CVTransform(ClassVisitor cv) {
super(Opcodes.ASM4, cv);
}
@Override
public void visit(
int version, int access, String name, String signature, String superName, String[] interfaces) {
classname = name;
// SMCLog.info(" class %s",name);
cv.visit(version, access, name, signature, superName, interfaces);
}
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
// SMCLog.info(" method %s.%s%s = %s",classname,name,desc,remappedName);
if (Names.textureAtlasSpri_updateAnimation.equalsNameDesc(name, desc)) {
// SMCLog.finer(" patching method %s.%s%s = %s",classname,name,desc,nameM);
return new ACTTextureAtlasSprite.MVanimation(cv.visitMethod(access, name, desc, signature, exceptions));
}
return cv.visitMethod(access, name, desc, signature, exceptions);
}
}
}
@@ -1,47 +0,0 @@
package com.gtnewhorizons.angelica.transform;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
public class ACTTextureCompass implements IClassTransformer {
@Override
public byte[] transform(String par1, String par2, byte[] par3) {
ALog.fine("transforming %s %s", par1, par2);
ClassReader cr = new ClassReader(par3);
ClassWriter cw = new ClassWriter(cr, ClassWriter.COMPUTE_MAXS);
CVTransform cv = new CVTransform(cw);
cr.accept(cv, 0);
return cw.toByteArray();
}
private static class CVTransform extends ClassVisitor {
String classname;
public CVTransform(ClassVisitor cv) {
super(Opcodes.ASM4, cv);
}
@Override
public void visit(
int version, int access, String name, String signature, String superName, String[] interfaces) {
classname = name;
// SMCLog.info(" class %s",name);
cv.visit(version, access, name, signature, superName, interfaces);
}
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
// SMCLog.info(" method %s.%s%s = %s",classname,name,desc,remappedName);
if (Names.textureCompass_updateCompass.equalsNameDesc(name, desc)) {
// SMCLog.finer(" patching method %s.%s%s = %s",classname,name,desc,nameM);
return new ACTTextureAtlasSprite.MVanimation(cv.visitMethod(access, name, desc, signature, exceptions));
}
return cv.visitMethod(access, name, desc, signature, exceptions);
}
}
}
@@ -3,6 +3,7 @@ package com.gtnewhorizons.angelica.transform;
import static org.objectweb.asm.Opcodes.*;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
@@ -24,6 +25,7 @@ public class ACTTextureDownload implements IClassTransformer {
}
private static class CVTransform extends ClassVisitor {
String classname;
public CVTransform(ClassVisitor cv) {
@@ -31,23 +33,23 @@ public class ACTTextureDownload implements IClassTransformer {
}
@Override
public void visit(
int version, int access, String name, String signature, String superName, String[] interfaces) {
public void visit(int version, int access, String name, String signature, String superName,
String[] interfaces) {
classname = name;
// SMCLog.info(" class %s",name);
// ALog.info(" class %s",name);
cv.visit(version, access, name, signature, superName, interfaces);
}
@Override
public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) {
// SMCLog.finest(" field %s %s %s %d", classname, name, desc, access);
// ALog.finest(" field %s %s %s %d", classname, name, desc, access);
return super.visitField(access, name, desc, signature, value);
}
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
// String nameM = SMCRemap.remapper.mapMethodName(classname, name, desc);
// SMCLog.info(" method %s.%s%s = %s",classname,name,desc,remappedName);
// ALog.info(" method %s.%s%s = %s",classname,name,desc,remappedName);
if (name.equals("getMultiTexID")) {
return null;
}
@@ -59,7 +61,11 @@ public class ACTTextureDownload implements IClassTransformer {
MethodVisitor mv;
// getMultiTexID
mv = cv.visitMethod(
ACC_PUBLIC, "getMultiTexID", "()Lcom/gtnewhorizons/angelica/client/MultiTexID;", null, null);
ACC_PUBLIC,
"getMultiTexID",
"()Lcom/gtnewhorizons/angelica/client/MultiTexID;",
null,
null);
mv.visitCode();
Label l0 = new Label();
mv.visitLabel(l0);
@@ -3,6 +3,7 @@ package com.gtnewhorizons.angelica.transform;
import static org.objectweb.asm.Opcodes.*;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
@@ -22,6 +23,7 @@ public class ACTTextureDynamic implements IClassTransformer {
}
private static class CVTransform extends ClassVisitor {
String classname;
public CVTransform(ClassVisitor cv) {
@@ -29,21 +31,21 @@ public class ACTTextureDynamic implements IClassTransformer {
}
@Override
public void visit(
int version, int access, String name, String signature, String superName, String[] interfaces) {
public void visit(int version, int access, String name, String signature, String superName,
String[] interfaces) {
classname = name;
// SMCLog.info(" class %s",name);
// ALog.info(" class %s",name);
cv.visit(version, access, name, signature, superName, interfaces);
}
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
// SMCLog.info(" method %s.%s%s = %s",classname,name,desc,remappedName);
// ALog.info(" method %s.%s%s = %s",classname,name,desc,remappedName);
if (name.equals("<init>") && desc.equals("(II)V")) {
// SMCLog.finer(" patching method %s.%s%s = %s",classname,name,desc,nameM);
// ALog.finer(" patching method %s.%s%s = %s",classname,name,desc,nameM);
return new MVinit(cv.visitMethod(access, name, desc, signature, exceptions));
} else if (Names.dynamicTexture_updateDynamicTexture.equalsNameDesc(name, desc)) {
// SMCLog.finer(" patching method %s.%s%s = %s",classname,name,desc,nameM);
// ALog.finer(" patching method %s.%s%s = %s",classname,name,desc,nameM);
return new MVupdate(cv.visitMethod(access, name, desc, signature, exceptions));
}
return cv.visitMethod(access, name, desc, signature, exceptions);
@@ -51,6 +53,7 @@ public class ACTTextureDynamic implements IClassTransformer {
}
private static class MVinit extends MethodVisitor {
// protected MethodVisitor mv;
public MVinit(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
@@ -82,6 +85,7 @@ public class ACTTextureDynamic implements IClassTransformer {
}
private static class MVupdate extends MethodVisitor {
// protected MethodVisitor mv;
public MVupdate(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
@@ -3,6 +3,7 @@ package com.gtnewhorizons.angelica.transform;
import static org.objectweb.asm.Opcodes.*;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
@@ -23,6 +24,7 @@ public class ACTTextureLayered implements IClassTransformer {
}
private static class CVTransform extends ClassVisitor {
String classname;
public CVTransform(ClassVisitor cv) {
@@ -30,19 +32,19 @@ public class ACTTextureLayered implements IClassTransformer {
}
@Override
public void visit(
int version, int access, String name, String signature, String superName, String[] interfaces) {
public void visit(int version, int access, String name, String signature, String superName,
String[] interfaces) {
classname = name;
// SMCLog.info(" class %s",name);
// ALog.info(" class %s",name);
cv.visit(version, access, name, signature, superName, interfaces);
}
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
// String descM = SMCNames.remapper.mapMethodDesc(desc);
// SMCLog.info(" method %s.%s%s = %s",classname,name,desc,remappedName);
// ALog.info(" method %s.%s%s = %s",classname,name,desc,remappedName);
if (Names.iTextureObject_loadTexture.equalsNameDesc(name, desc)) {
// SMCLog.finer(" patching method %s.%s%s = %s",classname,name,desc,nameM);
// ALog.finer(" patching method %s.%s%s = %s",classname,name,desc,nameM);
return new MVloadTexture(cv.visitMethod(access, name, desc, signature, exceptions));
}
return cv.visitMethod(access, name, desc, signature, exceptions);
@@ -50,6 +52,7 @@ public class ACTTextureLayered implements IClassTransformer {
}
private static class MVloadTexture extends MethodVisitor {
// protected MethodVisitor mv;
public MVloadTexture(MethodVisitor mv) {
super(Opcodes.ASM4);
@@ -3,6 +3,7 @@ package com.gtnewhorizons.angelica.transform;
import static org.objectweb.asm.Opcodes.*;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
@@ -22,6 +23,7 @@ public class ACTTextureManager implements IClassTransformer {
}
private static class CVTransform extends ClassVisitor {
String classname;
public CVTransform(ClassVisitor cv) {
@@ -29,21 +31,21 @@ public class ACTTextureManager implements IClassTransformer {
}
@Override
public void visit(
int version, int access, String name, String signature, String superName, String[] interfaces) {
public void visit(int version, int access, String name, String signature, String superName,
String[] interfaces) {
classname = name;
// SMCLog.info(" class %s",name);
// ALog.info(" class %s",name);
cv.visit(version, access, name, signature, superName, interfaces);
}
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
// SMCLog.info(" method %s.%s%s = %s%s",classname,name,desc,nameM,descM);
// ALog.info(" method %s.%s%s = %s%s",classname,name,desc,nameM,descM);
if (Names.textureManager_bindTexture.equalsNameDesc(name, desc)) {
// SMCLog.finer(" patching method %s.%s%s = %s%s",classname,name,desc,nameM,descM);
// ALog.finer(" patching method %s.%s%s = %s%s",classname,name,desc,nameM,descM);
return new MVbindTexture(cv.visitMethod(access, name, desc, signature, exceptions));
} else if (Names.textureManager_onResourceManagerReload.equalsNameDesc(name, desc)) {
// SMCLog.finer(" patching method %s.%s%s = %s%s",classname,name,desc,nameM,descM);
// ALog.finer(" patching method %s.%s%s = %s%s",classname,name,desc,nameM,descM);
return new MVonReload(cv.visitMethod(access, name, desc, signature, exceptions));
}
return cv.visitMethod(access, name, desc, signature, exceptions);
@@ -51,6 +53,7 @@ public class ACTTextureManager implements IClassTransformer {
}
private static class MVbindTexture extends MethodVisitor {
public MVbindTexture(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
}
@@ -72,6 +75,7 @@ public class ACTTextureManager implements IClassTransformer {
}
private static class MVonReload extends MethodVisitor {
public MVonReload(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
}
@@ -3,6 +3,7 @@ package com.gtnewhorizons.angelica.transform;
import static org.objectweb.asm.Opcodes.*;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
@@ -23,6 +24,7 @@ public class ACTTextureMap implements IClassTransformer {
}
private static class CVTransform extends ClassVisitor {
String classname;
boolean endFields = false;
@@ -31,10 +33,10 @@ public class ACTTextureMap implements IClassTransformer {
}
@Override
public void visit(
int version, int access, String name, String signature, String superName, String[] interfaces) {
public void visit(int version, int access, String name, String signature, String superName,
String[] interfaces) {
classname = name;
// SMCLog.info(" class %s",name);
// ALog.info(" class %s",name);
cv.visit(version, access, name, signature, superName, interfaces);
}
@@ -60,14 +62,14 @@ public class ACTTextureMap implements IClassTransformer {
fv = cv.visitField(ACC_PUBLIC, "atlasHeight", "I", null, null);
fv.visitEnd();
}
// SMCLog.info(" method %s.%s%s = %s",classname,name,desc,remappedName);
// ALog.info(" method %s.%s%s = %s",classname,name,desc,remappedName);
if (Names.textureMap_getIconResLoc.equalsNameDesc(name, desc)) {
access = access & (~ACC_PRIVATE & ~ACC_PROTECTED) | ACC_PUBLIC;
} else if (Names.textureMap_loadTextureAtlas.equalsNameDesc(name, desc)) {
// SMCLog.finer(" patching method %s.%s%s = %s",classname,name,desc,nameM);
// ALog.finer(" patching method %s.%s%s = %s",classname,name,desc,nameM);
return new MVloadAtlas(cv.visitMethod(access, name, desc, signature, exceptions));
} else if (Names.textureMap_updateAnimations.equalsNameDesc(name, desc)) {
// SMCLog.finer(" patching method %s.%s%s = %s",classname,name,desc,nameM);
// ALog.finer(" patching method %s.%s%s = %s",classname,name,desc,nameM);
return new MVanimation(cv.visitMethod(access, name, desc, signature, exceptions));
}
return cv.visitMethod(access, name, desc, signature, exceptions);
@@ -75,6 +77,7 @@ public class ACTTextureMap implements IClassTransformer {
}
private static class MVloadAtlas extends MethodVisitor {
// protected MethodVisitor mv;
public MVloadAtlas(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
@@ -107,59 +110,63 @@ public class ACTTextureMap implements IClassTransformer {
@Override
public void visitMethodInsn(int opcode, String owner, String name, String desc) {
// SMCLog.finest(" %s.%s%s",ownerM,nameM,descM);
// ALog.finest(" %s.%s%s",ownerM,nameM,descM);
if (Names.iResourceManager_getResource.equals(owner, name, desc)) {
ALog.finest(" %s", "loadRes");
mv.visitMethodInsn(
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/ShadersTex",
"loadResource",
"(" + Names.iResourceManager_.desc + Names.resourceLocation_.desc + ")"
"(" + Names.iResourceManager_.desc
+ Names.resourceLocation_.desc
+ ")"
+ Names.iResource_.desc);
return;
} else if (opcode == INVOKESPECIAL
&& Names.equals(Names.stitcher_.clas, "<init>", "(IIZII)V", owner, name, desc)) {
isStitcher = true;
} else if (Names.textureUtil_allocateTextureMipmapAniso.equals(owner, name, desc)) {
ALog.finest(" %s", "allocateTextureMap");
mv.visitVarInsn(ALOAD, varStitcher);
mv.visitVarInsn(ALOAD, 0);
mv.visitMethodInsn(
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/ShadersTex",
"allocateTextureMap",
"(IIIIF" + Names.stitcher_.desc + Names.textureMap_.desc + ")V");
state = 1;
return;
} else if (state == 1 && Names.textureAtlasSpri_getIconName.equals(owner, name, desc)) {
ALog.finest(" %s", "setSprite setIconName");
mv.visitMethodInsn(
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/ShadersTex",
"setSprite",
"(" + Names.textureAtlasSpri_.desc + ")" + Names.textureAtlasSpri_.desc);
mv.visitMethodInsn(opcode, owner, name, desc);
mv.visitMethodInsn(
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/ShadersTex",
"setIconName",
"(Ljava/lang/String;)Ljava/lang/String;");
state = 0;
return;
} else if (Names.textureUtil_uploadTexSub.equals(owner, name, desc)) {
ALog.finest(" %s", "uploadTexSubForLoadAtlas");
mv.visitMethodInsn(
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/ShadersTex",
"uploadTexSubForLoadAtlas",
"([[IIIIIZZ)V");
return;
}
isStitcher = true;
} else
if (Names.textureUtil_allocateTextureMipmapAniso.equals(owner, name, desc)) {
ALog.finest(" %s", "allocateTextureMap");
mv.visitVarInsn(ALOAD, varStitcher);
mv.visitVarInsn(ALOAD, 0);
mv.visitMethodInsn(
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/ShadersTex",
"allocateTextureMap",
"(IIIIF" + Names.stitcher_.desc + Names.textureMap_.desc + ")V");
state = 1;
return;
} else if (state == 1 && Names.textureAtlasSpri_getIconName.equals(owner, name, desc)) {
ALog.finest(" %s", "setSprite setIconName");
mv.visitMethodInsn(
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/ShadersTex",
"setSprite",
"(" + Names.textureAtlasSpri_.desc + ")" + Names.textureAtlasSpri_.desc);
mv.visitMethodInsn(opcode, owner, name, desc);
mv.visitMethodInsn(
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/ShadersTex",
"setIconName",
"(Ljava/lang/String;)Ljava/lang/String;");
state = 0;
return;
} else if (Names.textureUtil_uploadTexSub.equals(owner, name, desc)) {
ALog.finest(" %s", "uploadTexSubForLoadAtlas");
mv.visitMethodInsn(
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/ShadersTex",
"uploadTexSubForLoadAtlas",
"([[IIIIIZZ)V");
return;
}
mv.visitMethodInsn(opcode, owner, name, desc);
}
}
private static class MVanimation extends MethodVisitor {
public MVanimation(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
}
@@ -3,6 +3,7 @@ package com.gtnewhorizons.angelica.transform;
import static org.objectweb.asm.Opcodes.*;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
@@ -22,6 +23,7 @@ public class ACTTextureObject implements IClassTransformer {
}
private static class CVTransform extends ClassVisitor {
String classname;
public CVTransform(ClassVisitor cv) {
@@ -29,16 +31,16 @@ public class ACTTextureObject implements IClassTransformer {
}
@Override
public void visit(
int version, int access, String name, String signature, String superName, String[] interfaces) {
public void visit(int version, int access, String name, String signature, String superName,
String[] interfaces) {
classname = name;
// SMCLog.info(" class %s",name);
// ALog.info(" class %s",name);
cv.visit(version, access, name, signature, superName, interfaces);
}
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
// SMCLog.info(" method %s.%s%s = %s",classname,name,desc,remappedName);
// ALog.info(" method %s.%s%s = %s",classname,name,desc,remappedName);
if (name.equals("getMultiTexID") && desc.equals("()Lcom/gtnewhorizons/angelica/client/MultiTexID;")) {
return null;
}
@@ -1,86 +0,0 @@
package com.gtnewhorizons.angelica.transform;
import static org.objectweb.asm.Opcodes.*;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
public class ACTTextureSimple implements IClassTransformer {
private static final int logDetail = 0;
@Override
public byte[] transform(String par1, String par2, byte[] par3) {
ALog.fine("transforming %s %s", par1, par2);
ClassReader cr = new ClassReader(par3);
ClassWriter cw = new ClassWriter(cr, ClassWriter.COMPUTE_MAXS);
CVTransform cv = new CVTransform(cw);
cr.accept(cv, 0);
return cw.toByteArray();
}
private static class CVTransform extends ClassVisitor {
String classname;
public CVTransform(ClassVisitor cv) {
super(Opcodes.ASM4, cv);
}
@Override
public void visit(
int version, int access, String name, String signature, String superName, String[] interfaces) {
classname = name;
// SMCLog.info(" class %s",name);
cv.visit(version, access, name, signature, superName, interfaces);
}
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
// SMCLog.info(" method %s.%s%s = %s%s",classname,name,desc,nameM,descM);
if (Names.iTextureObject_loadTexture.equalsNameDesc(name, desc)) {
// SMCLog.finer(" patching method %s.%s%s = %s%s",classname,name,desc,nameM,descM);
return new MVloadTexture(cv.visitMethod(access, name, desc, signature, exceptions));
}
return cv.visitMethod(access, name, desc, signature, exceptions);
}
}
private static class MVloadTexture extends MethodVisitor {
public MVloadTexture(MethodVisitor mv) {
super(Opcodes.ASM4, mv);
}
@Override
public void visitMethodInsn(int opcode, String owner, String name, String desc) {
if (Names.textureUtil_uploadTextureImageAllocate.equals(owner, name, desc)) {
// mv.visitMethodInsn(opcode, owner, name, desc);
mv.visitVarInsn(ALOAD, 1);
mv.visitVarInsn(ALOAD, 0);
mv.visitFieldInsn(
GETFIELD,
Names.simpleTexture_textureLocation.clas,
Names.simpleTexture_textureLocation.name,
Names.simpleTexture_textureLocation.desc);
mv.visitVarInsn(ALOAD, 0);
mv.visitMethodInsn(
INVOKEVIRTUAL,
Names.simpleTexture_.clas,
"getMultiTexID",
"()Lcom/gtnewhorizons/angelica/client/MultiTexID;");
mv.visitMethodInsn(
INVOKESTATIC,
"com/gtnewhorizons/angelica/client/ShadersTex",
"loadSimpleTexture",
"(ILjava/awt/image/BufferedImage;ZZ" + Names.iResourceManager_.desc
+ Names.resourceLocation_.desc + "Lcom/gtnewhorizons/angelica/client/MultiTexID;)I");
ALog.finer(" loadSimpleTexture");
return;
}
mv.visitMethodInsn(opcode, owner, name, desc);
}
}
}
@@ -2,8 +2,13 @@ package com.gtnewhorizons.angelica.transform;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.tree.ClassNode;
public class AClassTransformer implements IClassTransformer {
Names names;
@@ -19,17 +24,7 @@ public class AClassTransformer implements IClassTransformer {
names = new Names();
InitNames.init();
ctMap = new HashMap();
put(Names.block_, new ACTBlock());
put(Names.itemBlock_, new ACTItemBlock());
put(Names.minecraft_, new ACTMinecraft());
put(Names.guiOptions_, new ACTGuiOptions());
put(Names.modelRenderer_, new ACTModelRenderer());
put(Names.openGlHelper_, new ACTOpenGlHelper());
put(Names.tessellator_, new ACTTessellator());
put(Names.renderBlocks_, new ACTRenderBlocks());
put(Names.renderGlobal_, new ACTRenderGlobal());
put(Names.entityRenderer_, new ACTEntityRenderer());
put(Names.render_, new ACTRender());
put(Names.renderManager_, new ACTRenderManager());
put(Names.rendererLivingE_, new ACTRendererLivingEntity());
put(Names.renderDragon_, new ACTRenderSpider());
@@ -39,13 +34,10 @@ public class AClassTransformer implements IClassTransformer {
put(Names.textureDownload_, new ACTTextureDownload());
put(Names.abstractTexture_, new ACTTextureAbstract());
put(Names.iTextureObject_, new ACTTextureObject());
put(Names.simpleTexture_, new ACTTextureSimple());
put(Names.layeredTexture_, new ACTTextureLayered());
put(Names.dynamicTexture_, new ACTTextureDynamic());
put(Names.textureMap_, new ACTTextureMap());
put(Names.textureAtlasSpri_, new ACTTextureAtlasSprite());
put(Names.textureClock_, new ACTTextureClock());
put(Names.textureCompass_, new ACTTextureCompass());
put(Names.textureManager_, new ACTTextureManager());
ctMap.put("mrtjp.projectred.illumination.RenderHalo$", new ACTPrjRedIlluRenderHalo());
ctMap.put("net.smart.render.ModelRotationRenderer", new ACTSmartMoveModelRotationRenderer());
@@ -54,10 +46,18 @@ public class AClassTransformer implements IClassTransformer {
@Override
public byte[] transform(String par1, String par2, byte[] par3) {
byte[] bytecode = par3;
// if (par2.startsWith("mrtjp")) SMCLog.info("**** [%s]", par2);
// if (par2.startsWith("mrtjp")) ALog.info("**** [%s]", par2);
IClassTransformer ct = ctMap.get(par2);
if (ct != null) {
bytecode = ct.transform(par1, par2, bytecode);
// HACK: Fix stackframes
ClassNode node = new ClassNode();
ClassReader reader = new ClassReader(bytecode);
reader.accept(node, ClassReader.SKIP_FRAMES);
ClassWriter writer = new ClassWriter(reader, ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);
node.accept(writer);
bytecode = writer.toByteArray();
// END HACK
int len1 = par3.length; // arg2!=null?arg2.length:0;
int len2 = bytecode.length; // bytecode!=null?bytecode.length:0;
ALog.fine(" %d (%+d)", len2, len2 - len1);
@@ -1,6 +1,8 @@
package com.gtnewhorizons.angelica.transform;
import static java.util.logging.Level.*;
import static java.util.logging.Level.ALL;
import static java.util.logging.Level.SEVERE;
import static java.util.logging.Level.WARNING;
import java.io.IOException;
import java.util.Calendar;
@@ -15,6 +17,7 @@ import java.util.logging.Logger;
public abstract class ALog {
private static class SMCFormatter extends Formatter {
int tzOffset;
SMCFormatter() {
@@ -30,18 +33,15 @@ public abstract class ALog {
// .append(time/600000%6).append(time/60000%10)//.append(":")
// .append(time/10000%6).append(time/10000%10).append(".")
// .append(time/100%10).append(time/10%10).append(time%10).append(" ")
.append(record.getLoggerName())
.append(" ")
.append(record.getLevel())
.append("]")
.append(record.getMessage())
.append("\n");
.append(record.getLoggerName()).append(" ").append(record.getLevel()).append("]")
.append(record.getMessage()).append("\n");
return sb.toString();
}
}
private static class SMCLogger extends Logger {
SMCLogger(String name) {
private static class ALogger extends Logger {
ALogger(String name) {
super(name, null);
setUseParentHandlers(false);
Formatter formatter = new SMCFormatter();
@@ -60,18 +60,19 @@ public abstract class ALog {
}
private static class SMCLevel extends Level {
private SMCLevel(String name, int value) {
super(name, value);
}
}
public static final String smcLogName = "SMC";
public static final Logger logger = new SMCLogger(smcLogName);
public static final Level SMCINFO = new SMCLevel("INF", 850);
public static final Level SMCCONFIG = new SMCLevel("CFG", 840);
public static final Level SMCFINE = new SMCLevel("FNE", 830);
public static final Level SMCFINER = new SMCLevel("FNR", 820);
public static final Level SMCFINEST = new SMCLevel("FNT", 810);
public static final String ALogName = "ANG";
public static final Logger logger = new ALogger(ALogName);
public static final Level ANGINFO = new SMCLevel("INF", 850);
public static final Level ANGCONFIG = new SMCLevel("CFG", 840);
public static final Level ANGFINE = new SMCLevel("FNE", 830);
public static final Level ANGFINER = new SMCLevel("FNR", 820);
public static final Level ANGFINEST = new SMCLevel("FNT", 810);
public static void log(Level level, String format, Object... args) {
if (logger.isLoggable(level)) logger.log(level, String.format(format, args));
@@ -86,22 +87,22 @@ public abstract class ALog {
}
public static void info(String format, Object... args) {
if (logger.isLoggable(SMCINFO)) logger.log(SMCINFO, String.format(format, args));
if (logger.isLoggable(ANGINFO)) logger.log(ANGINFO, String.format(format, args));
}
public static void config(String format, Object... args) {
if (logger.isLoggable(SMCCONFIG)) logger.log(SMCCONFIG, String.format(format, args));
if (logger.isLoggable(ANGCONFIG)) logger.log(ANGCONFIG, String.format(format, args));
}
public static void fine(String format, Object... args) {
if (logger.isLoggable(SMCFINE)) logger.log(SMCFINE, String.format(format, args));
if (logger.isLoggable(ANGFINE)) logger.log(ANGFINE, String.format(format, args));
}
public static void finer(String format, Object... args) {
if (logger.isLoggable(SMCFINER)) logger.log(SMCFINER, String.format(format, args));
if (logger.isLoggable(ANGFINER)) logger.log(ANGFINER, String.format(format, args));
}
public static void finest(String format, Object... args) {
if (logger.isLoggable(SMCFINEST)) logger.log(SMCFINEST, String.format(format, args));
if (logger.isLoggable(ANGFINEST)) logger.log(ANGFINEST, String.format(format, args));
}
}
@@ -1,7 +1,16 @@
package com.gtnewhorizons.angelica.transform;
import net.minecraft.launchwrapper.Launch;
public class InitNames {
public static void init() {
new NamerSrg().setNames();
final boolean obfuscated = !(Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment");
ALog.info("Environment obfuscated: %s", obfuscated);
if (obfuscated) {
new NamerSrg().setNames();
} else {
new NamerMcp().setNames();
}
}
}
@@ -1,9 +1,10 @@
package com.gtnewhorizons.angelica.transform;
import java.util.ArrayList;
import com.gtnewhorizons.angelica.transform.Names.Clas;
import com.gtnewhorizons.angelica.transform.Names.Fiel;
import com.gtnewhorizons.angelica.transform.Names.Meth;
import java.util.ArrayList;
public class Namer {
@@ -127,8 +127,6 @@ public class Namer1_7_10 extends Namer {
glAllocation_createDirectByteBuffer = m(glAllocation_, "c", "(I)Ljava/nio/ByteBuffer;");
glAllocation_createDirectIntBuffer = m(glAllocation_, "f", "(I)Ljava/nio/IntBuffer;");
glAllocation_deleteDisplayLists = m(glAllocation_, "b", "(I)V");
guiOptions_actionPerformed = m(guiOptions_, "a", "(" + guiButton_.desc + ")V");
guiOptions_initGui = m(guiOptions_, "b", "()V");
iCamera_setPosition = m(iCamera_, "a", "(DDD)V");
iResourceManager_getResource = m(iResourceManager_, "a", "(" + resourceLocation_.desc + ")" + iResource_.desc);
itemRenderer_renderItem = m(itemRenderer_, "a", "(" + entityLivingBase_.desc + itemStack_.desc + "I)V");
@@ -138,7 +136,6 @@ public class Namer1_7_10 extends Namer {
iTextureObject_loadTexture = m(iTextureObject_, "a", "(" + iResourceManager_.desc + ")V");
iTextureObject_getGlTextureId = m(iTextureObject_, "b", "()I");
minecraft_displayGuiScreen = m(minecraft_, "a", "(" + guiScreen_.desc + ")V");
minecraft_startGame = m(minecraft_, "ag", "()V");
openGlHelper_setActiveTexture = m(openGlHelper_, "j", "(I)V");
render_renderShadow = m(render_, "c", "(" + entity_.desc + "DDDFF)V");
renderBlocks_renderBlockFluids = m(renderBlocks_, "p", "(" + block_.desc + "III)Z");
@@ -151,24 +148,29 @@ public class Namer1_7_10 extends Namer {
renderBlocks_renderBlockByRenderType = m(renderBlocks_, "b", "(" + block_.desc + "III)Z");
renderBlocks_renderBlockFlowerPot = m(renderBlocks_, "a", "(" + blockFlowerPot_.desc + "III)Z");
renderBlocks_renderStdBlockWithAOP = m(renderBlocks_, "b", "(" + block_.desc + "IIIFFF)Z");
renderBlocks_renderPistonExtension = m(renderBlocks_, "c", "(" + block_.desc + "IIIZ)Z");
renderDragon_shouldRenderPass = m(renderDragon_, "a", "(" + entityDragon_.desc + "IF)I");
renderEnderman_shouldRenderPass = m(renderEnderman_, "a", "(" + entityEnderman_.desc + "IF)I");
renderSpider_shouldRenderPass = m(renderSpider_, "a", "(" + entitySpider_.desc + "IF)I");
rendererLivingE_doRender = m(rendererLivingE_, "a", "(" + entityLivingBase_.desc + "DDDFF)V");
rendererLivingE_renderEquippedItems = m(rendererLivingE_, "c", "(" + entityLivingBase_.desc + "F)V");
rendererLivingE_getColorMultiplier = m(rendererLivingE_, "a", "(" + entityLivingBase_.desc + "FF)I");
rendererLivingE_renderLabel =
m(rendererLivingE_, "a", "(" + entityLivingBase_.desc + "DDDLjava/lang/String;FD)V");
rendererLivingE_renderLabel = m(
rendererLivingE_,
"a",
"(" + entityLivingBase_.desc + "DDDLjava/lang/String;FD)V");
renderGlobal_renderEntities = m(renderGlobal_, "a", "(" + entityLivingBase_.desc + iCamera_.desc + "F)V");
renderGlobal_renderSky = m(renderGlobal_, "a", "(F)V");
renderGlobal_drawBlockDamageTexture =
m(renderGlobal_, "a", "(" + tessellator_.desc + entityPlayer_.desc + "F)V");
renderGlobal_drawBlockDamageTexture = m(
renderGlobal_,
"a",
"(" + tessellator_.desc + entityPlayer_.desc + "F)V");
renderGlobal_renderClouds = m(renderGlobal_, "b", "(F)V");
renderGlobal_sortAndRender = m(renderGlobal_, "a", "(" + entityLivingBase_.desc + "ID)I");
renderGlobal_clipRenderersByFrustum = m(renderGlobal_, "a", "(" + iCamera_.desc + "F)V");
renderGlobal_drawSelectionBox =
m(renderGlobal_, "a", "(" + entityPlayer_.desc + movingObjectPos_.desc + "IF)V");
renderGlobal_drawSelectionBox = m(
renderGlobal_,
"a",
"(" + entityPlayer_.desc + movingObjectPos_.desc + "IF)V");
renderGlobal_renderAllRenderLists = m(renderGlobal_, "a", "(ID)V");
stitcher_getCurrentWidth = m(stitcher_, "a", "()I");
tessellator_sortQuad = m(tessellator_, "a", "(FFF)" + tessVertexState_.desc);
@@ -1,8 +1,5 @@
package com.gtnewhorizons.angelica.transform;
import com.gtnewhorizons.angelica.transform.Names.Clas;
import com.gtnewhorizons.angelica.transform.Names.Fiel;
import com.gtnewhorizons.angelica.transform.Names.Meth;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
@@ -10,12 +7,17 @@ import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import com.gtnewhorizons.angelica.transform.Names.Clas;
import com.gtnewhorizons.angelica.transform.Names.Fiel;
import com.gtnewhorizons.angelica.transform.Names.Meth;
public class NamerMcp extends NamerSrg {
public void setNames() {
setNamesSrg();
lookupReobfName("../conf/");
rename("../conf/");
final String confPath = System.getProperty("net.minecraftforge.gradle.GradleStart.csvDir", "../conf") + "/";
lookupReobfName(confPath);
rename(confPath);
}
public void rename(String confPath) {
@@ -67,7 +69,7 @@ public class NamerMcp extends NamerSrg {
void lookupReobfName(String confPath) {
Map<String, String> nameMap;
nameMap = loadReobfMap(confPath + "joined.srg");
nameMap = loadReobfMap(confPath + "packaged.srg");
for (Clas c : ac) {
String s = nameMap.get(c.name);
System.out.printf("C %s %s\n", c.name, s);
@@ -127,26 +127,29 @@ public class NamerSrg extends Namer {
glAllocation_createDirectByteBuffer = m(glAllocation_, "func_74524_c", "(I)Ljava/nio/ByteBuffer;");
glAllocation_createDirectIntBuffer = m(glAllocation_, "func_74527_f", "(I)Ljava/nio/IntBuffer;");
glAllocation_deleteDisplayLists = m(glAllocation_, "func_74523_b", "(I)V");
guiOptions_actionPerformed = m(guiOptions_, "func_146284_a", "(" + guiButton_.desc + ")V");
guiOptions_initGui = m(guiOptions_, "func_73866_w_", "()V");
iCamera_setPosition = m(iCamera_, "func_78547_a", "(DDD)V");
iResourceManager_getResource =
m(iResourceManager_, "func_110536_a", "(" + resourceLocation_.desc + ")" + iResource_.desc);
itemRenderer_renderItem =
m(itemRenderer_, "func_78443_a", "(" + entityLivingBase_.desc + itemStack_.desc + "I)V");
iResourceManager_getResource = m(
iResourceManager_,
"func_110536_a",
"(" + resourceLocation_.desc + ")" + iResource_.desc);
itemRenderer_renderItem = m(
itemRenderer_,
"func_78443_a",
"(" + entityLivingBase_.desc + itemStack_.desc + "I)V");
itemRenderer_renderItemInFirstPerson = m(itemRenderer_, "func_78440_a", "(F)V");
itemRenderer_renderOverlays = m(itemRenderer_, "func_78447_b", "(F)V");
itemRenderer_updateEquipped = m(itemRenderer_, "func_78441_a", "()V");
iTextureObject_loadTexture = m(iTextureObject_, "func_110551_a", "(" + iResourceManager_.desc + ")V");
iTextureObject_getGlTextureId = m(iTextureObject_, "func_110552_b", "()I");
minecraft_displayGuiScreen = m(minecraft_, "func_147108_a", "(" + guiScreen_.desc + ")V");
minecraft_startGame = m(minecraft_, "func_71384_a", "()V");
openGlHelper_setActiveTexture = m(openGlHelper_, "func_77473_a", "(I)V");
render_renderShadow = m(render_, "func_76975_c", "(" + entity_.desc + "DDDFF)V");
renderBlocks_renderBlockFluids = m(renderBlocks_, "func_147721_p", "(" + block_.desc + "III)Z");
renderBlocks_renderStdBlockWithCM = m(renderBlocks_, "func_147736_d", "(" + block_.desc + "IIIFFF)Z");
renderBlocks_renderBlockSandFalling =
m(renderBlocks_, "func_147749_a", "(" + block_.desc + world_.desc + "IIII)V");
renderBlocks_renderBlockSandFalling = m(
renderBlocks_,
"func_147749_a",
"(" + block_.desc + world_.desc + "IIII)V");
renderBlocks_renderStdBlockWithAO = m(renderBlocks_, "func_147751_a", "(" + block_.desc + "IIIFFF)Z");
renderBlocks_renderBlockCactusImpl = m(renderBlocks_, "func_147754_e", "(" + block_.desc + "IIIFFF)Z");
renderBlocks_renderBlockDoor = m(renderBlocks_, "func_147760_u", "(" + block_.desc + "III)Z");
@@ -154,25 +157,32 @@ public class NamerSrg extends Namer {
renderBlocks_renderBlockByRenderType = m(renderBlocks_, "func_147805_b", "(" + block_.desc + "III)Z");
renderBlocks_renderBlockFlowerPot = m(renderBlocks_, "func_147752_a", "(" + blockFlowerPot_.desc + "III)Z");
renderBlocks_renderStdBlockWithAOP = m(renderBlocks_, "func_147808_b", "(" + block_.desc + "IIIFFF)Z");
renderBlocks_renderPistonExtension = m(renderBlocks_, "func_147809_c", "(" + block_.desc + "IIIZ)Z");
renderDragon_shouldRenderPass = m(renderDragon_, "func_77032_a", "(" + entityDragon_.desc + "IF)I");
renderEnderman_shouldRenderPass = m(renderEnderman_, "func_77032_a", "(" + entityEnderman_.desc + "IF)I");
renderSpider_shouldRenderPass = m(renderSpider_, "func_77032_a", "(" + entitySpider_.desc + "IF)I");
rendererLivingE_doRender = m(rendererLivingE_, "func_76986_a", "(" + entityLivingBase_.desc + "DDDFF)V");
rendererLivingE_renderEquippedItems = m(rendererLivingE_, "func_77029_c", "(" + entityLivingBase_.desc + "F)V");
rendererLivingE_getColorMultiplier = m(rendererLivingE_, "func_77030_a", "(" + entityLivingBase_.desc + "FF)I");
rendererLivingE_renderLabel =
m(rendererLivingE_, "func_96449_a", "(" + entityLivingBase_.desc + "DDDLjava/lang/String;FD)V");
renderGlobal_renderEntities =
m(renderGlobal_, "func_147589_a", "(" + entityLivingBase_.desc + iCamera_.desc + "F)V");
rendererLivingE_renderLabel = m(
rendererLivingE_,
"func_96449_a",
"(" + entityLivingBase_.desc + "DDDLjava/lang/String;FD)V");
renderGlobal_renderEntities = m(
renderGlobal_,
"func_147589_a",
"(" + entityLivingBase_.desc + iCamera_.desc + "F)V");
renderGlobal_renderSky = m(renderGlobal_, "func_72714_a", "(F)V");
renderGlobal_drawBlockDamageTexture =
m(renderGlobal_, "func_72717_a", "(" + tessellator_.desc + entityPlayer_.desc + "F)V");
renderGlobal_drawBlockDamageTexture = m(
renderGlobal_,
"func_72717_a",
"(" + tessellator_.desc + entityPlayer_.desc + "F)V");
renderGlobal_renderClouds = m(renderGlobal_, "func_72718_b", "(F)V");
renderGlobal_sortAndRender = m(renderGlobal_, "func_72719_a", "(" + entityLivingBase_.desc + "ID)I");
renderGlobal_clipRenderersByFrustum = m(renderGlobal_, "func_72729_a", "(" + iCamera_.desc + "F)V");
renderGlobal_drawSelectionBox =
m(renderGlobal_, "func_72731_b", "(" + entityPlayer_.desc + movingObjectPos_.desc + "IF)V");
renderGlobal_drawSelectionBox = m(
renderGlobal_,
"func_72731_b",
"(" + entityPlayer_.desc + movingObjectPos_.desc + "IF)V");
renderGlobal_renderAllRenderLists = m(renderGlobal_, "func_72733_a", "(ID)V");
stitcher_getCurrentWidth = m(stitcher_, "func_110935_a", "()I");
tessellator_sortQuad = m(tessellator_, "func_147564_a", "(FFF)" + tessVertexState_.desc);
@@ -186,16 +196,22 @@ public class NamerSrg extends Namer {
textureAtlasSpri_getIconName = m(textureAtlasSpri_, "func_94215_i", "()Ljava/lang/String;");
textureAtlasSpri_updateAnimation = m(textureAtlasSpri_, "func_94219_l", "()V");
textureCompass_updateCompass = m(textureCompass_, "func_94241_a", "(" + world_.desc + "DDDZZ)V");
textureManager_onResourceManagerReload =
m(textureManager_, "func_110549_a", "(" + iResourceManager_.desc + ")V");
textureManager_onResourceManagerReload = m(
textureManager_,
"func_110549_a",
"(" + iResourceManager_.desc + ")V");
textureManager_bindTexture = m(textureManager_, "func_110577_a", "(" + resourceLocation_.desc + ")V");
textureMap_loadTextureAtlas = m(textureMap_, "func_110571_b", "(" + iResourceManager_.desc + ")V");
textureMap_getIconResLoc =
m(textureMap_, "func_147634_a", "(" + resourceLocation_.desc + "I)" + resourceLocation_.desc);
textureMap_getIconResLoc = m(
textureMap_,
"func_147634_a",
"(" + resourceLocation_.desc + "I)" + resourceLocation_.desc);
textureMap_updateAnimations = m(textureMap_, "func_94248_c", "()V");
textureUtil_uploadTexture = m(textureUtil_, "func_110988_a", "(I[III)V");
textureUtil_uploadTextureImageAllocate =
m(textureUtil_, "func_110989_a", "(ILjava/awt/image/BufferedImage;ZZ)I");
textureUtil_uploadTextureImageAllocate = m(
textureUtil_,
"func_110989_a",
"(ILjava/awt/image/BufferedImage;ZZ)I");
textureUtil_allocateTexture = m(textureUtil_, "func_110991_a", "(III)V");
textureUtil_allocateTextureMipmapAniso = m(textureUtil_, "func_147946_a", "(IIIIF)V");
textureUtil_uploadTexSub = m(textureUtil_, "func_147955_a", "([[IIIIIZZ)V");
@@ -3,6 +3,7 @@ package com.gtnewhorizons.angelica.transform;
public class Names {
public static class Name {
String clas;
String name;
String desc;
@@ -26,6 +27,7 @@ public class Names {
}
public static class Type extends Name {
public Type(String desc) {
super("", "", desc);
}
@@ -36,6 +38,7 @@ public class Names {
}
public static class Clas extends Type {
public Clas(String name) {
super(name, "L" + name + ";");
}
@@ -46,6 +49,7 @@ public class Names {
}
public static class Fiel extends Name {
public Fiel(Clas clas, String name, String desc) {
super(clas.clas, name, desc);
}
@@ -56,6 +60,7 @@ public class Names {
}
public static class Meth extends Name {
public Meth(Clas clas, String name, String desc) {
super(clas.clas, name, desc);
}
@@ -188,8 +193,6 @@ public class Names {
static Meth glAllocation_createDirectByteBuffer;
static Meth glAllocation_createDirectIntBuffer;
static Meth glAllocation_deleteDisplayLists;
static Meth guiOptions_actionPerformed;
static Meth guiOptions_initGui;
static Meth iCamera_setPosition;
static Meth iResourceManager_getResource;
static Meth itemRenderer_renderItem;
@@ -199,7 +202,6 @@ public class Names {
static Meth iTextureObject_loadTexture;
static Meth iTextureObject_getGlTextureId;
static Meth minecraft_displayGuiScreen;
static Meth minecraft_startGame;
static Meth openGlHelper_setActiveTexture;
static Meth render_renderShadow;
static Meth renderBlocks_renderBlockFluids;
@@ -212,7 +214,6 @@ public class Names {
static Meth renderBlocks_renderBlockByRenderType;
static Meth renderBlocks_renderBlockFlowerPot;
static Meth renderBlocks_renderStdBlockWithAOP;
static Meth renderBlocks_renderPistonExtension;
static Meth renderDragon_shouldRenderPass;
static Meth renderEnderman_shouldRenderPass;
static Meth renderSpider_shouldRenderPass;
@@ -0,0 +1,27 @@
# Make all Tessellator fields public because using accessors for these would be too much rework right now
public net.minecraft.client.renderer.Tessellator field_78394_d # byteBuffer
public net.minecraft.client.renderer.Tessellator field_147568_c # intBuffer
public net.minecraft.client.renderer.Tessellator field_147566_d # floatBuffer
public net.minecraft.client.renderer.Tessellator field_147567_e # shortBuffer
public net.minecraft.client.renderer.Tessellator field_78405_h # rawBuffer
public net.minecraft.client.renderer.Tessellator field_78406_i # vertexCount
public net.minecraft.client.renderer.Tessellator field_78403_j # textureU
public net.minecraft.client.renderer.Tessellator field_78404_k # textureV
public net.minecraft.client.renderer.Tessellator field_78401_l # brightness
public net.minecraft.client.renderer.Tessellator field_78402_m # color
public net.minecraft.client.renderer.Tessellator field_78399_n # hasColor
public net.minecraft.client.renderer.Tessellator field_78400_o # hasTexture
public net.minecraft.client.renderer.Tessellator field_78414_p # hasBrightness
public net.minecraft.client.renderer.Tessellator field_78413_q # hasNormals
public net.minecraft.client.renderer.Tessellator field_147569_p # rawBufferIndex
public net.minecraft.client.renderer.Tessellator field_78411_s # addedVertices
public net.minecraft.client.renderer.Tessellator field_78410_t # isColorDisabled
public net.minecraft.client.renderer.Tessellator field_78409_u # drawMode
public net.minecraft.client.renderer.Tessellator field_78408_v # xOffset
public net.minecraft.client.renderer.Tessellator field_78407_w # yOffset
public net.minecraft.client.renderer.Tessellator field_78417_x # zOffset
public net.minecraft.client.renderer.Tessellator field_78416_y # normal
public net.minecraft.client.renderer.Tessellator field_78415_z # isDrawing
public net.minecraft.client.renderer.Tessellator field_78388_E # bufferSize
public net.minecraft.client.renderer.Tessellator func_78379_d()V # reset
public net.minecraft.client.renderer.EntityRenderer func_78476_b(FI)V # renderHand
+2 -2
View File
@@ -3,11 +3,11 @@
"modid": "${modId}",
"name": "${modName}",
"description": "The little angle that supports shaders while saving your FPS from a certain death",
"version": "2.3.18",
"version": "${modVersion}",
"mcversion": "1.7.10",
"url": "",
"updateUrl": "",
"authors": ["karyonix","sonic ether","id_miner","daxnitro"],
"authors": ["eigenraven","vlaetansky","karyonix","sonic ether","id_miner","daxnitro"],
"credits": "Based on daxnitro's GLSL Shaders Mod.",
"logoFile": "",
"screenshots": [],
@@ -0,0 +1,9 @@
{
"required": true,
"minVersion": "0.8.3-GTNH",
"package": "com.gtnewhorizons.angelica.mixins.early",
"refmap": "mixins.angelica.refmap.json",
"target": "@env(DEFAULT)",
"compatibilityLevel": "JAVA_8"
}
Loaded 100 of 102 files, more files were not shown because too many files have changed in this diff. Show more