aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDJtheRedstoner <52044242+DJtheRedstoner@users.noreply.github.com>2021-08-20 17:17:16 -0400
committerDJtheRedstoner <52044242+DJtheRedstoner@users.noreply.github.com>2021-08-20 17:17:16 -0400
commit12888a9eb0469a5462e497a29eb4d3d15bb48f3c (patch)
tree0c0ab075cfefd3fca76e7d35704f7ba20ae961f9
parent28fb656d8b285f3da2227dd859735392902a31ef (diff)
downloadPerspectiveModv4-12888a9eb0469a5462e497a29eb4d3d15bb48f3c.tar.gz
PerspectiveModv4-12888a9eb0469a5462e497a29eb4d3d15bb48f3c.tar.bz2
PerspectiveModv4-12888a9eb0469a5462e497a29eb4d3d15bb48f3c.zip
this is why we can't have nice things
-rw-r--r--.github/perspectivemod.pngbin282887 -> 0 bytes
-rw-r--r--.github/workflows/build.yml54
-rw-r--r--.gitignore22
-rw-r--r--CONTRIBUTING.md1
-rw-r--r--LICENSE21
-rw-r--r--README.md29
-rw-r--r--build.gradle108
-rw-r--r--gradle.properties6
-rw-r--r--gradle/wrapper/gradle-wrapper.jarbin54417 -> 0 bytes
-rw-r--r--gradle/wrapper/gradle-wrapper.properties5
-rw-r--r--gradlew172
-rw-r--r--gradlew.bat84
-rw-r--r--readme.md1
-rw-r--r--src/main/java/me/djtheredstoner/perspectivemod/PerspectiveMod.java133
-rw-r--r--src/main/java/me/djtheredstoner/perspectivemod/asm/ClassTransformer.java118
-rw-r--r--src/main/java/me/djtheredstoner/perspectivemod/asm/ITransformer.java98
-rw-r--r--src/main/java/me/djtheredstoner/perspectivemod/asm/hooks/ActiveRenderInfoHook.java16
-rw-r--r--src/main/java/me/djtheredstoner/perspectivemod/asm/hooks/EntityRendererHook.java32
-rw-r--r--src/main/java/me/djtheredstoner/perspectivemod/asm/hooks/MinecraftHook.java16
-rw-r--r--src/main/java/me/djtheredstoner/perspectivemod/asm/hooks/RenderManagerHook.java15
-rw-r--r--src/main/java/me/djtheredstoner/perspectivemod/asm/transformers/ActiveRenderInfoTransformer.java68
-rw-r--r--src/main/java/me/djtheredstoner/perspectivemod/asm/transformers/EntityRendererTransformer.java128
-rw-r--r--src/main/java/me/djtheredstoner/perspectivemod/asm/transformers/MinecraftTransformer.java57
-rw-r--r--src/main/java/me/djtheredstoner/perspectivemod/asm/transformers/RenderManagerTransformer.java71
-rw-r--r--src/main/java/me/djtheredstoner/perspectivemod/commands/PerspectiveModCommand.java19
-rw-r--r--src/main/java/me/djtheredstoner/perspectivemod/config/PerspectiveModConfig.java42
-rw-r--r--src/main/java/me/djtheredstoner/perspectivemod/forge/PerspectiveModTweaker.java77
-rw-r--r--src/main/resources/mcmod.info16
28 files changed, 1 insertions, 1408 deletions
diff --git a/.github/perspectivemod.png b/.github/perspectivemod.png
deleted file mode 100644
index e698546..0000000
--- a/.github/perspectivemod.png
+++ /dev/null
Binary files differ
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
deleted file mode 100644
index dd5030b..0000000
--- a/.github/workflows/build.yml
+++ /dev/null
@@ -1,54 +0,0 @@
-name: Build
-
-on:
- push:
- branches:
- - '**'
- pull_request:
-
-jobs:
- build:
- name: Build
- runs-on: ubuntu-latest
- env:
- PROPERTIES_PATH: gradle.properties
-
- steps:
- - uses: actions/checkout@v2
-
- - name: Set up JDK 1.8
- uses: actions/setup-java@v1
- with:
- java-version: 1.8
-
- - name: Grant execute permission for gradlew
- run: chmod +x gradlew
-
- - name: Setup ForgeGradle
- run: ./gradlew setupCIWorkspace
-
- - name: Read mod name
- id: read_mod_name
- uses: christian-draeger/read-properties@1.0.1
- with:
- path: ${{ env.PROPERTIES_PATH }}
- property: archivesBaseName
-
- - name: Read mod version
- id: read_mod_version
- uses: christian-draeger/read-properties@1.0.1
- with:
- path: ${{ env.PROPERTIES_PATH }}
- property: version
-
- - name: Build with Gradle
- run: ./gradlew build
-
- - name: Upload mod jar
- env:
- mod_jar_name: ${{ steps.read_mod_name.outputs.value }}-${{ steps.read_mod_version.outputs.value }}
- mod_jar_path: build/libs/${{ steps.read_mod_name.outputs.value }}-${{ steps.read_mod_version.outputs.value }}.jar
- uses: actions/upload-artifact@v1.0.0
- with:
- name: ${{ env.mod_jar_name }}
- path: ${{ env.mod_jar_path }}
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 2c770e0..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,22 +0,0 @@
-# eclipse
-bin
-*.launch
-.settings
-.metadata
-.classpath
-.project
-
-# idea
-out
-*.ipr
-*.iws
-*.iml
-.idea
-
-# gradle
-build
-.gradle
-
-# other
-eclipse
-run
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
deleted file mode 100644
index e4b6a9c..0000000
--- a/CONTRIBUTING.md
+++ /dev/null
@@ -1 +0,0 @@
-![](https://i.pinimg.com/originals/c0/23/21/c023217ab822ce262aaf44163784493d.jpg)
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index 45ae6c4..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2020 DJtheRedstoner
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE. \ No newline at end of file
diff --git a/README.md b/README.md
deleted file mode 100644
index 54f7b2b..0000000
--- a/README.md
+++ /dev/null
@@ -1,29 +0,0 @@
-# Perspective Mod v4
-
-A remake of [Perspective Mod v3 by canelex](https://github.com/Canelex/PerspectiveMod) with bug fixes and additional functionality
-
-[![Discord Link](https://img.shields.io/discord/767833575185580062?color=blueviolet&label=discord)](https://discord.gg/k8fnyEr)
-
-Features:
-- Mouse button support
-- Nametags face camera
-- Config GUI
-- Mod can be enabled/disabled
-- Hold and toggle modes
-- Invert pitch/Y axis mode
-- Essential Integration
-
-Options can be configured with the `/perspectivemod` or `/pmod` commands.
-
-Download the mod from the [releases](https://github.com/DJtheRedstoner/PerspectiveModv4/releases) page.
-
-> Note: Using this mod with other perspective mods may cause issues and is not recommended.
-
-# A note on Hypixel and this mod
-
-Hypixel recently updated their rules which makes this mod disallowed.
-They have blocked this mod (and every other perspective mod's) modid,
-meaning you will be kicked if you attempt to join with it. I am happy
-with this decision because it is being fairly enforced (the feature has
-been disabled in clients, not just blocked mods), and it is well within
-Hypixel's rights to change the rules and take measures to enforce them. \ No newline at end of file
diff --git a/build.gradle b/build.gradle
deleted file mode 100644
index 189bde6..0000000
--- a/build.gradle
+++ /dev/null
@@ -1,108 +0,0 @@
-buildscript {
- repositories {
- mavenCentral()
- gradlePluginPortal()
- maven {
- name = "forge"
- url = "https://maven.minecraftforge.net/"
- }
- maven {
- name = "jitpack"
- url = "https://jitpack.io/"
- }
- }
- dependencies {
- classpath "com.github.asbyth:ForgeGradle:b13624b272"
- classpath "com.github.jengelman.gradle.plugins:shadow:6.1.0"
- }
-}
-
-apply plugin: "net.minecraftforge.gradle.forge"
-apply plugin: "com.github.johnrengelman.shadow"
-
-group= "me.djtheredstoner"
-
-sourceCompatibility = JavaVersion.VERSION_1_8
-targetCompatibility = JavaVersion.VERSION_1_8
-compileJava.options.encoding = 'UTF-8'
-
-sourceSets {
- main {
- output.resourcesDir = java.outputDir
- }
-}
-
-minecraft {
- version = "1.8.9-11.15.1.2318-1.8.9"
- runDir = "run"
- mappings = "stable_22"
- clientJvmArgs += "-Dfml.coreMods.load=me.djtheredstoner.perspectivemod.forge.PerspectiveModTweaker"
-}
-
-configurations {
- embed
- implementation.extendsFrom(embed)
-}
-
-repositories {
- mavenCentral()
- maven { url = "https://repo.sk1er.club/repository/maven-public/" }
- maven { url = "https://jitpack.io/" }
- maven { url = "https://repo.spongepowered.org/repository/maven-public/" }
-}
-
-dependencies {
- embed "gg.essential:loader-launchwrapper:1.1.0"
-
- implementation "gg.essential:Essential:1193-10809-SNAPSHOT"
-}
-
-jar {
- enabled = false
-}
-
-shadowJar {
- archiveClassifier.set("")
-
- duplicatesStrategy = DuplicatesStrategy.EXCLUDE
-
- configurations = [project.configurations.embed]
-
- manifest.attributes(
- 'FMLCorePluginContainsFMLMod': true,
- "ForceLoadAsMod": true,
- 'ModSide': 'CLIENT',
- "FMLCorePlugin": "me.djtheredstoner.perspectivemod.forge.PerspectiveModTweaker",
- "TweakClass": "gg.essential.loader.stage0.EssentialSetupTweaker"
- )
-}
-
-reobfJar.dependsOn tasks.shadowJar
-
-reobf {
- shadowJar {
- mappingType = 'SEARGE'
- }
-}
-
-processResources
-{
- // this will ensure that this task is redone when the versions change.
- inputs.property "version", project.version
- inputs.property "mcversion", project.minecraft.version
-
- // replace stuff in mcmod.info, nothing else
- from(sourceSets.main.resources.srcDirs) {
- include 'mcmod.info'
-
- // replace version and mcversion
- expand 'version':project.version, 'mcversion':project.minecraft.version
- }
-
- // copy everything else, thats not the mcmod.info
- from(sourceSets.main.resources.srcDirs) {
- exclude 'mcmod.info'
- }
-
- from(file("LICENSE"))
-}
diff --git a/gradle.properties b/gradle.properties
deleted file mode 100644
index ddd79e4..0000000
--- a/gradle.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-org.gradle.jvmargs=-Xmx2G
-
-# These are in here and not in build.gradle so that github actions can read them
-modid = djperspectivemod
-archivesBaseName = PerspectiveModv4
-version = 4.5
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index 758de96..0000000
--- a/gradle/wrapper/gradle-wrapper.jar
+++ /dev/null
Binary files differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index 8cf6eb5..0000000
--- a/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,5 +0,0 @@
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
deleted file mode 100644
index cccdd3d..0000000
--- a/gradlew
+++ /dev/null
@@ -1,172 +0,0 @@
-#!/usr/bin/env sh
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# 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
-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=""
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn () {
- echo "$*"
-}
-
-die () {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# 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
- ;;
-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"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- 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
-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, switch paths to Windows format before running java
-if $cygwin ; 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" ;;
- 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, 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"
-
-# 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")"
-fi
-
-exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
deleted file mode 100644
index f955316..0000000
--- a/gradlew.bat
+++ /dev/null
@@ -1,84 +0,0 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@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=
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-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%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="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
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/readme.md b/readme.md
new file mode 100644
index 0000000..d4b3993
--- /dev/null
+++ b/readme.md
@@ -0,0 +1 @@
+this is why we can't have nice things \ No newline at end of file
diff --git a/src/main/java/me/djtheredstoner/perspectivemod/PerspectiveMod.java b/src/main/java/me/djtheredstoner/perspectivemod/PerspectiveMod.java
deleted file mode 100644
index 8ef5ed5..0000000
--- a/src/main/java/me/djtheredstoner/perspectivemod/PerspectiveMod.java
+++ /dev/null
@@ -1,133 +0,0 @@
-package me.djtheredstoner.perspectivemod;
-
-import me.djtheredstoner.perspectivemod.commands.PerspectiveModCommand;
-import me.djtheredstoner.perspectivemod.config.PerspectiveModConfig;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.settings.GameSettings;
-import net.minecraft.client.settings.KeyBinding;
-import net.minecraftforge.client.ClientCommandHandler;
-import net.minecraftforge.client.event.GuiOpenEvent;
-import net.minecraftforge.common.MinecraftForge;
-import net.minecraftforge.event.world.WorldEvent;
-import net.minecraftforge.fml.client.registry.ClientRegistry;
-import net.minecraftforge.fml.common.Mod;
-import net.minecraftforge.fml.common.event.FMLInitializationEvent;
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
-import net.minecraftforge.fml.common.gameevent.TickEvent;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.lwjgl.input.Keyboard;
-import org.lwjgl.opengl.Display;
-
-@Mod(modid = "djperspectivemod", name = "Perspective Mod v4", version = "4.5", acceptedMinecraftVersions = "[1.8.9]", clientSideOnly = true)
-public class PerspectiveMod {
-
- @Mod.Instance
- public static PerspectiveMod instance;
-
- public final PerspectiveModConfig config = new PerspectiveModConfig();
-
- public boolean perspectiveToggled = false;
- public float cameraYaw = 0F;
- public float cameraPitch = 0F;
-
- private int previousPerspective = 0;
- private boolean prevState = false;
-
- private final Minecraft mc = Minecraft.getMinecraft();
- private final KeyBinding perspectiveKey = new KeyBinding("Perspective", Keyboard.KEY_LMENU, "Perspective Mod");
- private final Logger logger = LogManager.getLogger("Perspective Mod v4");
-
- @Mod.EventHandler
- public void init(FMLInitializationEvent event) {
- config.preload();
-
- ClientRegistry.registerKeyBinding(perspectiveKey);
- new PerspectiveModCommand("perspectivemod").register();
- new PerspectiveModCommand("pmod").register();
- MinecraftForge.EVENT_BUS.register(this);
- }
-
- @SubscribeEvent
- public void tick(TickEvent.RenderTickEvent event) {
- boolean down = GameSettings.isKeyDown(perspectiveKey);
- if(down != prevState && mc.currentScreen == null && mc.theWorld != null && mc.thePlayer != null) {
- prevState = down;
- onPressed(down);
- }
- }
-
- @SubscribeEvent
- public void onGuiOpen(GuiOpenEvent event) {
- if (event.gui != null && perspectiveToggled && config.holdMode) {
- resetPerspective();
- }
- }
-
- @SubscribeEvent
- public void onWorldLoad(WorldEvent.Load event) {
- if (perspectiveToggled) {
- resetPerspective();
- }
- }
-
- public void onPressed(boolean state) {
- if (config.modEnabled) {
- if (state) {
- cameraYaw = mc.thePlayer.rotationYaw;
- cameraPitch = mc.thePlayer.rotationPitch;
-
- if (perspectiveToggled) {
- resetPerspective();
- } else {
- enterPerspective();
- }
- mc.renderGlobal.setDisplayListEntitiesDirty();
- } else if (config.holdMode) {
- resetPerspective();
- }
- } else if (perspectiveToggled) {
- resetPerspective();
- }
- }
-
- public void enterPerspective() {
- perspectiveToggled = true;
- previousPerspective = mc.gameSettings.thirdPersonView;
- mc.gameSettings.thirdPersonView = 1;
- }
-
- public void resetPerspective() {
- perspectiveToggled = false;
- mc.gameSettings.thirdPersonView = previousPerspective;
- mc.renderGlobal.setDisplayListEntitiesDirty();
- }
-
- public boolean overrideMouse() {
- if (mc.inGameHasFocus && Display.isActive()) {
- if (!perspectiveToggled) {
- return true;
- }
-
- // CODE
- mc.mouseHelper.mouseXYChange();
- float f1 = mc.gameSettings.mouseSensitivity * 0.6F + 0.2F;
- float f2 = f1 * f1 * f1 * 8.0F;
- float f3 = (float) mc.mouseHelper.deltaX * f2;
- float f4 = (float) mc.mouseHelper.deltaY * f2;
-
- if(config.invertPitch) {
- f4 = -f4;
- }
-
- cameraYaw += f3 * 0.15F;
- cameraPitch += f4 * 0.15F;
-
- if (cameraPitch > 90) cameraPitch = 90;
- if (cameraPitch < -90) cameraPitch = -90;
- mc.renderGlobal.setDisplayListEntitiesDirty();
- }
-
- return false;
- }
-}
diff --git a/src/main/java/me/djtheredstoner/perspectivemod/asm/ClassTransformer.java b/src/main/java/me/djtheredstoner/perspectivemod/asm/ClassTransformer.java
deleted file mode 100644
index c7db68b..0000000
--- a/src/main/java/me/djtheredstoner/perspectivemod/asm/ClassTransformer.java
+++ /dev/null
@@ -1,118 +0,0 @@
-package me.djtheredstoner.perspectivemod.asm;
-
-import com.google.common.collect.ArrayListMultimap;
-import com.google.common.collect.Multimap;
-import me.djtheredstoner.perspectivemod.asm.transformers.ActiveRenderInfoTransformer;
-import me.djtheredstoner.perspectivemod.asm.transformers.EntityRendererTransformer;
-import me.djtheredstoner.perspectivemod.asm.transformers.MinecraftTransformer;
-import me.djtheredstoner.perspectivemod.asm.transformers.RenderManagerTransformer;
-import net.minecraft.launchwrapper.IClassTransformer;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.objectweb.asm.ClassReader;
-import org.objectweb.asm.ClassWriter;
-import org.objectweb.asm.tree.ClassNode;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.Collection;
-
-public class ClassTransformer implements IClassTransformer {
-
- // create a logger to distinguish our errors from a normal error
- private static final Logger LOGGER = LogManager.getLogger("Perspective Mod v4 Transformer");
-
- // create a map of transformers
- private final Multimap<String, ITransformer> transformerMap = ArrayListMultimap.create();
-
- // make a jvm flag that could be used to dump transformed classes
- // usable by adding -DdebugBytecode=true to the jvm arguments
- public static final boolean outputBytecode = Boolean.parseBoolean(System.getProperty("debugBytecode", "false"));
-
- public ClassTransformer() {
- // any transformer will be registered here
- registerTransformer(new EntityRendererTransformer());
- registerTransformer(new RenderManagerTransformer());
- registerTransformer(new MinecraftTransformer());
- registerTransformer(new ActiveRenderInfoTransformer());
- }
-
- private void registerTransformer(ITransformer transformer) {
- // loop through names of classes
- for (String cls : transformer.getClassName()) {
- // put the classes into the transformer map
- transformerMap.put(cls, transformer);
- }
- }
-
- @SuppressWarnings("ResultOfMethodCallIgnored")
- @Override
- public byte[] transform(String name, String transformedName, byte[] bytes) {
- if (bytes == null) return null;
-
- // get the list of transformers
- Collection<ITransformer> transformers = transformerMap.get(transformedName);
- // if empty, don't bother trying to run through transformation
- if (transformers.isEmpty()) return bytes;
-
- // wjat
- ClassReader reader = new ClassReader(bytes);
- ClassNode node = new ClassNode();
- reader.accept(node, ClassReader.EXPAND_FRAMES);
-
- // for every transformer, perform the transformations
- for (ITransformer transformer : transformers) {
- transformer.transform(node, transformedName);
- }
-
- // what?????
- ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_FRAMES);
-
- try {
- // write™
- node.accept(writer);
- } catch (Throwable t) {
- LOGGER.error("Exception when transforming " + transformedName + " : " + t.getClass().getSimpleName());
- t.printStackTrace();
- }
-
- if (outputBytecode) {
- File bytecodeDirectory = new File("bytecode");
- String transformedClassName;
-
- // anonymous classes
- if (transformedName.contains("$")) {
- transformedClassName = transformedName.replace('$', '.') + ".class";
- } else {
- transformedClassName = transformedName + ".class";
- }
-
- if (!bytecodeDirectory.exists()) {
- bytecodeDirectory.mkdirs();
- }
-
- File bytecodeOutput = new File(bytecodeDirectory, transformedClassName);
-
- try {
- if (!bytecodeOutput.exists()) {
- bytecodeOutput.createNewFile();
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- try (FileOutputStream os = new FileOutputStream(bytecodeOutput)) {
- // write to the generated class to /run/bytecode/classfile.class
- // with the class bytes from transforming
- os.write(writer.toByteArray());
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- // return the written bytes and finalize transform
- return writer.toByteArray();
- }
-
-}
diff --git a/src/main/java/me/djtheredstoner/perspectivemod/asm/ITransformer.java b/src/main/java/me/djtheredstoner/perspectivemod/asm/ITransformer.java
deleted file mode 100644
index 9ef82be..0000000
--- a/src/main/java/me/djtheredstoner/perspectivemod/asm/ITransformer.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package me.djtheredstoner.perspectivemod.asm;
-
-import net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper;
-import org.objectweb.asm.tree.*;
-
-public interface ITransformer {
-
- /**
- * The class name that's being transformed
- *
- * @return the class name
- */
- String[] getClassName();
-
- /**
- * Perform any asm in order to transform code
- *
- * @param classNode the transformed class node
- * @param name the transformed class name
- */
- void transform(ClassNode classNode, String name);
-
- /**
- * Map the method name from notch names
- *
- * @param classNode the transformed class node
- * @param methodNode the transformed classes method node
- * @return a mapped method name
- */
- default String mapMethodName(ClassNode classNode, MethodNode methodNode) {
- return FMLDeobfuscatingRemapper.INSTANCE.mapMethodName(classNode.name, methodNode.name, methodNode.desc);
- }
-
- /**
- * Map the field name from notch names
- *
- * @param classNode the transformed class node
- * @param fieldNode the transformed classes field node
- * @return a mapped field name
- */
- default String mapFieldName(ClassNode classNode, FieldNode fieldNode) {
- return FMLDeobfuscatingRemapper.INSTANCE.mapFieldName(classNode.name, fieldNode.name, fieldNode.desc);
- }
-
- /**
- * Map the method desc from notch names
- *
- * @param methodNode the transformed method node
- * @return a mapped method desc
- */
- default String mapMethodDesc(MethodNode methodNode) {
- return FMLDeobfuscatingRemapper.INSTANCE.mapMethodDesc(methodNode.desc);
- }
-
- /**
- * Map the method name from notch names
- *
- * @param methodInsnNode the transformed method insn node
- * @return a mapped insn method
- */
- default String mapMethodNameFromNode(MethodInsnNode methodInsnNode) {
- return FMLDeobfuscatingRemapper.INSTANCE.mapMethodName(methodInsnNode.owner, methodInsnNode.name, methodInsnNode.desc);
- }
-
- /**
- * Map the field name from notch names
- *
- * @param fieldInsnNode the transformed field insn node
- * @return a mapped insn field
- */
- default String mapFieldNameFromNode(FieldInsnNode fieldInsnNode) {
- return FMLDeobfuscatingRemapper.INSTANCE.mapFieldName(fieldInsnNode.owner, fieldInsnNode.name, fieldInsnNode.desc);
- }
-
- default String mapClassName(String name) {
- return FMLDeobfuscatingRemapper.INSTANCE.mapType(name);
- }
-
- /**
- * Remove instructions to this method
- *
- * @param methodNode the method being cleared
- */
- default void clearInstructions(MethodNode methodNode) {
- methodNode.instructions.clear();
-
- // dont waste time clearing local variables if they're empty
- if (!methodNode.localVariables.isEmpty()) {
- methodNode.localVariables.clear();
- }
-
- // dont waste time clearing try-catches if they're empty
- if (!methodNode.tryCatchBlocks.isEmpty()) {
- methodNode.tryCatchBlocks.clear();
- }
- }
-
-}
diff --git a/src/main/java/me/djtheredstoner/perspectivemod/asm/hooks/ActiveRenderInfoHook.java b/src/main/java/me/djtheredstoner/perspectivemod/asm/hooks/ActiveRenderInfoHook.java
deleted file mode 100644
index 94296d1..0000000
--- a/src/main/java/me/djtheredstoner/perspectivemod/asm/hooks/ActiveRenderInfoHook.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package me.djtheredstoner.perspectivemod.asm.hooks;
-
-import me.djtheredstoner.perspectivemod.PerspectiveMod;
-import net.minecraft.entity.player.EntityPlayer;
-
-public class ActiveRenderInfoHook {
-
- public static float rotationYawHook(EntityPlayer entity) {
- return PerspectiveMod.instance.perspectiveToggled ? PerspectiveMod.instance.cameraYaw : entity.rotationYaw;
- }
-
- public static float rotationPitchHook(EntityPlayer entity) {
- return PerspectiveMod.instance.perspectiveToggled ? PerspectiveMod.instance.cameraPitch : entity.rotationPitch;
- }
-
-}
diff --git a/src/main/java/me/djtheredstoner/perspectivemod/asm/hooks/EntityRendererHook.java b/src/main/java/me/djtheredstoner/perspectivemod/asm/hooks/EntityRendererHook.java
deleted file mode 100644
index a6ea788..0000000
--- a/src/main/java/me/djtheredstoner/perspectivemod/asm/hooks/EntityRendererHook.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package me.djtheredstoner.perspectivemod.asm.hooks;
-
-import me.djtheredstoner.perspectivemod.PerspectiveMod;
-import net.minecraft.client.Minecraft;
-import net.minecraft.entity.Entity;
-
-public class EntityRendererHook {
-
- public static float rotationYawHook(Entity entity) {
- return PerspectiveMod.instance.perspectiveToggled ? PerspectiveMod.instance.cameraYaw : entity.rotationYaw;
- }
-
- public static float prevRotationYawHook(Entity entity) {
- return PerspectiveMod.instance.perspectiveToggled ? PerspectiveMod.instance.cameraYaw : entity.prevRotationYaw;
- }
-
- public static float rotationPitchHook(Entity entity) {
- return PerspectiveMod.instance.perspectiveToggled ? PerspectiveMod.instance.cameraPitch : entity.rotationPitch;
- }
-
- public static float prevRotationPitchHook(Entity entity) {
- return PerspectiveMod.instance.perspectiveToggled ? PerspectiveMod.instance.cameraPitch : entity.prevRotationPitch;
- }
-
- public static boolean mouseHook(Minecraft minecraft) {
- return PerspectiveMod.instance == null ? minecraft.inGameHasFocus : PerspectiveMod.instance.overrideMouse();
- }
-
- public static double distanceHook(double value) {
- return value;
- }
-}
diff --git a/src/main/java/me/djtheredstoner/perspectivemod/asm/hooks/MinecraftHook.java b/src/main/java/me/djtheredstoner/perspectivemod/asm/hooks/MinecraftHook.java
deleted file mode 100644
index 31914f8..0000000
--- a/src/main/java/me/djtheredstoner/perspectivemod/asm/hooks/MinecraftHook.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package me.djtheredstoner.perspectivemod.asm.hooks;
-
-import me.djtheredstoner.perspectivemod.PerspectiveMod;
-import net.minecraft.client.settings.GameSettings;
-
-public class MinecraftHook {
-
- public static void thirdPersonHook(GameSettings gameSettings, int value) {
- if(PerspectiveMod.instance.perspectiveToggled) {
- PerspectiveMod.instance.resetPerspective();
- } else {
- gameSettings.thirdPersonView = value;
- }
- }
-
-}
diff --git a/src/main/java/me/djtheredstoner/perspectivemod/asm/hooks/RenderManagerHook.java b/src/main/java/me/djtheredstoner/perspectivemod/asm/hooks/RenderManagerHook.java
deleted file mode 100644
index 2f55de1..0000000
--- a/src/main/java/me/djtheredstoner/perspectivemod/asm/hooks/RenderManagerHook.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package me.djtheredstoner.perspectivemod.asm.hooks;
-
-import me.djtheredstoner.perspectivemod.PerspectiveMod;
-import net.minecraft.client.renderer.entity.RenderManager;
-
-public class RenderManagerHook {
-
- public static void playerViewXHook(RenderManager renderManager, float value) {
- renderManager.playerViewX = PerspectiveMod.instance.perspectiveToggled ? PerspectiveMod.instance.cameraPitch : value;
- }
-
- public static void playerViewYHook(RenderManager renderManager, float value) {
- renderManager.playerViewY = PerspectiveMod.instance.perspectiveToggled ? PerspectiveMod.instance.cameraYaw : value;
- }
-}
diff --git a/src/main/java/me/djtheredstoner/perspectivemod/asm/transformers/ActiveRenderInfoTransformer.java b/src/main/java/me/djtheredstoner/perspectivemod/asm/transformers/ActiveRenderInfoTransformer.java
deleted file mode 100644
index 9a37575..0000000
--- a/src/main/java/me/djtheredstoner/perspectivemod/asm/transformers/ActiveRenderInfoTransformer.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package me.djtheredstoner.perspectivemod.asm.transformers;
-
-import me.djtheredstoner.perspectivemod.asm.ITransformer;
-import org.objectweb.asm.tree.*;
-
-import java.util.ListIterator;
-
-import static org.objectweb.asm.Opcodes.*;
-
-public class ActiveRenderInfoTransformer implements ITransformer {
-
- private static final String HOOK_CLASS = "me/djtheredstoner/perspectivemod/asm/hooks/ActiveRenderInfoHook";
-
- @Override
- public String[] getClassName() {
- return new String[]{"net.minecraft.client.renderer.ActiveRenderInfo"};
- }
-
- @Override
- public void transform(ClassNode classNode, String name) {
- for (MethodNode method : classNode.methods) {
- String methodName = mapMethodName(classNode, method);
-
- if (methodName.equals("updateRenderInfo") || methodName.equals("func_74583_a")) {
- ListIterator<AbstractInsnNode> iterator = method.instructions.iterator();
-
- while (iterator.hasNext()) {
- AbstractInsnNode next = iterator.next();
-
- if(next.getOpcode() == GETFIELD) {
- FieldInsnNode insn = (FieldInsnNode) next;
-
- String ownerName = mapClassName(insn.owner);
- String fieldName = mapFieldNameFromNode(insn);
-
- if(ownerName.equals("net/minecraft/entity/player/EntityPlayer") && insn.desc.equals("F")) {
- InsnList insnList = null;
-
- switch (fieldName) {
- case "rotationPitch":
- case "field_70125_A":
- insnList = insertRotationHook("Pitch");
- break;
- case "rotationYaw":
- case "field_70177_z":
- insnList = insertRotationHook("Yaw");
- break;
- }
-
- if(insnList != null) {
- method.instructions.insertBefore(insn, insnList);
- method.instructions.remove(insn);
- }
- }
- }
- }
- }
- }
- }
-
- private InsnList insertRotationHook(String field) {
- InsnList insnList = new InsnList();
-
- insnList.add(new MethodInsnNode(INVOKESTATIC, HOOK_CLASS, "rotation" + field + "Hook", "(Lnet/minecraft/entity/player/EntityPlayer;)F", false));
-
- return insnList;
- }
-}
diff --git a/src/main/java/me/djtheredstoner/perspectivemod/asm/transformers/EntityRendererTransformer.java b/src/main/java/me/djtheredstoner/perspectivemod/asm/transformers/EntityRendererTransformer.java
deleted file mode 100644
index 3b6a5ae..0000000
--- a/src/main/java/me/djtheredstoner/perspectivemod/asm/transformers/EntityRendererTransformer.java
+++ /dev/null
@@ -1,128 +0,0 @@
-package me.djtheredstoner.perspectivemod.asm.transformers;
-
-import me.djtheredstoner.perspectivemod.asm.ITransformer;
-import org.objectweb.asm.tree.*;
-
-import java.util.Iterator;
-
-import static org.objectweb.asm.Opcodes.*;
-
-/**
- * @see net.minecraft.client.renderer.EntityRenderer
- */
-public class EntityRendererTransformer implements ITransformer {
-
- private static final String HOOK_CLASS = "me/djtheredstoner/perspectivemod/asm/hooks/EntityRendererHook";
-
- @Override
- public String[] getClassName() {
- return new String[]{"net.minecraft.client.renderer.EntityRenderer"};
- }
-
- @Override
- public void transform(ClassNode classNode, String name) {
- for (MethodNode method : classNode.methods) {
- String methodName = mapMethodName(classNode, method);
-
- if (methodName.equals("orientCamera") || methodName.equals("func_78467_g")) {
-
- Iterator<AbstractInsnNode> iterator = method.instructions.iterator();
-
- while (iterator.hasNext()) {
- AbstractInsnNode next = iterator.next();
-
- if(next.getOpcode() == GETFIELD) {
- FieldInsnNode insn = (FieldInsnNode)next;
-
- String ownerName = mapClassName(insn.owner);
- String fieldName = mapFieldNameFromNode(insn);
-
- if(ownerName.equals("net/minecraft/entity/Entity" ) && insn.desc.equals("F")) {
-
- InsnList insnList = null;
-
- switch (fieldName) {
- case "rotationYaw":
- case "field_70177_z":
- insnList = insertRotationHook("rotationYaw");
- break;
- case "prevRotationYaw":
- case "field_70126_B":
- insnList = insertRotationHook("prevRotationYaw");
- break;
- case "rotationPitch":
- case "field_70125_A":
- insnList = insertRotationHook("rotationPitch");
- break;
- case "prevRotationPitch":
- case "field_70127_C":
- insnList = insertRotationHook("prevRotationPitch");
- break;
- }
-
- if(insnList != null) {
- method.instructions.insertBefore(insn, insnList);
- method.instructions.remove(insn);
- }
- }
- } /*else if (next.getOpcode() == DLOAD) {
- VarInsnNode insn = (VarInsnNode) next;
-
- if(insn.getPrevious().getOpcode() == FCONST_0 && insn.getNext().getOpcode() == DNEG) {
- method.instructions.insert(insn, insertDistanceHook());
- }
- }*/
- }
- } else if (methodName.equals("updateCameraAndRender") || methodName.equals("func_181560_a")) {
-
- Iterator<AbstractInsnNode> iterator = method.instructions.iterator();
-
- while (iterator.hasNext()) {
- AbstractInsnNode next = iterator.next();
-
- if(next.getOpcode() == GETFIELD) {
- FieldInsnNode insn = (FieldInsnNode)next;
-
- String ownerName = mapClassName(insn.owner);
- String fieldName = mapFieldNameFromNode(insn);
-
- if(ownerName.equals("net/minecraft/client/Minecraft") && (fieldName.equals("inGameHasFocus") || fieldName.equals("field_71415_G")) && insn.desc.equals("Z")
- && insn.getNext().getNext().getNext().getOpcode() == IFEQ) {
- method.instructions.insertBefore(insn, insertMouseHook());
- method.instructions.remove(insn);
- }
- }
- }
- }
- //Poggers Ultra FPS Praseodymium mode.
- /* else if (methodName.equals("renderWorldPass") || methodName.equals("func_175068_a")) {
-
- method.instructions.insert(method.instructions.getFirst(), new InsnNode(RETURN));
- }*/
- }
- }
-
- private InsnList insertRotationHook(String field) {
- InsnList list = new InsnList();
-
- list.add(new MethodInsnNode(INVOKESTATIC, HOOK_CLASS, field + "Hook", "(Lnet/minecraft/entity/Entity;)F", false));
-
- return list;
- }
-
- private InsnList insertMouseHook() {
- InsnList list = new InsnList();
-
- list.add(new MethodInsnNode(INVOKESTATIC, HOOK_CLASS, "mouseHook", "(Lnet/minecraft/client/Minecraft;)Z", false));
-
- return list;
- }
-
- private InsnList insertDistanceHook() {
- InsnList list = new InsnList();
-
- list.add(new MethodInsnNode(INVOKESTATIC, HOOK_CLASS, "distanceHook", "(D)D", false));
-
- return list;
- }
-}
diff --git a/src/main/java/me/djtheredstoner/perspectivemod/asm/transformers/MinecraftTransformer.java b/src/main/java/me/djtheredstoner/perspectivemod/asm/transformers/MinecraftTransformer.java
deleted file mode 100644
index ca1874b..0000000
--- a/src/main/java/me/djtheredstoner/perspectivemod/asm/transformers/MinecraftTransformer.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package me.djtheredstoner.perspectivemod.asm.transformers;
-
-import me.djtheredstoner.perspectivemod.asm.ITransformer;
-import org.objectweb.asm.tree.*;
-
-import java.util.Iterator;
-
-import static org.objectweb.asm.Opcodes.*;
-
-/**
- * @see net.minecraft.client.Minecraft
- */
-public class MinecraftTransformer implements ITransformer {
-
- private static final String HOOK_CLASS = "me/djtheredstoner/perspectivemod/asm/hooks/MinecraftHook";
-
- @Override
- public String[] getClassName() {
- return new String[]{"net.minecraft.client.Minecraft"};
- }
-
- @Override
- public void transform(ClassNode classNode, String name) {
- for (MethodNode method : classNode.methods) {
- String methodName = mapMethodName(classNode, method);
-
- if (methodName.equals("runTick") || methodName.equals("func_71407_l")) {
- Iterator<AbstractInsnNode> iterator = method.instructions.iterator();
-
- while (iterator.hasNext()) {
- AbstractInsnNode next = iterator.next();
-
- if (next.getOpcode() == PUTFIELD) {
- FieldInsnNode insn = (FieldInsnNode) next;
-
- String ownerName = mapClassName(insn.owner);
- String fieldName = mapFieldNameFromNode(insn);
-
- if (ownerName.equals("net/minecraft/client/settings/GameSettings") &&
- (fieldName.equals("thirdPersonView") || fieldName.equals("field_74320_O")) && insn.desc.equals("I")) {
- method.instructions.insertBefore(insn, insertThirdPersonHook());
- method.instructions.remove(insn);
- }
- }
- }
- }
- }
- }
-
- public InsnList insertThirdPersonHook() {
- InsnList list = new InsnList();
-
- list.add(new MethodInsnNode(INVOKESTATIC, HOOK_CLASS, "thirdPersonHook", "(Lnet/minecraft/client/settings/GameSettings;I)V", false));
-
- return list;
- }
-}
diff --git a/src/main/java/me/djtheredstoner/perspectivemod/asm/transformers/RenderManagerTransformer.java b/src/main/java/me/djtheredstoner/perspectivemod/asm/transformers/RenderManagerTransformer.java
deleted file mode 100644
index e41b81a..0000000
--- a/src/main/java/me/djtheredstoner/perspectivemod/asm/transformers/RenderManagerTransformer.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package me.djtheredstoner.perspectivemod.asm.transformers;
-
-import me.djtheredstoner.perspectivemod.asm.ITransformer;
-import org.objectweb.asm.tree.*;
-
-import java.util.Iterator;
-
-import static org.objectweb.asm.Opcodes.*;
-
-/**
- * @see net.minecraft.client.renderer.entity.RenderManager
- */
-public class RenderManagerTransformer implements ITransformer {
- private static final String HOOK_CLASS = "me/djtheredstoner/perspectivemod/asm/hooks/RenderManagerHook";
-
- @Override
- public String[] getClassName() {
- return new String[]{"net.minecraft.client.renderer.entity.RenderManager"};
- }
-
- @Override
- public void transform(ClassNode classNode, String name) {
- for (MethodNode method : classNode.methods) {
- String methodName = mapMethodName(classNode, method);
-
- if (methodName.equals("cacheActiveRenderInfo") || methodName.equals("func_180597_a")) {
- Iterator<AbstractInsnNode> iterator = method.instructions.iterator();
-
- while (iterator.hasNext()) {
- AbstractInsnNode next = iterator.next();
-
- if (next.getOpcode() == PUTFIELD) {
- FieldInsnNode insn = (FieldInsnNode)next;
-
- String ownerName = mapClassName(insn.owner);
- String fieldName = mapFieldNameFromNode(insn);
-
- if (ownerName.equals("net/minecraft/client/renderer/entity/RenderManager") && insn.desc.equals("F")) {
-
- InsnList insnList = null;
-
- switch (fieldName) {
- case "playerViewX":
- case "field_78732_j":
- insnList = insertRotationHook("playerViewX");
- break;
- case "playerViewY":
- case "field_78735_i":
- insnList = insertRotationHook("playerViewY");
- break;
- }
-
- if(insnList != null) {
- method.instructions.insertBefore(insn, insnList);
- method.instructions.remove(insn);
- }
- }
- }
- }
- }
- }
- }
-
- public InsnList insertRotationHook(String field) {
- InsnList list = new InsnList();
-
- list.add(new MethodInsnNode(INVOKESTATIC, HOOK_CLASS, field + "Hook", "(Lnet/minecraft/client/renderer/entity/RenderManager;F)V", false));
-
- return list;
- }
-}
diff --git a/src/main/java/me/djtheredstoner/perspectivemod/commands/PerspectiveModCommand.java b/src/main/java/me/djtheredstoner/perspectivemod/commands/PerspectiveModCommand.java
deleted file mode 100644
index 00b0d27..0000000
--- a/src/main/java/me/djtheredstoner/perspectivemod/commands/PerspectiveModCommand.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package me.djtheredstoner.perspectivemod.commands;
-
-import gg.essential.api.EssentialAPI;
-import gg.essential.api.commands.Command;
-import gg.essential.api.commands.DefaultHandler;
-import me.djtheredstoner.perspectivemod.PerspectiveMod;
-
-public class PerspectiveModCommand extends Command {
-
- public PerspectiveModCommand(String name) {
- super(name);
- }
-
- @DefaultHandler
- public void handle() {
- EssentialAPI.getGuiUtil().openScreen(PerspectiveMod.instance.config.gui());
- }
-
-}
diff --git a/src/main/java/me/djtheredstoner/perspectivemod/config/PerspectiveModConfig.java b/src/main/java/me/djtheredstoner/perspectivemod/config/PerspectiveModConfig.java
deleted file mode 100644
index dd10623..0000000
--- a/src/main/java/me/djtheredstoner/perspectivemod/config/PerspectiveModConfig.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package me.djtheredstoner.perspectivemod.config;
-
-import gg.essential.vigilance.Vigilant;
-import gg.essential.vigilance.data.Property;
-import gg.essential.vigilance.data.PropertyType;
-
-import java.io.File;
-
-public class PerspectiveModConfig extends Vigilant {
-
- @Property(
- type = PropertyType.SWITCH,
- name = "Perspective Mod",
- category = "General",
- subcategory = "General",
- description = "Toggle Perspective Mod entirely."
- )
- public boolean modEnabled = true;
-
- @Property(
- type = PropertyType.SWITCH,
- name = "Hold Mode",
- category = "General",
- subcategory = "General",
- description = "Return to normal perspective after releasing keybind."
- )
- public boolean holdMode = true;
-
- @Property(
- type = PropertyType.SWITCH,
- name = "Invert Pitch",
- category = "General",
- subcategory = "General",
- description = "Invert the pitch while in perspective (same as blc/lunar)."
- )
- public boolean invertPitch = false;
-
- public PerspectiveModConfig() {
- super(new File("./config/perspectivemodv4.toml"));
- initialize();
- }
-}
diff --git a/src/main/java/me/djtheredstoner/perspectivemod/forge/PerspectiveModTweaker.java b/src/main/java/me/djtheredstoner/perspectivemod/forge/PerspectiveModTweaker.java
deleted file mode 100644
index 695f7a2..0000000
--- a/src/main/java/me/djtheredstoner/perspectivemod/forge/PerspectiveModTweaker.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package me.djtheredstoner.perspectivemod.forge;
-
-import me.djtheredstoner.perspectivemod.asm.ClassTransformer;
-import net.minecraft.launchwrapper.Launch;
-import net.minecraftforge.common.ForgeVersion;
-import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin;
-
-import javax.swing.*;
-import java.io.File;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.Map;
-import java.util.zip.ZipFile;
-
-
-@IFMLLoadingPlugin.MCVersion(ForgeVersion.mcVersion)
-public class PerspectiveModTweaker implements IFMLLoadingPlugin {
-
- public PerspectiveModTweaker() {
- File mods = new File(Launch.minecraftHome, "mods");
-
- if (!mods.exists()) {
- mods.mkdirs(); // mods folder may not exist in dev yet
- }
-
- File[] coreModList = mods.listFiles((dir, name) -> name.endsWith(".jar"));
- for (File file : coreModList) {
- try {
- try (ZipFile zipFile = new ZipFile(file)) {
- if (zipFile.getEntry("net/canelex/perspectivemod/PerspectiveMod.class") != null) {
- halt("<html><p>Perspective Mod v4 is not compatible with Perspective Mod v3 by Canelex. Please remove Canelex's in order to launch the game.</p></html>");
- continue;
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
-
- private void halt(final String message) {
- JOptionPane.showMessageDialog(null, message, "Launch Aborted", JOptionPane.ERROR_MESSAGE);
- try {
- final Class<?> aClass = Class.forName("java.lang.Shutdown");
- final Method exit = aClass.getDeclaredMethod("exit", int.class);
- exit.setAccessible(true);
- exit.invoke(null, 0);
- } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
- e.printStackTrace();
- }
- }
-
- @Override
- public String[] getASMTransformerClass() {
- return new String[]{ClassTransformer.class.getName()};
- }
-
- @Override
- public String getModContainerClass() {
- return null;
- }
-
- @Override
- public String getSetupClass() {
- return null;
- }
-
- @Override
- public void injectData(Map<String, Object> map) {
-
- }
-
- @Override
- public String getAccessTransformerClass() {
- return null;
- }
-}
diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info
deleted file mode 100644
index 5827825..0000000
--- a/src/main/resources/mcmod.info
+++ /dev/null
@@ -1,16 +0,0 @@
-[
-{
- "modid": "djperspectivemod",
- "name": "Perspective Mod v4",
- "description": "",
- "version": "${version}",
- "mcversion": "${mcversion}",
- "url": "",
- "updateUrl": "",
- "authorList": ["DJtheRedstoner"],
- "credits": "",
- "logoFile": "",
- "screenshots": [],
- "dependencies": []
-}
-]