├── .gitattributes
├── .github
└── workflows
│ ├── build-and-test.yml
│ └── release-tags.yml
├── .gitignore
├── .idea
├── codeStyles
│ ├── Project.xml
│ └── codeStyleConfig.xml
└── copyright
│ ├── LGPLv3.xml
│ └── profiles_settings.xml
├── COPYING
├── COPYING.LESSER
├── LICENSE
├── README.MD
├── build.gradle.kts
├── docs
├── 1-disabled.png
├── 1-enabled.png
├── 2-disabled.png
├── 2-enabled.png
├── 3-disabled.png
├── 3-enabled.png
├── logo.png
├── menu-5sec.png
├── menu.png
├── sheep.png
└── timingsmenu.png
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── settings.gradle.kts
└── src
└── main
├── java
└── com
│ └── falsepattern
│ └── laggoggles
│ ├── Main.java
│ ├── api
│ ├── Profiler.java
│ └── event
│ │ └── LagGogglesEvent.java
│ ├── client
│ ├── ClientConfig.java
│ ├── FPSCounter.java
│ ├── MessagePacketHandler.java
│ ├── MinimapRenderer.java
│ ├── OutlineRenderer.java
│ ├── ProfileStatusHandler.java
│ ├── ScanResultHandler.java
│ ├── ServerDataPacketHandler.java
│ └── gui
│ │ ├── ConfigGui.java
│ │ ├── ConfigGuiFactory.java
│ │ ├── FakeIIcon.java
│ │ ├── GuiEntityTypes.java
│ │ ├── GuiEventTypes.java
│ │ ├── GuiFPSResults.java
│ │ ├── GuiProfile.java
│ │ ├── GuiScanResultsWorld.java
│ │ ├── GuiSingleEntities.java
│ │ ├── KeyHandler.java
│ │ ├── LagOverlayGui.java
│ │ ├── QuickText.java
│ │ └── buttons
│ │ ├── DonateButton.java
│ │ ├── DonateButtonSmall.java
│ │ ├── DownloadButton.java
│ │ ├── OptionsButton.java
│ │ ├── ProfileButton.java
│ │ └── SplitButton.java
│ ├── command
│ └── LagGogglesCommand.java
│ ├── mixin
│ ├── mixins
│ │ ├── client
│ │ │ └── vanilla
│ │ │ │ ├── MixinRenderManager.java
│ │ │ │ └── MixinTileEntityRendererDispatcher.java
│ │ └── common
│ │ │ ├── dragonapi
│ │ │ └── MixinBlockTickEvent.java
│ │ │ └── vanilla
│ │ │ ├── MixinASMEventHandler.java
│ │ │ ├── MixinEntity.java
│ │ │ ├── MixinEventBus.java
│ │ │ ├── MixinWorld.java
│ │ │ └── MixinWorldServer.java
│ └── plugin
│ │ ├── Mixin.java
│ │ ├── MixinPlugin.java
│ │ └── TargetedMod.java
│ ├── packet
│ ├── CPacketRequestEntityTeleport.java
│ ├── CPacketRequestResult.java
│ ├── CPacketRequestScan.java
│ ├── CPacketRequestServerData.java
│ ├── CPacketRequestTileEntityTeleport.java
│ ├── ObjectData.java
│ ├── SPacketMessage.java
│ ├── SPacketProfileStatus.java
│ ├── SPacketScanResult.java
│ └── SPacketServerData.java
│ ├── profiler
│ ├── ProfileManager.java
│ ├── ProfileResult.java
│ ├── ScanType.java
│ ├── TickCounter.java
│ └── TimingManager.java
│ ├── proxy
│ ├── ClientProxy.java
│ ├── CommonProxy.java
│ └── ServerProxy.java
│ ├── server
│ ├── RequestDataHandler.java
│ ├── RequestResultHandler.java
│ ├── ScanRequestHandler.java
│ ├── ServerConfig.java
│ ├── TeleportRequestHandler.java
│ └── TeleportToTileEntityRequestHandler.java
│ └── util
│ ├── Calculations.java
│ ├── ClickableLink.java
│ ├── Coder.java
│ ├── ColorBlindMode.java
│ ├── Graphical.java
│ ├── Helpers.java
│ ├── IMixinASMEventHandler.java
│ ├── Perms.java
│ ├── RunInClientThread.java
│ ├── RunInServerThread.java
│ ├── Side.java
│ ├── Teleport.java
│ └── ThreadChecker.java
└── resources
├── META-INF
└── laggoggles_at.cfg
├── assets
└── laggoggles
│ ├── donate.png
│ ├── download.png
│ ├── lang
│ ├── en_US.lang
│ ├── es_ES.lang
│ └── pt_PT.lang
│ └── logo.png
├── mcmod.info
├── mixins.laggoggles.json
├── mixins.preinit.json
└── pack.mcmeta
/.gitattributes:
--------------------------------------------------------------------------------
1 | * text eol=lf
2 |
3 | *.[jJ][aA][rR] binary
4 |
5 | *.[pP][nN][gG] binary
6 | *.[jJ][pP][gG] binary
7 | *.[jJ][pP][eE][gG] binary
8 | *.[gG][iI][fF] binary
9 | *.[tT][iI][fF] binary
10 | *.[tT][iI][fF][fF] binary
11 | *.[iI][cC][oO] binary
12 | *.[sS][vV][gG] text
13 | *.[eE][pP][sS] binary
14 | *.[xX][cC][fF] binary
15 |
16 | *.[kK][aA][rR] binary
17 | *.[mM]4[aA] binary
18 | *.[mM][iI][dD] binary
19 | *.[mM][iI][dD][iI] binary
20 | *.[mM][pP]3 binary
21 | *.[oO][gG][gG] binary
22 | *.[rR][aA] binary
23 |
24 | *.7[zZ] binary
25 | *.[gG][zZ] binary
26 | *.[tT][aA][rR] binary
27 | *.[tT][gG][zZ] binary
28 | *.[zZ][iI][pP] binary
29 |
30 | *.[tT][cC][nN] binary
31 | *.[sS][oO] binary
32 | *.[dD][lL][lL] binary
33 | *.[dD][yY][lL][iI][bB] binary
34 | *.[pP][sS][dD] binary
35 | *.[tT][tT][fF] binary
36 | *.[oO][tT][fF] binary
37 |
38 | *.[pP][aA][tT][cC][hH] -text
39 |
40 | *.[bB][aA][tT] text eol=crlf
41 | *.[cC][mM][dD] text eol=crlf
42 | *.[pP][sS]1 text eol=crlf
43 |
44 | *[aA][uU][tT][oO][gG][eE][nN][eE][rR][aA][tT][eE][dD]* binary
45 |
--------------------------------------------------------------------------------
/.github/workflows/build-and-test.yml:
--------------------------------------------------------------------------------
1 | name: Build and test
2 |
3 | on:
4 | pull_request:
5 | branches:
6 | - master
7 | push:
8 | branches:
9 | - master
10 |
11 | jobs:
12 | build-and-test:
13 | uses: FalsePattern/fpgradle-workflows/.github/workflows/build-and-test.yml@master
14 | with:
15 | timeout: 90
16 | workspace: setupCIWorkspace
17 | client-only: false
18 |
--------------------------------------------------------------------------------
/.github/workflows/release-tags.yml:
--------------------------------------------------------------------------------
1 | name: Release Tags
2 |
3 | on:
4 | push:
5 | tags:
6 | - '*'
7 |
8 | permissions:
9 | contents: write
10 |
11 | jobs:
12 | release-tags:
13 | uses: FalsePattern/fpgradle-workflows/.github/workflows/release-tags.yml@master
14 | with:
15 | workspace: "setupCIWorkspace"
16 | secrets:
17 | MAVEN_DEPLOY_USER: ${{ secrets.MAVEN_DEPLOY_USER }}
18 | MAVEN_DEPLOY_PASSWORD: ${{ secrets.MAVEN_DEPLOY_PASSWORD }}
19 | MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
20 | CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
21 |
22 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Created by https://www.toptal.com/developers/gitignore/api/gradle,forgegradle,kotlin,java,scala,intellij+all
2 | # Edit at https://www.toptal.com/developers/gitignore?templates=gradle,forgegradle,kotlin,java,scala,intellij+all
3 |
4 | ### ForgeGradle ###
5 | # Minecraft client/server files
6 | run/
7 |
8 | ### Intellij+all ###
9 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
10 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
11 |
12 | # User-specific stuff
13 | .idea/**/workspace.xml
14 | .idea/**/tasks.xml
15 | .idea/**/usage.statistics.xml
16 | .idea/**/dictionaries
17 | .idea/**/shelf
18 |
19 | # AWS User-specific
20 | .idea/**/aws.xml
21 |
22 | # Generated files
23 | .idea/**/contentModel.xml
24 |
25 | # Sensitive or high-churn files
26 | .idea/**/dataSources/
27 | .idea/**/dataSources.ids
28 | .idea/**/dataSources.local.xml
29 | .idea/**/sqlDataSources.xml
30 | .idea/**/dynamic.xml
31 | .idea/**/uiDesigner.xml
32 | .idea/**/dbnavigator.xml
33 |
34 | # Gradle
35 | .idea/**/gradle.xml
36 | .idea/**/libraries
37 |
38 | # Gradle and Maven with auto-import
39 | # When using Gradle or Maven with auto-import, you should exclude module files,
40 | # since they will be recreated, and may cause churn. Uncomment if using
41 | # auto-import.
42 | .idea/artifacts
43 | .idea/compiler.xml
44 | .idea/jarRepositories.xml
45 | .idea/modules.xml
46 | .idea/*.iml
47 | .idea/modules
48 | *.iml
49 | *.ipr
50 |
51 | # CMake
52 | cmake-build-*/
53 |
54 | # Mongo Explorer plugin
55 | .idea/**/mongoSettings.xml
56 |
57 | # File-based project format
58 | *.iws
59 |
60 | # IntelliJ
61 | out/
62 |
63 | # mpeltonen/sbt-idea plugin
64 | .idea_modules/
65 |
66 | # JIRA plugin
67 | atlassian-ide-plugin.xml
68 |
69 | # Cursive Clojure plugin
70 | .idea/replstate.xml
71 |
72 | # SonarLint plugin
73 | .idea/sonarlint/
74 |
75 | # Crashlytics plugin (for Android Studio and IntelliJ)
76 | com_crashlytics_export_strings.xml
77 | crashlytics.properties
78 | crashlytics-build.properties
79 | fabric.properties
80 |
81 | # Editor-based Rest Client
82 | .idea/httpRequests
83 |
84 | # Android studio 3.1+ serialized cache file
85 | .idea/caches/build_file_checksums.ser
86 |
87 | ### Intellij+all Patch ###
88 | # Ignore everything but code style settings and run configurations
89 | # that are supposed to be shared within teams.
90 |
91 | .idea/*
92 |
93 | !.idea/codeStyles
94 | !.idea/runConfigurations
95 |
96 | ### Java ###
97 | # Compiled class file
98 | *.class
99 |
100 | # Log file
101 | *.log
102 |
103 | # BlueJ files
104 | *.ctxt
105 |
106 | # Mobile Tools for Java (J2ME)
107 | .mtj.tmp/
108 |
109 | # Package Files #
110 | *.jar
111 | *.war
112 | *.nar
113 | *.ear
114 | *.zip
115 | *.tar.gz
116 | *.rar
117 |
118 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
119 | hs_err_pid*
120 | replay_pid*
121 |
122 | ### Kotlin ###
123 | # Compiled class file
124 |
125 | # Log file
126 |
127 | # BlueJ files
128 |
129 | # Mobile Tools for Java (J2ME)
130 |
131 | # Package Files #
132 |
133 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
134 |
135 | ### Scala ###
136 |
137 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
138 |
139 | ### Gradle ###
140 | .gradle
141 | **/build/
142 | !src/**/build/
143 |
144 | # Ignore Gradle GUI config
145 | gradle-app.setting
146 |
147 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
148 | !gradle-wrapper.jar
149 |
150 | # Avoid ignore Gradle wrappper properties
151 | !gradle-wrapper.properties
152 |
153 | # Cache of project
154 | .gradletasknamecache
155 |
156 | # Eclipse Gradle plugin generated files
157 | # Eclipse Core
158 | .project
159 | # JDT-specific (Eclipse Java Development Tools)
160 | .classpath
161 |
162 | ### Gradle Patch ###
163 | # Java heap dump
164 | *.hprof
165 |
166 | # End of https://www.toptal.com/developers/gitignore/api/gradle,forgegradle,kotlin,java,scala,intellij+all
167 | !.idea/copyright/
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
11 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/.idea/codeStyles/codeStyleConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/.idea/copyright/LGPLv3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | LagGoggles: Legacy
2 |
3 | Copyright (C) 2022-2025 FalsePattern
4 | All Rights Reserved
5 |
6 | The above copyright notice and this permission notice shall be included
7 | in all copies or substantial portions of the Software.
8 |
9 | This program is free software: you can redistribute it and/or modify
10 | it under the terms of the GNU Lesser General Public License as published by
11 | the Free Software Foundation, only version 3 of the License.
12 |
13 | This program is distributed in the hope that it will be useful,
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | GNU Lesser General Public License for more details.
17 |
18 | You should have received a copy of the GNU Lesser General Public License
19 | along with this program. If not, see .
20 |
21 | ------------------------------------------------------------------------------------------------------
22 | The original code was written by TerminatorNL, made for 1.12.2, which was licensed under the GPLv3 license:
23 |
24 | LagGoggles
25 |
26 | Copyright (c) 2020 TerminatorNL
27 |
28 | This program is free software: you can redistribute it and/or modify
29 | it under the terms of the GNU General Public License as published by
30 | the Free Software Foundation, either version 3 of the License, or
31 | (at your option) any later version.
32 |
33 | This program is distributed in the hope that it will be useful,
34 | but WITHOUT ANY WARRANTY; without even the implied warranty of
35 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36 | GNU General Public License for more details.
37 |
38 | You should have received a copy of the GNU General Public License
39 | along with this program. If not, see .
--------------------------------------------------------------------------------
/README.MD:
--------------------------------------------------------------------------------
1 | # LagGoggles Legacy
2 |
3 | 
4 |
5 | A backport of [TerminatorNL](https://github.com/TerminatorNL)'s LagGoggles to 1.7.10.
6 |
7 | ## Dependencies
8 | - [FalsePatternLib](https://github.com/FalsePattern/FalsePatternLib)
9 | - [UniMixins](https://github.com/FalsePattern/UniMixins)
10 |
11 | ## Original description:
12 |
13 | Intuitive lag hunting!
14 |
15 | LagGoggles is a profiler where you can see timings in the world, visually. It comes with a custom GUI using a
16 | configurable keybind.
17 |
18 | You can use LagGoggles as a player too! This is my attempt to create an understanding of what causes lag on a server to regular players.
19 |
20 | I noticed some common misconceptions like having machines spread out over different chunks causes less lag than putting it in one chunk.
21 |
22 | With LagGoggles, you can look around and see that alot of small things like pipes or cables cause a tiny bit of lag most of the time, often resulting in more lag than a machine right next to the source would.
23 |
24 | ## Screenshots
25 |
26 | | LagGoggles enabled | normal view |
27 | | --- | --- |
28 | |  |  |
29 | |  |  |
30 | |  |  |
31 |
32 | 
33 | 
34 | 
35 | 
36 |
37 | ## Video explaining the concept
38 | Massive thanks to [Grok DuckFarmer](https://www.youtube.com/channel/UCoKMLbTK35pzF8Lv_oj3KlA) for making this video.
39 |
40 |
41 | [Minecraft Talk 35 - LagGoggles and Better Server Play](https://youtu.be/2ALrIvw1S4I)
42 |
43 | [](http://www.youtube.com/watch?v=2ALrIvw1S4I)
44 |
45 | ## Features
46 | * Teleporting to sources of lag
47 | * Client GUI, including overlay and clickable menus
48 | * Colour scale for easy spotting of sources of lag.
49 | * Calculations are done on the client, so each client can have a different colour scale.
50 | * Clientside FPS support!
51 | * Checks render time for Entities, Tile entities and event subscribers
52 | * It's very young, but it should give some insight in what may cause FPS issues.
53 | * Config for client:
54 | * Custom gradients
55 | * Colorblindess support
56 | * Config for server
57 | * Custom permissions for players (non-operators)
58 |
59 | ## Configuration
60 | * Drop the jar in the /mods folder
61 | * Serverside configuration is not required and has no effect.
62 | * Clients can edit the config to change the colour scale.
63 |
64 | ## How it works
65 | Entities, blocks and event-subscribers are timed using System.nanotime() before and after the tick() and update() methods. These times are being recorded and sent to the client when the profiler is done.
66 |
67 | ## Benefits
68 | * Visualisation of various sources of lag
69 | * Learn your players to build lag-free bases.
70 |
--------------------------------------------------------------------------------
/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | id("fpgradle-minecraft") version ("0.11.0")
3 | }
4 |
5 | group = "com.falsepattern"
6 |
7 | minecraft_fp {
8 | mod {
9 | modid = "laggoggles"
10 | name = "LagGoggles"
11 | rootPkg = "$group.laggoggles"
12 | }
13 | mixin {
14 | pkg = "mixin.mixins"
15 | pluginClass = "mixin.plugin.MixinPlugin"
16 | }
17 |
18 | core {
19 | accessTransformerFile = "laggoggles_at.cfg"
20 | }
21 |
22 | tokens {
23 | tokenClass = "Tags"
24 | }
25 |
26 | publish {
27 | changelog = "https://github.com/myname/mymod/releases/tag/$version"
28 | maven {
29 | repoUrl = "https://mvn.falsepattern.com/releases"
30 | repoName = "mavenpattern"
31 | }
32 | curseforge {
33 | projectId = "886297"
34 | dependencies {
35 | required("fplib")
36 | }
37 | }
38 | modrinth {
39 | projectId = "yNnilXec"
40 | dependencies {
41 | required("fplib")
42 | }
43 | }
44 | }
45 | }
46 |
47 | repositories {
48 | cursemavenEX()
49 | exclusive(mavenpattern(), "com.falsepattern")
50 | }
51 |
52 | dependencies {
53 | implementation("com.falsepattern:falsepatternlib-mc1.7.10:1.5.9:dev")
54 | compileOnly(deobfCurse("dragonapi-235591:4722480"))
55 | }
56 |
--------------------------------------------------------------------------------
/docs/1-disabled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FalsePattern/LagGogglesLegacy/d57008315911b906100a64ce1a042a9fcab635a2/docs/1-disabled.png
--------------------------------------------------------------------------------
/docs/1-enabled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FalsePattern/LagGogglesLegacy/d57008315911b906100a64ce1a042a9fcab635a2/docs/1-enabled.png
--------------------------------------------------------------------------------
/docs/2-disabled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FalsePattern/LagGogglesLegacy/d57008315911b906100a64ce1a042a9fcab635a2/docs/2-disabled.png
--------------------------------------------------------------------------------
/docs/2-enabled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FalsePattern/LagGogglesLegacy/d57008315911b906100a64ce1a042a9fcab635a2/docs/2-enabled.png
--------------------------------------------------------------------------------
/docs/3-disabled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FalsePattern/LagGogglesLegacy/d57008315911b906100a64ce1a042a9fcab635a2/docs/3-disabled.png
--------------------------------------------------------------------------------
/docs/3-enabled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FalsePattern/LagGogglesLegacy/d57008315911b906100a64ce1a042a9fcab635a2/docs/3-enabled.png
--------------------------------------------------------------------------------
/docs/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FalsePattern/LagGogglesLegacy/d57008315911b906100a64ce1a042a9fcab635a2/docs/logo.png
--------------------------------------------------------------------------------
/docs/menu-5sec.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FalsePattern/LagGogglesLegacy/d57008315911b906100a64ce1a042a9fcab635a2/docs/menu-5sec.png
--------------------------------------------------------------------------------
/docs/menu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FalsePattern/LagGogglesLegacy/d57008315911b906100a64ce1a042a9fcab635a2/docs/menu.png
--------------------------------------------------------------------------------
/docs/sheep.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FalsePattern/LagGogglesLegacy/d57008315911b906100a64ce1a042a9fcab635a2/docs/sheep.png
--------------------------------------------------------------------------------
/docs/timingsmenu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FalsePattern/LagGogglesLegacy/d57008315911b906100a64ce1a042a9fcab635a2/docs/timingsmenu.png
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | #kotlin.stdlib.default.dependency=false
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FalsePattern/LagGogglesLegacy/d57008315911b906100a64ce1a042a9fcab635a2/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 | @rem SPDX-License-Identifier: Apache-2.0
17 | @rem
18 |
19 | @if "%DEBUG%"=="" @echo off
20 | @rem ##########################################################################
21 | @rem
22 | @rem Gradle startup script for Windows
23 | @rem
24 | @rem ##########################################################################
25 |
26 | @rem Set local scope for the variables with windows NT shell
27 | if "%OS%"=="Windows_NT" setlocal
28 |
29 | set DIRNAME=%~dp0
30 | if "%DIRNAME%"=="" set DIRNAME=.
31 | @rem This is normally unused
32 | set APP_BASE_NAME=%~n0
33 | set APP_HOME=%DIRNAME%
34 |
35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
37 |
38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
40 |
41 | @rem Find java.exe
42 | if defined JAVA_HOME goto findJavaFromJavaHome
43 |
44 | set JAVA_EXE=java.exe
45 | %JAVA_EXE% -version >NUL 2>&1
46 | if %ERRORLEVEL% equ 0 goto execute
47 |
48 | echo. 1>&2
49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
50 | echo. 1>&2
51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
52 | echo location of your Java installation. 1>&2
53 |
54 | goto fail
55 |
56 | :findJavaFromJavaHome
57 | set JAVA_HOME=%JAVA_HOME:"=%
58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
59 |
60 | if exist "%JAVA_EXE%" goto execute
61 |
62 | echo. 1>&2
63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
64 | echo. 1>&2
65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
66 | echo location of your Java installation. 1>&2
67 |
68 | goto fail
69 |
70 | :execute
71 | @rem Setup the command line
72 |
73 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
74 |
75 |
76 | @rem Execute Gradle
77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
78 |
79 | :end
80 | @rem End local scope for the variables with windows NT shell
81 | if %ERRORLEVEL% equ 0 goto mainEnd
82 |
83 | :fail
84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
85 | rem the _cmd.exe /c_ return code!
86 | set EXIT_CODE=%ERRORLEVEL%
87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
89 | exit /b %EXIT_CODE%
90 |
91 | :mainEnd
92 | if "%OS%"=="Windows_NT" endlocal
93 |
94 | :omega
95 |
--------------------------------------------------------------------------------
/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | pluginManagement {
2 | repositories {
3 | maven {
4 | url = uri("https://mvn.falsepattern.com/fpgradle/")
5 | name = "fpgradle"
6 | content {
7 | includeModule("com.gtnewhorizons", "retrofuturagradle")
8 | includeModule("com.falsepattern", "fpgradle-plugin")
9 | includeModule("fpgradle-minecraft", "fpgradle-minecraft.gradle.plugin")
10 | }
11 | }
12 | maven {
13 | url = uri("https://mvn.falsepattern.com/releases/")
14 | name = "mavenpattern"
15 | content {
16 | includeGroup("com.falsepattern")
17 | }
18 | }
19 | maven {
20 | url = uri("https://mvn.falsepattern.com/jitpack/")
21 | name = "jitpack"
22 | content {
23 | includeModule("io.github.LegacyModdingMC.MappingGenerator", "MappingGenerator")
24 | }
25 | }
26 | mavenCentral()
27 | gradlePluginPortal()
28 | }
29 | }
30 |
31 | plugins {
32 | id("org.gradle.toolchains.foojay-resolver-convention") version("0.9.0")
33 | }
34 |
35 | rootProject.name = "LagGoggles"
36 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/Main.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles;
24 |
25 | import com.falsepattern.laggoggles.proxy.ClientProxy;
26 | import com.falsepattern.laggoggles.proxy.CommonProxy;
27 | import org.apache.logging.log4j.Logger;
28 |
29 | import cpw.mods.fml.common.Mod;
30 | import cpw.mods.fml.common.Mod.EventHandler;
31 | import cpw.mods.fml.common.SidedProxy;
32 | import cpw.mods.fml.common.event.FMLPostInitializationEvent;
33 | import cpw.mods.fml.common.event.FMLPreInitializationEvent;
34 | import cpw.mods.fml.common.event.FMLServerStartingEvent;
35 | import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
36 |
37 | @Mod(modid = Tags.MOD_ID,
38 | name = Tags.MOD_NAME,
39 | version = Tags.MOD_VERSION,
40 | acceptedMinecraftVersions = "[1.7.10]",
41 | acceptableRemoteVersions = "*",
42 | guiFactory = Tags.ROOT_PKG + ".client.gui.ConfigGuiFactory",
43 | dependencies = "required-after:falsepatternlib@[1.5.9,)")
44 | @IFMLLoadingPlugin.SortingIndex(1001)
45 | public class Main {
46 | public static Logger LOGGER;
47 |
48 | @SidedProxy(
49 | serverSide = Tags.ROOT_PKG + ".proxy.ServerProxy",
50 | clientSide = Tags.ROOT_PKG + ".proxy.ClientProxy"
51 | )
52 | public static CommonProxy proxy;
53 |
54 | @EventHandler
55 | public void preinit(FMLPreInitializationEvent e) {
56 | LOGGER = e.getModLog();
57 | proxy.preinit(e);
58 | Main.LOGGER.info("Registered sided proxy for: " + (proxy instanceof ClientProxy ? "Client" : "Dedicated server"));
59 | }
60 |
61 | @EventHandler
62 | public void postinit(FMLPostInitializationEvent e) {
63 | proxy.postinit(e);
64 | }
65 |
66 | @EventHandler
67 | public void onServerStart(FMLServerStartingEvent e){
68 | proxy.serverStartingEvent(e);
69 | }
70 |
71 | }
72 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/api/Profiler.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.api;
24 |
25 | import com.falsepattern.laggoggles.profiler.ProfileManager;
26 | import com.falsepattern.laggoggles.profiler.ProfileResult;
27 | import com.falsepattern.laggoggles.profiler.ScanType;
28 |
29 | import net.minecraft.command.ICommandSender;
30 |
31 | import javax.annotation.Nullable;
32 |
33 | import static com.falsepattern.laggoggles.profiler.ProfileManager.LAST_PROFILE_RESULT;
34 | import static com.falsepattern.laggoggles.profiler.ProfileManager.PROFILE_ENABLED;
35 |
36 | @SuppressWarnings({"WeakerAccess","unused"})
37 | public class Profiler {
38 |
39 | /**
40 | * Checks if the profiler is already running.
41 | * if this value returns true, you shouldn't start profiling.
42 | */
43 | public static boolean isProfiling(){
44 | return PROFILE_ENABLED.get();
45 | }
46 |
47 | /**
48 | * Checks if you can start the profiler.
49 | * In future updates, complexity may increase.
50 | *
51 | * This method will update accordingly.
52 | */
53 | public static boolean canProfile(){
54 | return PROFILE_ENABLED.get() == false;
55 | }
56 |
57 | /**
58 | * Starts the profiler, and runs it in THIS THREAD!.
59 | * This is a blocking method, and should NEVER EVER EVER
60 | * be ran on a minecraft thread. EVER!!!!
61 | *
62 | * @param seconds how many seconds to profile
63 | * @param type the profiling type, either WORLD or FPS
64 | * @return the result, after the profiler is done.
65 | * @throws IllegalStateException if the profiler is already running, you should use {@link #canProfile()} before doing this
66 | */
67 | public static ProfileResult runProfiler(int seconds, ScanType type, ICommandSender sender) throws IllegalStateException{
68 | return ProfileManager.runProfiler(seconds, type, sender);
69 | }
70 |
71 | /**
72 | * Gets the latest scan result from the profiler. This can be any scan, of any length started by anyone.
73 | *
74 | * @return the last scan result, or null, if no scan is performed yet
75 | */
76 | public static @Nullable ProfileResult getLatestResult(){
77 | return LAST_PROFILE_RESULT.get();
78 | }
79 |
80 | }
81 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/api/event/LagGogglesEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.api.event;
24 |
25 | import com.falsepattern.laggoggles.profiler.ProfileResult;
26 |
27 | import cpw.mods.fml.common.eventhandler.Event;
28 |
29 | public class LagGogglesEvent extends Event {
30 |
31 | private final ProfileResult profileResult;
32 |
33 | /**
34 | * The base event. Use this if you need to catch any profile result.
35 | * @param result The profile result
36 | */
37 | public LagGogglesEvent(ProfileResult result){
38 | this.profileResult = result;
39 | }
40 |
41 | public ProfileResult getProfileResult() {
42 | return profileResult;
43 | }
44 |
45 | /**
46 | * When the client receives a result, this event is created.
47 | * It runs on connection thread, meaning that it
48 | * doesn't run on any of the minecraft threads. (Async)
49 | *
50 | * If you need to perform any action based on this result, make sure
51 | * that you do it in the Minecraft thread, and NOT this one.
52 | *
53 | * Fired on the FMLCommonHandler.instance().bus().
54 | */
55 | public static class ReceivedFromServer extends LagGogglesEvent{
56 | public ReceivedFromServer(ProfileResult result){
57 | super(result);
58 | }
59 | }
60 |
61 | /**
62 | * When the profiler is finished, this event is created.
63 | * It runs on the thread that created the profiler, meaning that it
64 | * doesn't run on any of the minecraft threads. (Async)
65 | *
66 | * If you need to perform any action based on this result, make sure
67 | * that you do it in the Minecraft thread, and NOT this one.
68 | *
69 | * Fired on the FMLCommonHandler.instance().bus().
70 | */
71 | public static class LocalResult extends LagGogglesEvent{
72 | public LocalResult(ProfileResult result){
73 | super(result);
74 | }
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/client/ClientConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.client;
24 |
25 | import com.falsepattern.laggoggles.Tags;
26 | import com.falsepattern.laggoggles.util.ColorBlindMode;
27 | import com.falsepattern.lib.config.Config;
28 | import com.falsepattern.lib.config.ConfigurationManager;
29 |
30 | @Config(modid = Tags.MOD_ID, category = "client")
31 | public class ClientConfig {
32 | @Config.Comment("Define the number of microseconds at which an object is marked with a deep red colour for WORLD lag.")
33 | @Config.LangKey("config.laggoggles.client.gradientworld")
34 | @Config.DefaultInt(25)
35 | @Config.RangeInt(min = 0)
36 | public static int GRADIENT_MAXED_OUT_AT_MICROSECONDS;
37 |
38 | @Config.Comment("Define the number of nanoseconds at which an object is marked with a deep red colour for FPS lag.")
39 | @Config.LangKey("config.laggoggles.client.gradientfps")
40 | @Config.DefaultInt(50000)
41 | @Config.RangeInt(min = 0)
42 | public static int GRADIENT_MAXED_OUT_AT_NANOSECONDS_FPS;
43 |
44 | @Config.Comment("What is the minimum amount of microseconds required before an object is tracked in the client?\n" +
45 | "This is only for WORLD lag.\n" +
46 | "This also affects the analyze results window")
47 | @Config.LangKey("config.laggoggles.client.minmicros")
48 | @Config.DefaultInt(1)
49 | @Config.RangeInt(min = 0)
50 | public static int MINIMUM_AMOUNT_OF_MICROSECONDS_THRESHOLD;
51 |
52 | @Config.Comment("If you're colorblind, change this to fit your needs.")
53 | @Config.LangKey("config.laggoggles.client.colors")
54 | @Config.DefaultEnum("GREEN_TO_RED")
55 | public static ColorBlindMode COLORS;
56 |
57 | static {
58 | ConfigurationManager.selfInit();
59 | }
60 |
61 | //This is here to force the class to load
62 | public static void init() {
63 |
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/client/FPSCounter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.client;
24 |
25 | import net.minecraftforge.client.event.RenderWorldLastEvent;
26 | import net.minecraftforge.common.MinecraftForge;
27 | import cpw.mods.fml.common.eventhandler.SubscribeEvent;
28 |
29 | public class FPSCounter {
30 |
31 | private long frames;
32 |
33 | @SubscribeEvent
34 | public void onDraw(RenderWorldLastEvent event) {
35 | frames++;
36 | }
37 |
38 | public void start(){
39 | frames = 0;
40 | MinecraftForge.EVENT_BUS.register(this);
41 | }
42 |
43 | public long stop(){
44 | MinecraftForge.EVENT_BUS.unregister(this);
45 | return frames;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/client/MessagePacketHandler.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.client;
24 |
25 | import com.falsepattern.laggoggles.Main;
26 | import com.falsepattern.laggoggles.client.gui.GuiProfile;
27 | import com.falsepattern.laggoggles.packet.CPacketRequestServerData;
28 | import com.falsepattern.laggoggles.packet.SPacketMessage;
29 | import com.falsepattern.lib.text.FormattedText;
30 | import lombok.val;
31 |
32 | import net.minecraft.client.Minecraft;
33 | import net.minecraft.util.EnumChatFormatting;
34 | import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
35 | import cpw.mods.fml.common.network.simpleimpl.MessageContext;
36 |
37 | public class MessagePacketHandler implements IMessageHandler {
38 |
39 | @Override
40 | public CPacketRequestServerData onMessage(SPacketMessage msg, MessageContext messageContext) {
41 | GuiProfile.MESSAGE = msg;
42 | GuiProfile.MESSAGE_END_TIME = System.currentTimeMillis() + (msg.seconds * 1000);
43 | GuiProfile.update();
44 | Main.LOGGER.info("message received from server: " + msg.message);
45 | val txt = FormattedText.parse(EnumChatFormatting.RED + msg.message).toChatText();
46 | val gui = Minecraft.getMinecraft().ingameGUI.getChatGUI();
47 | for (val line: txt) {
48 | gui.printChatMessage(line);
49 | }
50 | return new CPacketRequestServerData();
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/client/ProfileStatusHandler.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.client;
24 |
25 | import com.falsepattern.laggoggles.client.gui.GuiProfile;
26 | import com.falsepattern.laggoggles.packet.SPacketProfileStatus;
27 |
28 | import cpw.mods.fml.common.network.simpleimpl.IMessage;
29 | import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
30 | import cpw.mods.fml.common.network.simpleimpl.MessageContext;
31 |
32 | public class ProfileStatusHandler implements IMessageHandler {
33 |
34 | @Override
35 | public IMessage onMessage(SPacketProfileStatus message, MessageContext ctx) {
36 | GuiProfile.PROFILING_PLAYER = message.issuedBy;
37 | if(message.isProfiling == true) {
38 | GuiProfile.PROFILE_END_TIME = System.currentTimeMillis() + (message.length * 1000);
39 | }else{
40 | GuiProfile.PROFILE_END_TIME = System.currentTimeMillis();
41 | }
42 | GuiProfile.update();
43 | return null;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/client/ScanResultHandler.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.client;
24 |
25 | import com.falsepattern.laggoggles.api.event.LagGogglesEvent;
26 | import com.falsepattern.laggoggles.client.gui.GuiProfile;
27 | import com.falsepattern.laggoggles.client.gui.LagOverlayGui;
28 | import com.falsepattern.laggoggles.packet.ObjectData;
29 | import com.falsepattern.laggoggles.packet.SPacketScanResult;
30 | import com.falsepattern.laggoggles.profiler.ProfileResult;
31 | import com.falsepattern.laggoggles.util.Calculations;
32 |
33 | import cpw.mods.fml.common.FMLCommonHandler;
34 | import cpw.mods.fml.common.network.simpleimpl.IMessage;
35 | import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
36 | import cpw.mods.fml.common.network.simpleimpl.MessageContext;
37 |
38 | import java.util.ArrayList;
39 |
40 | import static com.falsepattern.laggoggles.profiler.ProfileManager.LAST_PROFILE_RESULT;
41 |
42 | public class ScanResultHandler implements IMessageHandler {
43 |
44 | private ArrayList builder = new ArrayList<>();
45 |
46 | @Override
47 | public IMessage onMessage(SPacketScanResult message, MessageContext ctx){
48 | final long tickCount = message.tickCount > 0 ? message.tickCount : 1;
49 | for(ObjectData objectData : message.DATA){
50 | if(Calculations.muPerTickCustomTotals(objectData.getValue(ObjectData.Entry.NANOS), tickCount) >= ClientConfig.MINIMUM_AMOUNT_OF_MICROSECONDS_THRESHOLD){
51 | builder.add(objectData);
52 | }
53 | }
54 | if(message.hasMore == false){
55 | ProfileResult result = new ProfileResult(message.startTime, message.endTime, tickCount, message.side, message.type);
56 | result.addAll(builder);
57 | result.lock();
58 | builder = new ArrayList<>();
59 | LAST_PROFILE_RESULT.set(result);
60 | LagOverlayGui.create(result);
61 | LagOverlayGui.show();
62 | GuiProfile.update();
63 | FMLCommonHandler.instance().bus().post(new LagGogglesEvent.ReceivedFromServer(result));
64 | }
65 | return null;
66 | }
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/client/ServerDataPacketHandler.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.client;
24 |
25 | import com.falsepattern.laggoggles.client.gui.GuiProfile;
26 | import com.falsepattern.laggoggles.packet.SPacketServerData;
27 | import com.falsepattern.laggoggles.util.Perms;
28 |
29 | import cpw.mods.fml.common.network.simpleimpl.IMessage;
30 | import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
31 | import cpw.mods.fml.common.network.simpleimpl.MessageContext;
32 |
33 | public class ServerDataPacketHandler implements IMessageHandler {
34 |
35 | public static Perms.Permission PERMISSION = Perms.Permission.NONE;
36 | public static boolean SERVER_HAS_RESULT = false;
37 | public static int MAX_SECONDS = Integer.MAX_VALUE;
38 | public static boolean RECEIVED_RESULT = false;
39 | public static boolean NON_OPS_CAN_SEE_EVENT_SUBSCRIBERS = false;
40 |
41 | @Override
42 | public IMessage onMessage(SPacketServerData msg, MessageContext messageContext) {
43 | SERVER_HAS_RESULT = msg.hasResult;
44 | PERMISSION = msg.permission;
45 | MAX_SECONDS = PERMISSION == Perms.Permission.FULL ? Integer.MAX_VALUE : msg.maxProfileTime;
46 | RECEIVED_RESULT = true;
47 | NON_OPS_CAN_SEE_EVENT_SUBSCRIBERS = msg.canSeeEventSubScribers;
48 | GuiProfile.update();
49 | return null;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/client/gui/ConfigGui.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.client.gui;
24 |
25 | import com.falsepattern.laggoggles.Tags;
26 | import com.falsepattern.laggoggles.client.ClientConfig;
27 | import com.falsepattern.lib.config.ConfigException;
28 | import com.falsepattern.lib.config.SimpleGuiConfig;
29 |
30 | import net.minecraft.client.gui.GuiScreen;
31 |
32 | public class ConfigGui extends SimpleGuiConfig {
33 | public ConfigGui(GuiScreen parentScreen) throws ConfigException {
34 | super(parentScreen, Tags.MOD_ID, Tags.MOD_NAME, ClientConfig.class);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/client/gui/ConfigGuiFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.client.gui;
24 |
25 | import com.falsepattern.lib.config.SimpleGuiFactory;
26 |
27 | import net.minecraft.client.gui.GuiScreen;
28 |
29 | public class ConfigGuiFactory implements SimpleGuiFactory {
30 | @Override
31 | public Class extends GuiScreen> mainConfigGuiClass() {
32 | return ConfigGui.class;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/client/gui/FakeIIcon.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.client.gui;
24 |
25 | import lombok.RequiredArgsConstructor;
26 |
27 | import net.minecraft.util.IIcon;
28 |
29 | @RequiredArgsConstructor
30 | public final class FakeIIcon implements IIcon {
31 | private final int w;
32 | private final int h;
33 |
34 | @Override
35 | public int getIconWidth() {
36 | return w;
37 | }
38 |
39 | @Override
40 | public int getIconHeight() {
41 | return h;
42 | }
43 |
44 | @Override
45 | public float getMinU() {
46 | return 0;
47 | }
48 |
49 | @Override
50 | public float getMaxU() {
51 | return 1;
52 | }
53 |
54 | @Override
55 | public float getInterpolatedU(double p_94214_1_) {
56 | return lerp(getMinU(), getMaxU(), p_94214_1_);
57 | }
58 |
59 | @Override
60 | public float getMinV() {
61 | return 0;
62 | }
63 |
64 | @Override
65 | public float getMaxV() {
66 | return 1;
67 | }
68 |
69 | @Override
70 | public float getInterpolatedV(double p_94207_1_) {
71 | return lerp(getMinV(), getMaxV(), p_94207_1_);
72 | }
73 |
74 | private static float lerp(float a, float b, double lerp) {
75 | lerp = Math.min(Math.max(lerp, 0d), 16d) / 16d;
76 | return (float) (a * (1d - lerp) + b * (lerp));
77 | }
78 |
79 | @Override
80 | public String getIconName() {
81 | return "fake";
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/client/gui/GuiFPSResults.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.client.gui;
24 |
25 | import com.falsepattern.laggoggles.Tags;
26 | import com.falsepattern.laggoggles.profiler.ProfileResult;
27 |
28 | import net.minecraft.client.Minecraft;
29 | import net.minecraft.client.gui.FontRenderer;
30 | import net.minecraft.client.gui.GuiScreen;
31 | import net.minecraft.client.resources.I18n;
32 |
33 | public class GuiFPSResults extends GuiScreen{
34 |
35 | private final ProfileResult result;
36 | private final FontRenderer FONTRENDERER;
37 |
38 | private GuiEntityTypes guiEntityTypes;
39 | private GuiSingleEntities guiSingleEntities;
40 | private GuiEventTypes guiEventTypes;
41 |
42 | public GuiFPSResults(ProfileResult result){
43 | super();
44 | this.result = result;
45 | FONTRENDERER = Minecraft.getMinecraft().fontRenderer;
46 | }
47 |
48 | @Override
49 | public void initGui() {
50 | super.initGui();
51 |
52 | /* width , height , top , bottom , left , screenWidth, screenHeight, ProfileResult*/
53 | guiSingleEntities = new GuiSingleEntities(mc, width/2, height - 25 , 45 , height , 0 , result);
54 | guiEntityTypes = new GuiEntityTypes( mc, width/2, (height - 25)/2 , 45 , (height - 25)/2, width/2 , result);
55 | guiEventTypes = new GuiEventTypes( mc, width/2, (height - 25)/2 - 12, ((height - 25)/2) + 12, height , width/2 , result);
56 | }
57 |
58 |
59 | @Override
60 | public void drawScreen(int mouseX, int mouseY, float partialTicks){
61 | super.drawBackground(0);
62 | super.drawScreen(mouseX, mouseY, partialTicks);
63 | guiSingleEntities.drawScreen(mouseX, mouseY, partialTicks);
64 | guiEntityTypes.drawScreen(mouseX, mouseY, partialTicks);
65 | guiEventTypes.drawScreen(mouseX, mouseY, partialTicks);
66 | drawString(Tags.MOD_NAME + ": " + I18n.format("gui.laggoggles.text.fpsresults.titledescription"), 5, 5, 0xFFFFFF);
67 | drawString(I18n.format("gui.laggoggles.text.fpsresults.present"), 5, 15, 0xCCCCCC);
68 | drawString(I18n.format("gui.laggoggles.text.results.singleentities"), 5, 35, 0xFFFFFF);
69 | drawString(" (" + I18n.format("gui.laggoggles.text.results.teleport") + ")", 5 + FONTRENDERER.getStringWidth(I18n.format("gui.laggoggles.text.results.singleentities")), 35, 0x666666);
70 | drawString(I18n.format("gui.laggoggles.text.results.entitiesbytype"), width/2 + 5, 35, 0xFFFFFF);
71 | drawString(I18n.format("gui.laggoggles.text.results.eventsub"), width/2 + 5, ((height - 25)/2) + 2, 0xFFFFFF);
72 | }
73 |
74 | private void drawString(String text, int x, int y, int color) {
75 | FONTRENDERER.drawStringWithShadow(text, x, y, color);
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/client/gui/GuiScanResultsWorld.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.client.gui;
24 |
25 | import com.falsepattern.laggoggles.Tags;
26 | import com.falsepattern.laggoggles.packet.ObjectData;
27 | import com.falsepattern.laggoggles.profiler.ProfileResult;
28 |
29 | import net.minecraft.client.Minecraft;
30 | import net.minecraft.client.gui.FontRenderer;
31 | import net.minecraft.client.gui.GuiScreen;
32 | import net.minecraft.client.resources.I18n;
33 |
34 | import java.util.TreeMap;
35 |
36 | public class GuiScanResultsWorld extends GuiScreen {
37 |
38 | private final FontRenderer FONTRENDERER;
39 | public final TreeMap DATA_ID_TO_SOURCE = new TreeMap<>();
40 | public final TreeMap DATA_SOURCE_TO_ID = new TreeMap<>();
41 |
42 | private GuiSingleEntities guiSingleEntities;
43 | private GuiEntityTypes guiEntityTypes;
44 | private GuiEventTypes guiEventTypes;
45 |
46 | private ProfileResult result;
47 |
48 | public GuiScanResultsWorld(ProfileResult result){
49 | super();
50 | FONTRENDERER = Minecraft.getMinecraft().fontRenderer;
51 | this.result = result;
52 | }
53 |
54 | @Override
55 | public void initGui() {
56 | super.initGui();
57 |
58 | /* width , height , top , bottom , left , screenWidth, screenHeight, ProfileResult*/
59 | guiSingleEntities = new GuiSingleEntities(mc, width/2, height - 25 , 45 , height , 0, result);
60 | guiEntityTypes = new GuiEntityTypes( mc, width/2, (height - 25)/2 , 45 , (height - 25)/2, width/2, result);
61 | guiEventTypes = new GuiEventTypes( mc, width/2, (height - 25)/2 - 12, ((height - 25)/2) + 12, height , width/2, result);
62 | }
63 |
64 | @Override
65 | public void drawScreen(int mouseX, int mouseY, float partialTicks){
66 | super.drawBackground(0);
67 | super.drawScreen(mouseX, mouseY, partialTicks);
68 | guiSingleEntities.drawScreen(mouseX, mouseY, partialTicks);
69 | guiEntityTypes.drawScreen(mouseX, mouseY, partialTicks);
70 | guiEventTypes.drawScreen(mouseX, mouseY, partialTicks);
71 | drawString(Tags.MOD_NAME + ": " + I18n.format("gui.laggoggles.text.worldresults.titledescription"), 5, 5, 0xFFFFFF);
72 | drawString(I18n.format("gui.laggoggles.text.worldresults.present"), 5, 15, 0xCCCCCC);
73 | drawString(I18n.format("gui.laggoggles.text.results.singleentities"), 5, 35, 0xFFFFFF);
74 | drawString(" (" + I18n.format("gui.laggoggles.text.results.teleport") + ")", 5 + FONTRENDERER.getStringWidth(I18n.format("gui.laggoggles.text.results.singleentities")), 35, 0x666666);
75 | drawString(I18n.format("gui.laggoggles.text.results.entitiesbytype"), width/2 + 5, 35, 0xFFFFFF);
76 | drawString(I18n.format("gui.laggoggles.text.results.eventsub"), width/2 + 5, ((height - 25)/2) + 2, 0xFFFFFF);
77 | }
78 |
79 |
80 | @Override
81 | public boolean doesGuiPauseGame(){
82 | return false;
83 | }
84 |
85 | private void drawString(String text, int x, int y, int color) {
86 | FONTRENDERER.drawStringWithShadow(text, x, y, color);
87 | }
88 |
89 |
90 | /* LAGSOURCE */
91 | public static class LagSource implements Comparable{
92 |
93 | public final long nanos;
94 | public final ObjectData data;
95 |
96 | public LagSource(long nanos, ObjectData e){
97 | this.nanos = nanos;
98 | data = e;
99 | }
100 |
101 | @Override
102 | public int compareTo(LagSource other) {
103 | boolean thisIsBigger = this.nanos > other.nanos;
104 | if(thisIsBigger) {
105 | return -1;
106 | }
107 | boolean thisIsSmaller= this.nanos < other.nanos;
108 | if(thisIsSmaller){
109 | return 1;
110 | }else{
111 | return 0;
112 | }
113 | }
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/client/gui/KeyHandler.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.client.gui;
24 |
25 | import net.minecraft.client.settings.KeyBinding;
26 | import cpw.mods.fml.common.FMLCommonHandler;
27 | import cpw.mods.fml.common.eventhandler.SubscribeEvent;
28 | import cpw.mods.fml.common.gameevent.InputEvent;
29 |
30 | public class KeyHandler extends KeyBinding {
31 |
32 | private final CallBack callBack;
33 |
34 | public KeyHandler(String description, int keyCode, String category, CallBack callback) {
35 | super(description, keyCode, category);
36 | this.callBack = callback;
37 | FMLCommonHandler.instance().bus().register(this);
38 | }
39 |
40 | @SubscribeEvent
41 | public void onKeyInput(InputEvent.KeyInputEvent event) {
42 | if(this.isPressed()){
43 | callBack.onPress();
44 | }
45 | }
46 |
47 | public interface CallBack{
48 | void onPress();
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/client/gui/QuickText.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.client.gui;
24 |
25 | import net.minecraft.client.Minecraft;
26 | import net.minecraft.client.gui.FontRenderer;
27 | import net.minecraftforge.client.event.RenderGameOverlayEvent;
28 | import net.minecraftforge.common.MinecraftForge;
29 | import cpw.mods.fml.common.eventhandler.SubscribeEvent;
30 |
31 | public class QuickText {
32 |
33 | private final FontRenderer renderer;
34 | private final String text;
35 |
36 | public QuickText(String text){
37 | this.renderer = Minecraft.getMinecraft().fontRenderer;
38 | this.text = text;
39 | }
40 |
41 | @SubscribeEvent
42 | public void onDraw(RenderGameOverlayEvent.Post event){
43 | renderer.drawStringWithShadow(text, event.resolution.getScaledWidth()/2 - renderer.getStringWidth(text) / 2, 5, 0xFFFFFF);
44 | }
45 |
46 | public void show(){
47 | MinecraftForge.EVENT_BUS.register(this);
48 | }
49 |
50 | public void hide(){
51 | MinecraftForge.EVENT_BUS.unregister(this);
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/client/gui/buttons/DonateButton.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.client.gui.buttons;
24 |
25 | import com.falsepattern.laggoggles.Tags;
26 | import com.falsepattern.laggoggles.client.gui.FakeIIcon;
27 | import com.falsepattern.laggoggles.client.gui.GuiProfile;
28 |
29 | import net.minecraft.client.Minecraft;
30 | import net.minecraft.client.resources.I18n;
31 | import net.minecraft.util.IIcon;
32 | import net.minecraft.util.ResourceLocation;
33 |
34 | public class DonateButton extends SplitButton {
35 |
36 | private ResourceLocation DONATE_TEXTURE = new ResourceLocation(Tags.MOD_ID, "donate.png");
37 | private static final IIcon icon = new FakeIIcon(14, 14);
38 |
39 | public DonateButton(int buttonId, int x, int y) {
40 | super(buttonId, x, y, 200, 20, I18n.format("gui.laggoggles.button.donate.name"),
41 | "Terminator_NL", "FalsePattern", DonateButtonSmall::new);
42 | }
43 |
44 | @Override
45 | public void drawButton(Minecraft mc, int mouseX, int mouseY) {
46 | super.drawButton(mc, mouseX, mouseY);
47 | mc.getTextureManager().bindTexture(DONATE_TEXTURE);
48 | drawTexturedModelRectFromIcon(xPosition + 3, yPosition + 3, icon, 14, 14);
49 | }
50 |
51 | @Override
52 | public void onRightButton(GuiProfile parent) {
53 | rightButton.donate();
54 | }
55 |
56 | @Override
57 | public void onLeftButton(GuiProfile parent) {
58 | leftButton.donate();
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/client/gui/buttons/DonateButtonSmall.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.client.gui.buttons;
24 |
25 | import com.falsepattern.laggoggles.Main;
26 | import com.falsepattern.laggoggles.client.gui.FakeIIcon;
27 |
28 | import net.minecraft.client.gui.GuiButton;
29 | import net.minecraft.util.IIcon;
30 |
31 | import java.awt.Desktop;
32 | import java.net.URI;
33 | import java.net.URISyntaxException;
34 |
35 | public class DonateButtonSmall extends GuiButton {
36 |
37 | private static final URI DONATE_URL_TERMINATOR_NL;
38 | private static final URI DONATE_URL_FALSEPATTERN;
39 | static {
40 | try {
41 | DONATE_URL_TERMINATOR_NL = new URI("https://www.paypal.com/cgi-bin/webscr?return=https://minecraft.curseforge.com/projects/laggoggles?gameCategorySlug=mc-mods&projectID=283525&cn=Add+special+instructions+to+the+addon+author()&business=leon.philips12%40gmail.com&bn=PP-DonationsBF:btn_donateCC_LG.gif:NonHosted&cancel_return=https://minecraft.curseforge.com/projects/laggoggles?gameCategorySlug=mc-mods&projectID=283525&lc=US&item_name=LagGoggles+(from+curseforge.com)&cmd=_donations&rm=1&no_shipping=1¤cy_code=USD");
42 | DONATE_URL_FALSEPATTERN = new URI("https://ko-fi.com/falsepattern");
43 | } catch (URISyntaxException e) {
44 | throw new RuntimeException(e);
45 | }
46 | }
47 |
48 | private static final IIcon icon = new FakeIIcon(14, 14);
49 | private final URI uri;
50 | public DonateButtonSmall(int id, int x, int y, int w, int h, String text) {
51 | super(id, x, y, w, h, text);
52 | if (text.equals("FalsePattern")) {
53 | uri = DONATE_URL_FALSEPATTERN;
54 | } else {
55 | uri = DONATE_URL_TERMINATOR_NL;
56 | }
57 | }
58 |
59 | public void donate() {
60 | Main.LOGGER.info("Attempting to open link in browser: " + uri);
61 | try {
62 | if(Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
63 | Desktop.getDesktop().browse(uri);
64 | }else {
65 | Main.LOGGER.info("Attempting xdg-open...");
66 | Runtime.getRuntime().exec("xdg-open " + uri);
67 | }
68 | }catch (Throwable e){
69 | e.printStackTrace();
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/client/gui/buttons/DownloadButton.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.client.gui.buttons;
24 |
25 | import com.falsepattern.laggoggles.Tags;
26 | import com.falsepattern.laggoggles.client.gui.FakeIIcon;
27 | import com.falsepattern.laggoggles.util.Perms;
28 | import com.falsepattern.lib.text.FormattedText;
29 |
30 | import net.minecraft.client.Minecraft;
31 | import net.minecraft.client.gui.GuiButton;
32 | import net.minecraft.client.gui.GuiScreen;
33 | import net.minecraft.client.resources.I18n;
34 | import net.minecraft.util.EnumChatFormatting;
35 | import net.minecraft.util.IIcon;
36 | import net.minecraft.util.ResourceLocation;
37 |
38 | import java.util.ArrayList;
39 |
40 | import static com.falsepattern.laggoggles.client.ServerDataPacketHandler.PERMISSION;
41 | import static com.falsepattern.laggoggles.client.gui.GuiProfile.getSecondsLeftForMessage;
42 |
43 | public class DownloadButton extends GuiButton{
44 |
45 | private ResourceLocation DOWNLOAD_TEXTURE = new ResourceLocation(Tags.MOD_ID, "download.png");
46 | private static final IIcon icon = new FakeIIcon(14, 14);
47 | private final GuiScreen parent;
48 |
49 | public DownloadButton(GuiScreen parent, int buttonId, int x, int y) {
50 | super(buttonId, x, y, 20, 20, "");
51 | this.parent = parent;
52 | }
53 |
54 | @Override
55 | public void drawButton(Minecraft mc, int mouseX, int mouseY) {
56 | super.drawButton(mc, mouseX, mouseY);
57 | mc.getTextureManager().bindTexture(DOWNLOAD_TEXTURE);
58 | drawTexturedModelRectFromIcon(xPosition + 3, yPosition + 3, icon, 14, 14);
59 | if (this.mousePressed(mc, mouseX, mouseY)) {
60 | ArrayList hover = new ArrayList<>();
61 | hover.add(I18n.format("gui.laggoggles.button.download.hover", '\n'));
62 | if(PERMISSION != Perms.Permission.FULL) {
63 | hover.add("");
64 | hover.add(I18n.format("gui.laggoggles.button.download.hover.notop", '\n'));
65 |
66 | if(getSecondsLeftForMessage() >= 0){
67 | hover.add("");
68 | hover.add(EnumChatFormatting.GRAY + I18n.format("gui.laggoggles.button.download.hover.cooldown", '\n'));
69 | }
70 | }
71 | FormattedText.parse(String.join("\n", hover)).drawWithShadow(mc.fontRenderer, mouseX, mouseY);
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/client/gui/buttons/OptionsButton.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.client.gui.buttons;
24 |
25 | import net.minecraft.client.gui.GuiButton;
26 | import net.minecraft.client.resources.I18n;
27 |
28 | public class OptionsButton extends GuiButton {
29 |
30 | public OptionsButton(int buttonId, int x, int y) {
31 | super(buttonId, x, y, 200, 20, I18n.format("gui.laggoggles.button.options.name"));
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/client/gui/buttons/ProfileButton.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.client.gui.buttons;
24 |
25 | import com.falsepattern.laggoggles.Main;
26 | import com.falsepattern.laggoggles.api.Profiler;
27 | import com.falsepattern.laggoggles.client.ServerDataPacketHandler;
28 | import com.falsepattern.laggoggles.client.gui.GuiProfile;
29 | import com.falsepattern.laggoggles.client.gui.LagOverlayGui;
30 | import com.falsepattern.laggoggles.client.gui.QuickText;
31 | import com.falsepattern.laggoggles.profiler.ProfileResult;
32 | import com.falsepattern.laggoggles.profiler.ScanType;
33 | import com.falsepattern.laggoggles.util.Perms;
34 |
35 | import net.minecraft.client.Minecraft;
36 | import net.minecraft.client.gui.GuiButton;
37 | import net.minecraft.client.resources.I18n;
38 |
39 | public class ProfileButton extends SplitButton {
40 |
41 | public static Thread PROFILING_THREAD;
42 | private long frames = 0;
43 | public ProfileButton(int buttonId, int x, int y, String text) {
44 | super(buttonId, x, y, 170, 20, text,
45 | I18n.format("gui.laggoggles.button.profile.fps.name"),
46 | I18n.format("gui.laggoggles.button.profile.world.name"),
47 | GuiButton::new);
48 | }
49 |
50 | @Override
51 | public void onRightButton(GuiProfile parent) {
52 | parent.startProfile();
53 | }
54 |
55 | @Override
56 | public void updateButtons(){
57 | if(ServerDataPacketHandler.PERMISSION.ordinal() < Perms.Permission.START.ordinal()) {
58 | rightButton.enabled = false;
59 | rightButton.displayString = I18n.format("gui.laggoggles.button.profile.server.noperms");
60 | }
61 | }
62 |
63 | @Override
64 | public void onLeftButton(GuiProfile parent) {
65 | final int seconds = parent.seconds;
66 | if(PROFILING_THREAD == null || PROFILING_THREAD.isAlive() == false){
67 | PROFILING_THREAD = new Thread(new Runnable() {
68 | @Override
69 | public void run() {
70 | Main.LOGGER.info("Clientside profiling started. (" + seconds + " seconds)");
71 | QuickText text = new QuickText(I18n.format("gui.laggoggles.text.fpswarning"));
72 | GuiProfile.PROFILING_PLAYER = Minecraft.getMinecraft().thePlayer.getPersistentID().toString();
73 | GuiProfile.PROFILE_END_TIME = System.currentTimeMillis() + (seconds * 1000L);
74 | GuiProfile.update();
75 | text.show();
76 | ProfileResult result = Profiler.runProfiler(seconds, ScanType.FPS, Minecraft.getMinecraft().thePlayer);
77 | text.hide();
78 | Main.LOGGER.info("Clientside profiling done.");
79 | LagOverlayGui.create(result);
80 | LagOverlayGui.show();
81 | GuiProfile.update();
82 | }
83 | });
84 | PROFILING_THREAD.start();
85 | }
86 | }
87 |
88 | }
89 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/client/gui/buttons/SplitButton.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.client.gui.buttons;
24 |
25 | import com.falsepattern.laggoggles.client.gui.GuiProfile;
26 | import com.falsepattern.laggoggles.client.gui.LagOverlayGui;
27 |
28 | import net.minecraft.client.gui.GuiButton;
29 |
30 | import java.util.List;
31 |
32 | import static com.falsepattern.laggoggles.client.gui.buttons.SplitButton.State.NORMAL;
33 | import static com.falsepattern.laggoggles.client.gui.buttons.SplitButton.State.SPLIT;
34 |
35 | public abstract class SplitButton extends GuiButton {
36 |
37 | State state = NORMAL;
38 | long lastClick = 0;
39 | enum State{
40 | NORMAL,
41 | SPLIT,
42 | }
43 |
44 | protected final T leftButton;
45 | protected final T rightButton;
46 |
47 | public SplitButton(int buttonId, int x, int y, int widthIn, int heightIn, String buttonText, String leftButtonText, String rightButtonText, GuiButtonConstructor subButtonConstructor) {
48 | super(buttonId, x, y, widthIn, heightIn, buttonText);
49 | leftButton = subButtonConstructor.construct(id, x, y, width / 2 - 5, height, leftButtonText);
50 | rightButton = subButtonConstructor.construct(id, x + width / 2 + 5, y, width / 2 - 5, height, rightButtonText);
51 | }
52 |
53 | public interface GuiButtonConstructor {
54 | T construct(int id, int x, int y, int w, int h, String text);
55 | }
56 |
57 |
58 | public void click(GuiProfile parent, List buttonList, int x, int y){
59 | if(lastClick + 50 > System.currentTimeMillis()){
60 | return;
61 | }
62 | lastClick = System.currentTimeMillis();
63 | updateButtons();
64 | if(state == NORMAL) {
65 | state = SPLIT;
66 | buttonList.remove(this);
67 | buttonList.add(leftButton);
68 | buttonList.add(rightButton);
69 | }else if(state == SPLIT){
70 | LagOverlayGui.hide();
71 | buttonList.add(this);
72 | buttonList.remove(leftButton);
73 | buttonList.remove(rightButton);
74 | if (rightButton.mousePressed(parent.mc, x, y)) {
75 | onRightButton(parent);
76 | } else if (leftButton.mousePressed(parent.mc, x, y)) {
77 | onLeftButton(parent);
78 | }
79 | state = NORMAL;
80 | }
81 | }
82 |
83 | public void updateButtons(){};
84 |
85 | public abstract void onRightButton(GuiProfile parent);
86 | public abstract void onLeftButton(GuiProfile parent);
87 | }
88 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/mixin/mixins/client/vanilla/MixinRenderManager.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.mixin.mixins.client.vanilla;
24 |
25 | import org.spongepowered.asm.mixin.Mixin;
26 | import org.spongepowered.asm.mixin.injection.At;
27 | import org.spongepowered.asm.mixin.injection.Inject;
28 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
29 |
30 | import net.minecraft.client.renderer.entity.RenderManager;
31 | import net.minecraft.entity.Entity;
32 | import cpw.mods.fml.relauncher.Side;
33 | import cpw.mods.fml.relauncher.SideOnly;
34 |
35 | import static com.falsepattern.laggoggles.profiler.ProfileManager.PROFILE_ENABLED;
36 | import static com.falsepattern.laggoggles.profiler.ProfileManager.timingManager;
37 |
38 | @Mixin(RenderManager.class)
39 | @SideOnly(Side.CLIENT)
40 | public class MixinRenderManager {
41 | private Long LAGGOGGLES_START = null;
42 |
43 | @Inject(method = "func_147939_a",
44 | at = @At("HEAD"),
45 | require = 1)
46 | public void beforeRender(Entity entityIn, double x, double y, double z, float yaw, float partialTicks, boolean p_188391_10_, CallbackInfoReturnable cir){
47 | LAGGOGGLES_START = System.nanoTime();
48 | }
49 |
50 | @Inject(method = "func_147939_a",
51 | at = @At("RETURN"),
52 | require = 1)
53 | public void afterRender(Entity entityIn, double x, double y, double z, float yaw, float partialTicks, boolean p_188391_10_, CallbackInfoReturnable cir){
54 | if(PROFILE_ENABLED.get() && LAGGOGGLES_START != null){
55 | long end = System.nanoTime();
56 | timingManager.addGuiEntityTime(entityIn.getPersistentID(), end - LAGGOGGLES_START);
57 | LAGGOGGLES_START = null;
58 | }
59 | }
60 |
61 |
62 | }
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/mixin/mixins/client/vanilla/MixinTileEntityRendererDispatcher.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.mixin.mixins.client.vanilla;
24 |
25 | import com.falsepattern.lib.compat.BlockPos;
26 | import org.spongepowered.asm.mixin.Mixin;
27 | import org.spongepowered.asm.mixin.injection.At;
28 | import org.spongepowered.asm.mixin.injection.Inject;
29 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
30 |
31 | import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
32 | import net.minecraft.tileentity.TileEntity;
33 | import cpw.mods.fml.relauncher.Side;
34 | import cpw.mods.fml.relauncher.SideOnly;
35 |
36 | import static com.falsepattern.laggoggles.profiler.ProfileManager.PROFILE_ENABLED;
37 | import static com.falsepattern.laggoggles.profiler.ProfileManager.timingManager;
38 |
39 | @Mixin(TileEntityRendererDispatcher.class)
40 | @SideOnly(Side.CLIENT)
41 | public class MixinTileEntityRendererDispatcher {
42 |
43 | private Long LAGGOGGLES_START = null;
44 |
45 | @Inject(method = "renderTileEntityAt",
46 | at = @At("HEAD"),
47 | require = 1)
48 | public void beforeRender(TileEntity tileEntityIn, double x, double y, double z, float partialTicks, CallbackInfo info){
49 | LAGGOGGLES_START = System.nanoTime();
50 | }
51 |
52 | @Inject(method = "renderTileEntityAt",
53 | at = @At("HEAD"),
54 | require = 1)
55 | public void afterRender(TileEntity tileEntityIn, double x, double y, double z, float partialTicks, CallbackInfo info){
56 | if(PROFILE_ENABLED.get() && LAGGOGGLES_START != null){
57 | long end = System.nanoTime();
58 | timingManager.addGuiBlockTime(new BlockPos(tileEntityIn.xCoord, tileEntityIn.yCoord, tileEntityIn.zCoord), end - LAGGOGGLES_START);
59 | LAGGOGGLES_START = null;
60 | }
61 | }
62 | }
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/mixin/mixins/common/dragonapi/MixinBlockTickEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.mixin.mixins.common.dragonapi;
24 |
25 | import Reika.DragonAPI.Instantiable.Event.BlockTickEvent;
26 | import com.falsepattern.laggoggles.util.Helpers;
27 | import org.spongepowered.asm.mixin.Mixin;
28 | import org.spongepowered.asm.mixin.injection.At;
29 | import org.spongepowered.asm.mixin.injection.Redirect;
30 |
31 | import net.minecraft.block.Block;
32 | import net.minecraft.world.World;
33 |
34 | import java.util.Random;
35 |
36 | @Mixin(value = BlockTickEvent.class,
37 | remap = false)
38 | public abstract class MixinBlockTickEvent {
39 | @Redirect(method = "fire(Lnet/minecraft/block/Block;Lnet/minecraft/world/World;IIILjava/util/Random;I)V",
40 | at = @At(value = "INVOKE",
41 | target = "Lnet/minecraft/block/Block;updateTick(Lnet/minecraft/world/World;IIILjava/util/Random;)V",
42 | remap = true),
43 | require = 1)
44 | private static void measureBlockUpdateTick(Block instance, World world, int x, int y, int z, Random rng) {
45 | Helpers.measureBlockUpdateTick_server(instance, world, x, y, z, rng);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/mixin/mixins/common/vanilla/MixinASMEventHandler.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.mixin.mixins.common.vanilla;
24 |
25 | import com.falsepattern.laggoggles.util.IMixinASMEventHandler;
26 | import org.spongepowered.asm.mixin.Mixin;
27 | import org.spongepowered.asm.mixin.Shadow;
28 |
29 | import cpw.mods.fml.common.ModContainer;
30 | import cpw.mods.fml.common.eventhandler.ASMEventHandler;
31 |
32 | @Mixin(ASMEventHandler.class)
33 | public abstract class MixinASMEventHandler implements IMixinASMEventHandler {
34 | @Shadow private ModContainer owner;
35 |
36 | @Override
37 | public ModContainer getOwner() {
38 | return owner;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/mixin/mixins/common/vanilla/MixinEntity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.mixin.mixins.common.vanilla;
24 |
25 | import org.spongepowered.asm.mixin.Mixin;
26 | import org.spongepowered.asm.mixin.Shadow;
27 | import org.spongepowered.asm.mixin.injection.At;
28 | import org.spongepowered.asm.mixin.injection.Inject;
29 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
30 |
31 | import net.minecraft.entity.Entity;
32 |
33 | import java.util.UUID;
34 |
35 | import static com.falsepattern.laggoggles.profiler.ProfileManager.PROFILE_ENABLED;
36 | import static com.falsepattern.laggoggles.profiler.ProfileManager.timingManager;
37 |
38 | @Mixin(value = Entity.class, priority = 1001)
39 | public abstract class MixinEntity {
40 |
41 | @Shadow
42 | public int dimension;
43 |
44 | @Shadow(remap = false)
45 | public abstract UUID getPersistentID();
46 |
47 | private Long LAGGOGGLES_START = null;
48 |
49 | @Inject(method = "onUpdate",
50 | at = @At("HEAD"),
51 | require = 1)
52 | private void onEntityUpdateHEAD(CallbackInfo info){
53 | LAGGOGGLES_START = System.nanoTime();
54 | }
55 |
56 | @Inject(method = "onUpdate",
57 | at = @At("RETURN"),
58 | require = 1)
59 | private void onEntityUpdateRETURN(CallbackInfo info){
60 | if(PROFILE_ENABLED.get() && LAGGOGGLES_START != null){
61 | timingManager.addEntityTime(dimension, this.getPersistentID(), System.nanoTime() - LAGGOGGLES_START);
62 | }
63 | }
64 |
65 |
66 |
67 |
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/mixin/mixins/common/vanilla/MixinEventBus.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.mixin.mixins.common.vanilla;
24 |
25 | import com.falsepattern.laggoggles.util.IMixinASMEventHandler;
26 | import com.google.common.base.Throwables;
27 | import org.spongepowered.asm.mixin.Final;
28 | import org.spongepowered.asm.mixin.Mixin;
29 | import org.spongepowered.asm.mixin.Shadow;
30 | import org.spongepowered.asm.mixin.injection.At;
31 | import org.spongepowered.asm.mixin.injection.Inject;
32 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
33 |
34 | import cpw.mods.fml.common.ModContainer;
35 | import cpw.mods.fml.common.eventhandler.Event;
36 | import cpw.mods.fml.common.eventhandler.EventBus;
37 | import cpw.mods.fml.common.eventhandler.IEventExceptionHandler;
38 | import cpw.mods.fml.common.eventhandler.IEventListener;
39 |
40 | import static com.falsepattern.laggoggles.profiler.ProfileManager.PROFILE_ENABLED;
41 | import static com.falsepattern.laggoggles.profiler.ProfileManager.timingManager;
42 |
43 | @Mixin(value = EventBus.class, remap = false)
44 | public abstract class MixinEventBus implements IEventExceptionHandler {
45 |
46 | @Shadow
47 | private IEventExceptionHandler exceptionHandler;
48 |
49 | @Shadow
50 | @Final
51 | private int busID;
52 |
53 | private boolean postWithScan(Event event) {
54 | IEventListener[] listeners = event.getListenerList().getListeners(this.busID);
55 | int index = 0;
56 | try {
57 | for(; index < listeners.length; index++) {
58 | long LAGGOGGLES_START = System.nanoTime();
59 | listeners[index].invoke(event);
60 | long nanos = System.nanoTime() - LAGGOGGLES_START;
61 |
62 | if(listeners[index] instanceof IMixinASMEventHandler) {
63 | ModContainer mod = ((IMixinASMEventHandler) listeners[index]).getOwner();
64 | if (mod != null) {
65 | String identifier = mod.getName() + " (" + mod.getSource().getName() + ")";
66 | timingManager.addEventTime(identifier, event, nanos);
67 | }
68 | }
69 | }
70 | }catch (Throwable throwable){
71 | this.exceptionHandler.handleException((EventBus) (IEventExceptionHandler) this, event, listeners, index, throwable);
72 | Throwables.propagate(throwable);
73 | }
74 | return event.isCancelable() && event.isCanceled();
75 | }
76 |
77 | @Inject(method = "post",
78 | at = @At("HEAD"),
79 | cancellable = true,
80 | require = 1)
81 | private void beforePost(Event event, CallbackInfoReturnable ci){
82 | if(PROFILE_ENABLED.get()){
83 | ci.setReturnValue(postWithScan(event));
84 | }
85 | }
86 |
87 | }
88 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/mixin/mixins/common/vanilla/MixinWorld.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.mixin.mixins.common.vanilla;
24 |
25 | import com.falsepattern.lib.compat.BlockPos;
26 | import org.spongepowered.asm.mixin.Mixin;
27 | import org.spongepowered.asm.mixin.injection.At;
28 | import org.spongepowered.asm.mixin.injection.Redirect;
29 |
30 | import net.minecraft.tileentity.TileEntity;
31 | import net.minecraft.world.World;
32 |
33 | import static com.falsepattern.laggoggles.profiler.ProfileManager.PROFILE_ENABLED;
34 | import static com.falsepattern.laggoggles.profiler.ProfileManager.timingManager;
35 |
36 | @Mixin(value = World.class, priority = 1001)
37 | public abstract class MixinWorld {
38 |
39 | @Redirect(method = "updateEntities",
40 | at = @At(value = "INVOKE",
41 | target = "Lnet/minecraft/tileentity/TileEntity;updateEntity()V"),
42 | require = 1)
43 | private void measureUpdateEntity(TileEntity tileEntity) {
44 | if (PROFILE_ENABLED.get()) {
45 | long start = System.nanoTime();
46 | tileEntity.updateEntity();
47 | long end = System.nanoTime();
48 | timingManager.addBlockTime(tileEntity.getWorldObj().provider.dimensionId, new BlockPos(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord), end - start);
49 | } else {
50 | tileEntity.updateEntity();
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/mixin/mixins/common/vanilla/MixinWorldServer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.mixin.mixins.common.vanilla;
24 |
25 | import com.falsepattern.laggoggles.util.Helpers;
26 | import org.spongepowered.asm.mixin.Mixin;
27 | import org.spongepowered.asm.mixin.injection.At;
28 | import org.spongepowered.asm.mixin.injection.Redirect;
29 |
30 | import net.minecraft.block.Block;
31 | import net.minecraft.profiler.Profiler;
32 | import net.minecraft.world.World;
33 | import net.minecraft.world.WorldProvider;
34 | import net.minecraft.world.WorldServer;
35 | import net.minecraft.world.WorldSettings;
36 | import net.minecraft.world.storage.ISaveHandler;
37 |
38 | import java.util.Random;
39 |
40 | @Mixin(value = WorldServer.class, priority = 1001)
41 | public abstract class MixinWorldServer extends World {
42 | public MixinWorldServer(ISaveHandler p_i45368_1_, String p_i45368_2_, WorldProvider p_i45368_3_, WorldSettings p_i45368_4_, Profiler p_i45368_5_) {
43 | super(p_i45368_1_, p_i45368_2_, p_i45368_3_, p_i45368_4_, p_i45368_5_);
44 | }
45 |
46 | @Redirect(method = "tickUpdates",
47 | at = @At(value = "INVOKE",
48 | target = "Lnet/minecraft/block/Block;updateTick(Lnet/minecraft/world/World;IIILjava/util/Random;)V"),
49 | require = 1)
50 | private void measureBlockUpdateTick(Block instance, World world, int x, int y, int z, Random rng) {
51 | Helpers.measureBlockUpdateTick_server(instance, world, x, y, z, rng);
52 | }
53 |
54 | @Redirect(method = "func_147456_g",
55 | at = @At(value = "INVOKE",
56 | target = "Lnet/minecraft/block/Block;updateTick(Lnet/minecraft/world/World;IIILjava/util/Random;)V"),
57 | require = 1)
58 | private void measureBlockUpdateTickRandomly(Block instance, World world, int x, int y, int z, Random rng) {
59 | Helpers.measureBlockUpdateTick_server(instance, world, x, y, z, rng);
60 | }
61 |
62 | }
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/mixin/plugin/Mixin.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.mixin.plugin;
24 |
25 | import com.falsepattern.lib.mixin.IMixin;
26 | import com.falsepattern.lib.mixin.ITargetedMod;
27 | import lombok.Getter;
28 | import lombok.RequiredArgsConstructor;
29 |
30 | import java.util.List;
31 | import java.util.function.Predicate;
32 |
33 | import static com.falsepattern.lib.mixin.IMixin.PredicateHelpers.always;
34 | import static com.falsepattern.lib.mixin.IMixin.PredicateHelpers.avoid;
35 | import static com.falsepattern.lib.mixin.IMixin.PredicateHelpers.require;
36 |
37 | @RequiredArgsConstructor
38 | public enum Mixin implements IMixin {
39 | // @formatter:off
40 | //region vanilla
41 | //region common
42 | MixinASMEventHandlerMixin(Side.COMMON, always(), "vanilla.MixinASMEventHandler"),
43 | MixinEntity(Side.COMMON, always(), "vanilla.MixinEntity"),
44 | //Loaded in preinit MixinEventBus(Side.COMMON, always(), "vanilla.MixinEventBus"),
45 | MixinWorld(Side.COMMON, always(), "vanilla.MixinWorld"),
46 | MixinWorldServer(Side.COMMON, avoid(TargetedMod.DRAGONAPI), "vanilla.MixinWorldServer"),
47 | //endregion common
48 | //region client
49 | MixinRenderManager(Side.CLIENT, always(), "vanilla.MixinRenderManager"),
50 | MixinTileEntityRendererDispatcher(Side.CLIENT, always(), "vanilla.MixinTileEntityRendererDispatcher"),
51 | //endregion client
52 | //endregion vanilla
53 | //region dragonapi
54 | //region common
55 | MixinBlockTickEvent(Side.COMMON, require(TargetedMod.DRAGONAPI), "dragonapi.MixinBlockTickEvent"),
56 | //endregion common
57 | //endregion dragonapi
58 | // @formatter:on
59 | ;
60 |
61 | @Getter
62 | public final Side side;
63 | @Getter
64 | public final Predicate> filter;
65 | @Getter
66 | public final String mixin;
67 | }
68 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/mixin/plugin/MixinPlugin.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.mixin.plugin;
24 |
25 | import com.falsepattern.laggoggles.Tags;
26 | import com.falsepattern.lib.mixin.IMixin;
27 | import com.falsepattern.lib.mixin.IMixinPlugin;
28 | import com.falsepattern.lib.mixin.ITargetedMod;
29 | import lombok.Getter;
30 | import org.apache.logging.log4j.Logger;
31 |
32 | public class MixinPlugin implements IMixinPlugin {
33 | @Getter
34 | private final Logger logger = IMixinPlugin.createLogger(Tags.MOD_NAME);
35 |
36 | @Override
37 | public ITargetedMod[] getTargetedModEnumValues() {
38 | return TargetedMod.values();
39 | }
40 |
41 | @Override
42 | public IMixin[] getMixinEnumValues() {
43 | return Mixin.values();
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/mixin/plugin/TargetedMod.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.mixin.plugin;
24 |
25 | import com.falsepattern.lib.mixin.ITargetedMod;
26 | import lombok.Getter;
27 | import lombok.RequiredArgsConstructor;
28 |
29 | import java.util.function.Predicate;
30 |
31 | import static com.falsepattern.lib.mixin.ITargetedMod.PredicateHelpers.startsWith;
32 |
33 | @RequiredArgsConstructor
34 | public enum TargetedMod implements ITargetedMod {
35 | DRAGONAPI("DragonAPI", false, startsWith("dragonapi"))
36 | ;
37 |
38 | @Getter
39 | public final String modName;
40 | @Getter
41 | public final boolean loadInDevelopment;
42 | @Getter
43 | public final Predicate condition;
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/packet/CPacketRequestEntityTeleport.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.packet;
24 |
25 | import io.netty.buffer.ByteBuf;
26 |
27 | import cpw.mods.fml.common.network.simpleimpl.IMessage;
28 |
29 | import java.util.UUID;
30 |
31 | public class CPacketRequestEntityTeleport implements IMessage {
32 |
33 | public UUID uuid;
34 | public CPacketRequestEntityTeleport(){}
35 | public CPacketRequestEntityTeleport(UUID uuid){
36 | this.uuid = uuid;
37 | }
38 |
39 |
40 | @Override
41 | public void fromBytes(ByteBuf buf){
42 | uuid = new UUID(buf.readLong(), buf.readLong());
43 | }
44 |
45 | @Override
46 | public void toBytes(ByteBuf buf) {
47 | buf.writeLong(uuid.getMostSignificantBits());
48 | buf.writeLong(uuid.getLeastSignificantBits());
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/packet/CPacketRequestResult.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.packet;
24 |
25 | import io.netty.buffer.ByteBuf;
26 |
27 | import cpw.mods.fml.common.network.simpleimpl.IMessage;
28 |
29 | public class CPacketRequestResult implements IMessage {
30 |
31 | @Override
32 | public void fromBytes(ByteBuf byteBuf) {}
33 |
34 | @Override
35 | public void toBytes(ByteBuf byteBuf) {}
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/packet/CPacketRequestScan.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.packet;
24 |
25 | import io.netty.buffer.ByteBuf;
26 |
27 | import cpw.mods.fml.common.network.simpleimpl.IMessage;
28 |
29 | public class CPacketRequestScan implements IMessage{
30 |
31 | public CPacketRequestScan(){
32 | length = 5;
33 | }
34 |
35 | public int length;
36 |
37 | @Override
38 | public void fromBytes(ByteBuf buf) {
39 | length = buf.readInt();
40 | }
41 |
42 | @Override
43 | public void toBytes(ByteBuf buf) {
44 | buf.writeInt(length);
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/packet/CPacketRequestServerData.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.packet;
24 |
25 | import io.netty.buffer.ByteBuf;
26 |
27 | import cpw.mods.fml.common.network.simpleimpl.IMessage;
28 |
29 | public class CPacketRequestServerData implements IMessage {
30 |
31 | @Override
32 | public void fromBytes(ByteBuf byteBuf) {}
33 |
34 | @Override
35 | public void toBytes(ByteBuf byteBuf) {
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/packet/CPacketRequestTileEntityTeleport.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.packet;
24 |
25 | import io.netty.buffer.ByteBuf;
26 |
27 | import cpw.mods.fml.common.network.simpleimpl.IMessage;
28 |
29 | public class CPacketRequestTileEntityTeleport implements IMessage{
30 |
31 | public int dim;
32 | public int x;
33 | public int y;
34 | public int z;
35 |
36 | public CPacketRequestTileEntityTeleport(){}
37 | public CPacketRequestTileEntityTeleport(ObjectData data){
38 | dim = data.getValue(ObjectData.Entry.WORLD_ID);
39 | x = data.getValue(ObjectData.Entry.BLOCK_POS_X);
40 | y = data.getValue(ObjectData.Entry.BLOCK_POS_Y);
41 | z = data.getValue(ObjectData.Entry.BLOCK_POS_Z);
42 | }
43 |
44 | @Override
45 | public void fromBytes(ByteBuf buf){
46 | dim = buf.readInt();
47 | x = buf.readInt();
48 | y = buf.readInt();
49 | z = buf.readInt();
50 | }
51 |
52 | @Override
53 | public void toBytes(ByteBuf buf) {
54 | buf.writeInt(dim);
55 | buf.writeInt(x);
56 | buf.writeInt(y);
57 | buf.writeInt(z);
58 | }
59 | }
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/packet/ObjectData.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.packet;
24 |
25 | import com.falsepattern.laggoggles.profiler.TimingManager;
26 | import com.falsepattern.laggoggles.util.Coder;
27 | import com.falsepattern.laggoggles.util.Graphical;
28 | import com.falsepattern.lib.compat.BlockPos;
29 | import io.netty.buffer.ByteBuf;
30 |
31 | import cpw.mods.fml.common.network.simpleimpl.IMessage;
32 |
33 | import java.util.Map;
34 | import java.util.TreeMap;
35 | import java.util.UUID;
36 |
37 | public class ObjectData implements IMessage {
38 |
39 | private TreeMap data = new TreeMap<>();
40 | public Type type;
41 |
42 | ObjectData(){}
43 |
44 | public enum Type{
45 | ENTITY,
46 | TILE_ENTITY,
47 | BLOCK,
48 | EVENT_BUS_LISTENER,
49 |
50 | GUI_ENTITY,
51 | GUI_BLOCK
52 | }
53 |
54 | public enum Entry{
55 | WORLD_ID(Coder.INTEGER),
56 |
57 | ENTITY_NAME(Coder.STRING),
58 | ENTITY_UUID(Coder.UUID),
59 | ENTITY_CLASS_NAME(Coder.STRING),
60 |
61 | BLOCK_NAME(Coder.STRING),
62 | BLOCK_POS_X(Coder.INTEGER),
63 | BLOCK_POS_Y(Coder.INTEGER),
64 | BLOCK_POS_Z(Coder.INTEGER),
65 | BLOCK_CLASS_NAME(Coder.STRING),
66 |
67 | EVENT_BUS_LISTENER(Coder.STRING),
68 | EVENT_BUS_EVENT_CLASS_NAME(Coder.STRING),
69 | EVENT_BUS_THREAD_TYPE(Coder.INTEGER),
70 |
71 | NANOS(Coder.LONG);
72 |
73 | public final Coder coder;
74 |
75 | Entry(Coder d){
76 | this.coder = d;
77 | }
78 | }
79 |
80 | public ObjectData(int worldID, String name, String className, UUID id, long nanos, Type type_){
81 | type = type_;
82 | data.put(Entry.WORLD_ID, worldID);
83 | data.put(Entry.ENTITY_NAME, name);
84 | data.put(Entry.ENTITY_CLASS_NAME, className);
85 | data.put(Entry.ENTITY_UUID, id);
86 | data.put(Entry.NANOS, nanos);
87 | }
88 |
89 | public ObjectData(int worldID, String name, String className, BlockPos pos, long nanos, Type type_){
90 | type = type_;
91 | data.put(Entry.WORLD_ID, worldID);
92 | data.put(Entry.BLOCK_NAME, name);
93 | data.put(Entry.BLOCK_CLASS_NAME, className);
94 | data.put(Entry.BLOCK_POS_X, pos.getX());
95 | data.put(Entry.BLOCK_POS_Y, pos.getY());
96 | data.put(Entry.BLOCK_POS_Z, pos.getZ());
97 | data.put(Entry.NANOS, nanos);
98 | }
99 |
100 | public ObjectData(TimingManager.EventTimings eventTimings, long nanos){
101 | type = Type.EVENT_BUS_LISTENER;
102 | data.put(Entry.EVENT_BUS_EVENT_CLASS_NAME, Graphical.formatClassName(eventTimings.eventClass.toString()));
103 | data.put(Entry.EVENT_BUS_LISTENER, Graphical.formatClassName(eventTimings.listener));
104 | data.put(Entry.EVENT_BUS_THREAD_TYPE, eventTimings.threadType.ordinal());
105 | data.put(Entry.NANOS, nanos);
106 | }
107 |
108 | @SuppressWarnings("unchecked")
109 | public T getValue(Entry entry){
110 | if(data.get(entry) == null){
111 | throw new IllegalArgumentException("Cant find the entry " + entry + " for " + type);
112 | }
113 | return (T) data.get(entry);
114 | }
115 |
116 | @SuppressWarnings("unchecked")
117 | @Override
118 | public void toBytes(ByteBuf buf) {
119 | buf.writeInt(type.ordinal());
120 | buf.writeInt(data.size());
121 | for(Map.Entry entry : data.entrySet()){
122 | buf.writeInt(entry.getKey().ordinal());
123 | entry.getKey().coder.write(entry.getValue(), buf);
124 | }
125 | }
126 |
127 | @Override
128 | public void fromBytes(ByteBuf buf) {
129 | type = Type.values()[buf.readInt()];
130 | int size = buf.readInt();
131 | for(int i=0; i.
21 | */
22 |
23 | package com.falsepattern.laggoggles.packet;
24 |
25 | import io.netty.buffer.ByteBuf;
26 |
27 | import cpw.mods.fml.common.network.ByteBufUtils;
28 | import cpw.mods.fml.common.network.simpleimpl.IMessage;
29 |
30 | public class SPacketMessage implements IMessage{
31 |
32 | public String message;
33 | public int seconds = 3;
34 |
35 | public SPacketMessage(){}
36 | public SPacketMessage(String msg){
37 | message = msg;
38 | }
39 |
40 | @Override
41 | public void fromBytes(ByteBuf buf) {
42 | message = ByteBufUtils.readUTF8String(buf);
43 | seconds = buf.readInt();
44 | }
45 |
46 | @Override
47 | public void toBytes(ByteBuf buf) {
48 | ByteBufUtils.writeUTF8String(buf, message);
49 | buf.writeInt(seconds);
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/packet/SPacketProfileStatus.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.packet;
24 |
25 | import io.netty.buffer.ByteBuf;
26 |
27 | import cpw.mods.fml.common.network.ByteBufUtils;
28 | import cpw.mods.fml.common.network.simpleimpl.IMessage;
29 |
30 | public class SPacketProfileStatus implements IMessage {
31 |
32 | public boolean isProfiling = true;
33 | public String issuedBy = "Unknown";
34 | public int length = 0;
35 |
36 | public SPacketProfileStatus(){}
37 | public SPacketProfileStatus(boolean isProfiling, int length, String issuedBy){
38 | this.isProfiling = isProfiling;
39 | this.length = length;
40 | this.issuedBy = issuedBy;
41 | }
42 |
43 | @Override
44 | public void fromBytes(ByteBuf buf){
45 | isProfiling = buf.readBoolean();
46 | length = buf.readInt();
47 | issuedBy = ByteBufUtils.readUTF8String(buf);
48 | }
49 |
50 | @Override
51 | public void toBytes(ByteBuf buf) {
52 | buf.writeBoolean(isProfiling);
53 | buf.writeInt(length);
54 | ByteBufUtils.writeUTF8String(buf, issuedBy);
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/packet/SPacketScanResult.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.packet;
24 |
25 | import com.falsepattern.laggoggles.profiler.ScanType;
26 | import com.falsepattern.laggoggles.util.Side;
27 | import io.netty.buffer.ByteBuf;
28 |
29 | import cpw.mods.fml.common.network.simpleimpl.IMessage;
30 |
31 | import java.util.ArrayList;
32 |
33 | public class SPacketScanResult implements IMessage{
34 |
35 | public SPacketScanResult(){}
36 |
37 | public ArrayList DATA = new ArrayList<>();
38 | public boolean hasMore = false;
39 | public long startTime;
40 | public long endTime;
41 | public long totalTime;
42 | public long tickCount;
43 | public Side side;
44 | public ScanType type;
45 | public long totalFrames = 0;
46 |
47 | @Override
48 | public void fromBytes(ByteBuf buf) {
49 | tickCount = buf.readLong();
50 | hasMore = buf.readBoolean();
51 | endTime = buf.readLong();
52 | startTime = buf.readLong();
53 | totalTime = buf.readLong();
54 | totalFrames = buf.readLong();
55 | side = Side.values()[buf.readInt()];
56 | type = ScanType.values()[buf.readInt()];
57 |
58 | int size = buf.readInt();
59 | for(int i=0; i.
21 | */
22 |
23 | package com.falsepattern.laggoggles.packet;
24 |
25 | import com.falsepattern.laggoggles.server.ServerConfig;
26 | import com.falsepattern.laggoggles.util.Perms;
27 | import io.netty.buffer.ByteBuf;
28 |
29 | import net.minecraft.entity.player.EntityPlayerMP;
30 | import cpw.mods.fml.common.network.simpleimpl.IMessage;
31 |
32 | public class SPacketServerData implements IMessage {
33 |
34 | public boolean hasResult = false;
35 | public Perms.Permission permission;
36 | public int maxProfileTime = ServerConfig.NON_OPS_MAX_PROFILE_TIME;
37 | public boolean canSeeEventSubScribers = ServerConfig.ALLOW_NON_OPS_TO_SEE_EVENT_SUBSCRIBERS;
38 |
39 | public SPacketServerData(){}
40 | public SPacketServerData(EntityPlayerMP player){
41 | hasResult = true;
42 | permission = Perms.getPermission(player);
43 | }
44 |
45 | @Override
46 | public void fromBytes(ByteBuf byteBuf) {
47 | hasResult = byteBuf.readBoolean();
48 | permission = Perms.Permission.values()[byteBuf.readInt()];
49 | maxProfileTime = byteBuf.readInt();
50 | canSeeEventSubScribers = byteBuf.readBoolean();
51 | }
52 |
53 | @Override
54 | public void toBytes(ByteBuf byteBuf) {
55 | byteBuf.writeBoolean(hasResult);
56 | byteBuf.writeInt(permission.ordinal());
57 | byteBuf.writeInt(maxProfileTime);
58 | byteBuf.writeBoolean(canSeeEventSubScribers);
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/profiler/ScanType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.profiler;
24 |
25 | import com.falsepattern.laggoggles.Tags;
26 |
27 | public enum ScanType {
28 | WORLD(Tags.MOD_NAME + ": World scan results"),
29 | FPS(Tags.MOD_NAME + ": FPS scan results"),
30 | EMPTY("Empty profile results.");
31 |
32 | private final String text;
33 |
34 | ScanType(String text){
35 | this.text = text;
36 | }
37 |
38 | public String getText(ProfileResult result){
39 | return text;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/profiler/TickCounter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.profiler;
24 |
25 | import cpw.mods.fml.common.eventhandler.SubscribeEvent;
26 | import cpw.mods.fml.common.gameevent.TickEvent;
27 |
28 | import java.util.concurrent.atomic.AtomicLong;
29 |
30 | public class TickCounter {
31 |
32 | public static AtomicLong ticks = new AtomicLong(0L);
33 |
34 | @SubscribeEvent
35 | public void addTick(TickEvent.ServerTickEvent e) {
36 | if(e.phase == TickEvent.Phase.START) {
37 | ticks.incrementAndGet();
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/proxy/ClientProxy.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.proxy;
24 |
25 | import com.falsepattern.laggoggles.Tags;
26 | import com.falsepattern.laggoggles.client.ClientConfig;
27 | import com.falsepattern.laggoggles.client.MinimapRenderer;
28 | import com.falsepattern.laggoggles.client.OutlineRenderer;
29 | import com.falsepattern.laggoggles.client.gui.GuiProfile;
30 | import com.falsepattern.laggoggles.client.gui.KeyHandler;
31 | import com.falsepattern.laggoggles.client.gui.LagOverlayGui;
32 | import com.falsepattern.laggoggles.packet.CPacketRequestServerData;
33 | import lombok.Getter;
34 |
35 | import net.minecraft.client.Minecraft;
36 | import cpw.mods.fml.client.registry.ClientRegistry;
37 | import cpw.mods.fml.common.FMLCommonHandler;
38 | import cpw.mods.fml.common.event.FMLPostInitializationEvent;
39 | import cpw.mods.fml.common.event.FMLPreInitializationEvent;
40 | import cpw.mods.fml.common.eventhandler.SubscribeEvent;
41 | import cpw.mods.fml.common.gameevent.TickEvent;
42 | import cpw.mods.fml.common.network.FMLNetworkEvent;
43 |
44 | import static com.falsepattern.laggoggles.client.ServerDataPacketHandler.RECEIVED_RESULT;
45 | import static com.falsepattern.laggoggles.profiler.ProfileManager.LAST_PROFILE_RESULT;
46 |
47 | public class ClientProxy extends CommonProxy {
48 |
49 | @Getter
50 | private static boolean renderMinimap = false;
51 |
52 | @Getter
53 | private static boolean renderUpdates = false;
54 |
55 | @Override
56 | public void preinit(FMLPreInitializationEvent e) {
57 | ClientConfig.init();
58 | super.preinit(e);
59 | }
60 |
61 | @Override
62 | public void postinit(FMLPostInitializationEvent e){
63 | super.postinit(e);
64 | ClientRegistry.registerKeyBinding(new KeyHandler("Profile GUI", 0, Tags.MOD_ID, () -> {
65 | NETWORK_WRAPPER.sendToServer(new CPacketRequestServerData());
66 | Minecraft.getMinecraft().displayGuiScreen(new GuiProfile());
67 | }));
68 | ClientRegistry.registerKeyBinding(new KeyHandler("Chunk loading minimap", 0, Tags.MOD_ID, () -> {
69 | renderMinimap = !renderMinimap;
70 | }));
71 | ClientRegistry.registerKeyBinding(new KeyHandler("Chunk redraw visualization", 0, Tags.MOD_ID, () -> {
72 | renderUpdates = !renderUpdates;
73 | }));
74 |
75 | FMLCommonHandler.instance().bus().register(new LoginHandler());
76 | new MinimapRenderer().register();
77 | new OutlineRenderer().register();
78 | }
79 |
80 | public static class LoginHandler {
81 | @SubscribeEvent
82 | public void onLogin(FMLNetworkEvent.ClientConnectedToServerEvent e){
83 | RECEIVED_RESULT = false;
84 | LagOverlayGui.destroy();
85 | LAST_PROFILE_RESULT.set(null);
86 | new ClientLoginAction().activate();
87 | }
88 | }
89 |
90 | public static class ClientLoginAction {
91 |
92 | int count = 0;
93 |
94 | @SubscribeEvent
95 | public void onTick(TickEvent.ClientTickEvent e){
96 | if(RECEIVED_RESULT){
97 | FMLCommonHandler.instance().bus().unregister(this);
98 | return;
99 | }
100 | if(e.phase != TickEvent.Phase.START){
101 | return;
102 | }
103 | if(count++ % 5 == 0){
104 | NETWORK_WRAPPER.sendToServer(new CPacketRequestServerData());
105 | }
106 | }
107 |
108 | public void activate(){
109 | FMLCommonHandler.instance().bus().register(this);
110 | }
111 |
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/proxy/CommonProxy.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.proxy;
24 |
25 | import com.falsepattern.laggoggles.Tags;
26 | import com.falsepattern.laggoggles.client.MessagePacketHandler;
27 | import com.falsepattern.laggoggles.client.ProfileStatusHandler;
28 | import com.falsepattern.laggoggles.client.ScanResultHandler;
29 | import com.falsepattern.laggoggles.client.ServerDataPacketHandler;
30 | import com.falsepattern.laggoggles.command.LagGogglesCommand;
31 | import com.falsepattern.laggoggles.packet.CPacketRequestEntityTeleport;
32 | import com.falsepattern.laggoggles.packet.CPacketRequestResult;
33 | import com.falsepattern.laggoggles.packet.CPacketRequestScan;
34 | import com.falsepattern.laggoggles.packet.CPacketRequestServerData;
35 | import com.falsepattern.laggoggles.packet.CPacketRequestTileEntityTeleport;
36 | import com.falsepattern.laggoggles.packet.SPacketMessage;
37 | import com.falsepattern.laggoggles.packet.SPacketProfileStatus;
38 | import com.falsepattern.laggoggles.packet.SPacketScanResult;
39 | import com.falsepattern.laggoggles.packet.SPacketServerData;
40 | import com.falsepattern.laggoggles.profiler.ProfileResult;
41 | import com.falsepattern.laggoggles.profiler.TickCounter;
42 | import com.falsepattern.laggoggles.server.RequestDataHandler;
43 | import com.falsepattern.laggoggles.server.RequestResultHandler;
44 | import com.falsepattern.laggoggles.server.ScanRequestHandler;
45 | import com.falsepattern.laggoggles.server.TeleportRequestHandler;
46 | import com.falsepattern.laggoggles.server.TeleportToTileEntityRequestHandler;
47 | import com.falsepattern.laggoggles.util.Perms;
48 | import com.falsepattern.laggoggles.util.RunInServerThread;
49 |
50 | import net.minecraft.entity.player.EntityPlayerMP;
51 | import cpw.mods.fml.common.FMLCommonHandler;
52 | import cpw.mods.fml.common.event.FMLInitializationEvent;
53 | import cpw.mods.fml.common.event.FMLPostInitializationEvent;
54 | import cpw.mods.fml.common.event.FMLPreInitializationEvent;
55 | import cpw.mods.fml.common.event.FMLServerStartingEvent;
56 | import cpw.mods.fml.common.network.NetworkRegistry;
57 | import cpw.mods.fml.common.network.simpleimpl.IMessage;
58 | import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
59 | import cpw.mods.fml.relauncher.Side;
60 |
61 | import java.util.List;
62 |
63 | public class CommonProxy {
64 |
65 | public static final SimpleNetworkWrapper NETWORK_WRAPPER = NetworkRegistry.INSTANCE.newSimpleChannel(Tags.MOD_ID);
66 |
67 | private byte PACKET_ID = 0;
68 |
69 | public void preinit(FMLPreInitializationEvent e){
70 |
71 | }
72 |
73 | public void init(FMLInitializationEvent e){}
74 |
75 | public void postinit(FMLPostInitializationEvent e){
76 | NETWORK_WRAPPER.registerMessage(
77 | ScanResultHandler.class,
78 | SPacketScanResult.class, PACKET_ID++, Side.CLIENT);
79 | NETWORK_WRAPPER.registerMessage(
80 | ProfileStatusHandler.class,
81 | SPacketProfileStatus.class, PACKET_ID++, Side.CLIENT);
82 | NETWORK_WRAPPER.registerMessage(
83 | ServerDataPacketHandler.class,
84 | SPacketServerData.class, PACKET_ID++, Side.CLIENT);
85 | NETWORK_WRAPPER.registerMessage(
86 | RequestDataHandler.class,
87 | CPacketRequestServerData.class, PACKET_ID++, Side.SERVER);
88 | NETWORK_WRAPPER.registerMessage(
89 | MessagePacketHandler.class,
90 | SPacketMessage.class, PACKET_ID++, Side.CLIENT);
91 | NETWORK_WRAPPER.registerMessage(
92 | ScanRequestHandler.class,
93 | CPacketRequestScan.class, PACKET_ID++, Side.SERVER);
94 | NETWORK_WRAPPER.registerMessage(
95 | TeleportRequestHandler.class,
96 | CPacketRequestEntityTeleport.class, PACKET_ID++, Side.SERVER);
97 | NETWORK_WRAPPER.registerMessage(
98 | TeleportToTileEntityRequestHandler.class,
99 | CPacketRequestTileEntityTeleport.class, PACKET_ID++, Side.SERVER);
100 | NETWORK_WRAPPER.registerMessage(
101 | RequestResultHandler.class,
102 | CPacketRequestResult.class, PACKET_ID++, Side.SERVER);
103 | }
104 |
105 | public static void sendTo(IMessage msg, EntityPlayerMP player){
106 | NETWORK_WRAPPER.sendTo(msg, player);
107 | }
108 |
109 | public static void sendTo(ProfileResult result, EntityPlayerMP player){
110 | List packets = Perms.getResultFor(player, result).createPackets(player);
111 | new RunInServerThread(new Runnable() {
112 | @Override
113 | public void run() {
114 | for (SPacketScanResult result : packets){
115 | sendTo(result, player);
116 | }
117 | }
118 | });
119 | }
120 |
121 | public void serverStartingEvent(FMLServerStartingEvent e){
122 | e.registerServerCommand(new LagGogglesCommand());
123 | FMLCommonHandler.instance().bus().register(new TickCounter());
124 | FMLCommonHandler.instance().bus().register(new RequestDataHandler());
125 | }
126 | }
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/proxy/ServerProxy.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.proxy;
24 |
25 | import com.falsepattern.laggoggles.server.ServerConfig;
26 |
27 | import cpw.mods.fml.common.event.FMLPreInitializationEvent;
28 |
29 | public class ServerProxy extends CommonProxy {
30 | @Override
31 | public void preinit(FMLPreInitializationEvent e) {
32 | ServerConfig.init();
33 | super.preinit(e);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/server/RequestDataHandler.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.server;
24 |
25 | import com.falsepattern.laggoggles.packet.CPacketRequestServerData;
26 | import com.falsepattern.laggoggles.packet.SPacketServerData;
27 |
28 | import cpw.mods.fml.common.eventhandler.SubscribeEvent;
29 | import cpw.mods.fml.common.gameevent.PlayerEvent;
30 | import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
31 | import cpw.mods.fml.common.network.simpleimpl.MessageContext;
32 |
33 | import java.util.ArrayList;
34 | import java.util.UUID;
35 |
36 | public class RequestDataHandler implements IMessageHandler{
37 |
38 | public static final ArrayList playersWithLagGoggles = new ArrayList<>();
39 |
40 | @SubscribeEvent
41 | public void onLogout(PlayerEvent.PlayerLoggedOutEvent e){
42 | playersWithLagGoggles.remove(e.player.getGameProfile().getId());
43 | }
44 |
45 | @Override
46 | public SPacketServerData onMessage(CPacketRequestServerData cPacketRequestServerData, MessageContext ctx){
47 | if(!playersWithLagGoggles.contains(ctx.getServerHandler().playerEntity.getGameProfile().getId())) {
48 | playersWithLagGoggles.add(ctx.getServerHandler().playerEntity.getGameProfile().getId());
49 | }
50 | return new SPacketServerData(ctx.getServerHandler().playerEntity);
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/server/RequestResultHandler.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.server;
24 |
25 | import com.falsepattern.laggoggles.packet.CPacketRequestResult;
26 | import com.falsepattern.laggoggles.packet.SPacketMessage;
27 | import com.falsepattern.laggoggles.profiler.ProfileManager;
28 | import com.falsepattern.laggoggles.proxy.CommonProxy;
29 | import com.falsepattern.laggoggles.util.Perms;
30 |
31 | import net.minecraft.entity.player.EntityPlayerMP;
32 | import cpw.mods.fml.common.network.simpleimpl.IMessage;
33 | import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
34 | import cpw.mods.fml.common.network.simpleimpl.MessageContext;
35 |
36 | import java.util.HashMap;
37 | import java.util.UUID;
38 |
39 | import static com.falsepattern.laggoggles.profiler.ScanType.FPS;
40 |
41 | public class RequestResultHandler implements IMessageHandler {
42 |
43 | private static HashMap LAST_RESULT_REQUEST = new HashMap<>();
44 |
45 | @Override
46 | public IMessage onMessage(CPacketRequestResult CPacketRequestResult, MessageContext ctx) {
47 | EntityPlayerMP player = ctx.getServerHandler().playerEntity;
48 |
49 | if(Perms.getPermission(player).ordinal() < Perms.Permission.GET.ordinal()){
50 | return new SPacketMessage("No permission");
51 | }
52 | if(ProfileManager.LAST_PROFILE_RESULT.get() == null || ProfileManager.LAST_PROFILE_RESULT.get().getType() == FPS){
53 | return new SPacketMessage("No data available");
54 | }
55 | if(Perms.getPermission(player).ordinal() < Perms.Permission.FULL.ordinal()){
56 | long secondsLeft = secondsLeft(player.getGameProfile().getId());
57 | if(secondsLeft > 0){
58 | return new SPacketMessage("Please wait " + secondsLeft + " seconds.");
59 | }
60 | }
61 | CommonProxy.sendTo(ProfileManager.LAST_PROFILE_RESULT.get(), player);
62 | return null;
63 | }
64 |
65 | public static long secondsLeft(UUID uuid){
66 | long lastRequest = LAST_RESULT_REQUEST.getOrDefault(uuid, 0L);
67 | long secondsLeft = ServerConfig.NON_OPS_REQUEST_LAST_SCAN_DATA_TIMEOUT - ((System.currentTimeMillis() - lastRequest)/1000);
68 | if(secondsLeft <= 0){
69 | LAST_RESULT_REQUEST.put(uuid, System.currentTimeMillis());
70 | }
71 | return secondsLeft;
72 | }
73 |
74 | }
75 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/server/ScanRequestHandler.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.server;
24 |
25 | import com.falsepattern.laggoggles.Main;
26 | import com.falsepattern.laggoggles.api.Profiler;
27 | import com.falsepattern.laggoggles.packet.CPacketRequestScan;
28 | import com.falsepattern.laggoggles.packet.SPacketMessage;
29 | import com.falsepattern.laggoggles.packet.SPacketProfileStatus;
30 | import com.falsepattern.laggoggles.packet.SPacketServerData;
31 | import com.falsepattern.laggoggles.profiler.ProfileManager;
32 | import com.falsepattern.laggoggles.profiler.ScanType;
33 | import com.falsepattern.laggoggles.proxy.CommonProxy;
34 | import com.falsepattern.laggoggles.util.Perms;
35 |
36 | import net.minecraft.entity.player.EntityPlayerMP;
37 | import cpw.mods.fml.common.network.simpleimpl.IMessage;
38 | import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
39 | import cpw.mods.fml.common.network.simpleimpl.MessageContext;
40 |
41 | import java.util.HashMap;
42 | import java.util.UUID;
43 |
44 | public class ScanRequestHandler implements IMessageHandler {
45 |
46 | private static HashMap COOLDOWN = new HashMap<>();
47 |
48 | @Override
49 | public IMessage onMessage(CPacketRequestScan request, MessageContext ctx) {
50 | final EntityPlayerMP requestee = ctx.getServerHandler().playerEntity;
51 | Perms.Permission requesteePerms = Perms.getPermission(requestee);
52 |
53 | if(requesteePerms.ordinal() < Perms.Permission.START.ordinal()){
54 | Main.LOGGER.info(requestee.getDisplayName() + " Tried to start the profiler, but was denied to do so!");
55 | return new SPacketMessage("No permission");
56 | }
57 |
58 | if(requesteePerms != Perms.Permission.FULL && request.length > ServerConfig.NON_OPS_MAX_PROFILE_TIME){
59 | return new SPacketMessage("Profile time is too long! You can profile up to " + ServerConfig.NON_OPS_MAX_PROFILE_TIME + " seconds.");
60 | }
61 |
62 | if(ProfileManager.PROFILE_ENABLED.get() == true){
63 | return new SPacketMessage("Profiler is already running");
64 | }
65 |
66 | /*
67 | long secondsLeft = (COOLDOWN.getOrDefault(requestee.getGameProfile().getId(),0L) - System.currentTimeMillis())/1000;
68 | if(secondsLeft > 0 && requesteePerms != Perms.Permission.FULL){
69 | return new SPacketMessage("Please wait " + secondsLeft + " seconds.");
70 | }
71 | COOLDOWN.put(requestee.getGameProfile().getId(), System.currentTimeMillis() + (1000 * NON_OPS_PROFILE_COOL_DOWN_SECONDS));
72 | */
73 |
74 | long secondsLeft = secondsLeft(requestee.getGameProfile().getId());
75 | if(secondsLeft > 0 && requesteePerms != Perms.Permission.FULL){
76 | return new SPacketMessage("Please wait " + secondsLeft + " seconds.");
77 | }
78 |
79 | /* Start profiler */
80 | new Thread(new Runnable() {
81 | @Override
82 | public void run() {
83 | Profiler.runProfiler(request.length, ScanType.WORLD, requestee);
84 |
85 | /* Send status to users */
86 | SPacketProfileStatus status2 = new SPacketProfileStatus(false, request.length, requestee.getDisplayName());
87 | for(EntityPlayerMP user : Perms.getLagGogglesUsers()) {
88 | CommonProxy.sendTo(status2, user);
89 | }
90 |
91 | CommonProxy.sendTo(ProfileManager.LAST_PROFILE_RESULT.get(), requestee);
92 | for(EntityPlayerMP user : Perms.getLagGogglesUsers()) {
93 | CommonProxy.sendTo(new SPacketServerData(user), user);
94 | }
95 | }
96 | }).start();
97 | return null;
98 | }
99 |
100 |
101 | public static long secondsLeft(UUID uuid){
102 | long lastRequest = COOLDOWN.getOrDefault(uuid, 0L);
103 | long secondsLeft = ServerConfig.NON_OPS_PROFILE_COOL_DOWN_SECONDS - ((System.currentTimeMillis() - lastRequest)/1000);
104 | if(secondsLeft <= 0){
105 | COOLDOWN.put(uuid, System.currentTimeMillis());
106 | }
107 | return secondsLeft;
108 | }
109 | }
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/server/ServerConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.server;
24 |
25 | import com.falsepattern.laggoggles.Tags;
26 | import com.falsepattern.laggoggles.util.Perms;
27 | import com.falsepattern.lib.config.Config;
28 | import com.falsepattern.lib.config.ConfigurationManager;
29 |
30 | @Config(modid = Tags.MOD_ID, category = "server")
31 | public class ServerConfig {
32 |
33 | @Config.Comment("What's the permission level available to non-operators (Normal players)?\n" +
34 | "Please note that this ONLY works on dedicated servers. If you're playing singleplayer or LAN, the FULL permission is used.\n" +
35 | "Available permissions in ascending order are:\n" +
36 | " 'NONE' No permissions are granted, all functionality is denied.\n" +
37 | " 'GET' Allow getting the latest scan result, this will be stripped down to the player's surroundings\n" +
38 | " 'START' Allow starting the profiler\n" +
39 | " 'FULL' All permissions are granted, teleporting to entities, blocks")
40 | @Config.DefaultEnum("START")
41 | public static Perms.Permission NON_OP_PERMISSION_LEVEL;
42 |
43 | @Config.Comment("Allow normal users to see event subscribers?")
44 | @Config.DefaultBoolean(false)
45 | public static boolean ALLOW_NON_OPS_TO_SEE_EVENT_SUBSCRIBERS;
46 |
47 | @Config.Comment("If normal users can start the profiler, what is the maximum time in seconds?")
48 | @Config.DefaultInt(20)
49 | public static int NON_OPS_MAX_PROFILE_TIME;
50 |
51 | @Config.Comment("If normal users can start the profiler, what is the cool-down between requests in seconds?")
52 | @Config.DefaultInt(120)
53 | public static int NON_OPS_PROFILE_COOL_DOWN_SECONDS;
54 |
55 | @Config.Comment("What is the maximum HORIZONTAL range in blocks normal users can get results for?")
56 | @Config.DefaultDouble(50)
57 | public static double NON_OPS_MAX_HORIZONTAL_RANGE;
58 |
59 | @Config.Comment("What is the maximum VERTICAL range in blocks normal users can get results for?")
60 | @Config.DefaultDouble(20)
61 | public static double NON_OPS_MAX_VERTICAL_RANGE;
62 |
63 | @Config.Comment("From where should we range-limit blocks vertically for normal users?\n" +
64 | "This will override the MAX_VERTICAL_RANGE when the block is above this Y level")
65 | @Config.DefaultInt(64)
66 | public static int NON_OPS_WHITELIST_HEIGHT_ABOVE;
67 |
68 | @Config.Comment("How often can normal users request the latest scan result in seconds?")
69 | @Config.DefaultInt(30)
70 | public static int NON_OPS_REQUEST_LAST_SCAN_DATA_TIMEOUT;
71 |
72 | static {
73 | ConfigurationManager.selfInit();
74 | }
75 |
76 | //This is here to force the class to load
77 | public static void init() {
78 |
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/server/TeleportRequestHandler.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.server;
24 |
25 | import com.falsepattern.laggoggles.Main;
26 | import com.falsepattern.laggoggles.packet.CPacketRequestEntityTeleport;
27 | import com.falsepattern.laggoggles.packet.SPacketMessage;
28 | import com.falsepattern.laggoggles.util.Perms;
29 | import com.falsepattern.laggoggles.util.RunInServerThread;
30 | import com.falsepattern.laggoggles.util.Teleport;
31 | import com.falsepattern.lib.text.FormattedText;
32 |
33 | import net.minecraft.entity.Entity;
34 | import net.minecraft.entity.player.EntityPlayerMP;
35 | import net.minecraft.util.EnumChatFormatting;
36 | import cpw.mods.fml.common.FMLCommonHandler;
37 | import cpw.mods.fml.common.network.simpleimpl.IMessage;
38 | import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
39 | import cpw.mods.fml.common.network.simpleimpl.MessageContext;
40 |
41 | import java.util.Arrays;
42 | import java.util.List;
43 |
44 | public class TeleportRequestHandler implements IMessageHandler {
45 |
46 | @SuppressWarnings("unchecked")
47 | @Override
48 | public IMessage onMessage(CPacketRequestEntityTeleport message, MessageContext ctx) {
49 | EntityPlayerMP player = ctx.getServerHandler().playerEntity;
50 | if(!Perms.hasPermission(player, Perms.Permission.FULL)){
51 | Main.LOGGER.info(player.getDisplayName() + " tried to teleport, but was denied to do so!");
52 | return new SPacketMessage("No permission");
53 | }
54 | new RunInServerThread(() -> {
55 | Entity e = Arrays.stream(FMLCommonHandler.instance().getMinecraftServerInstance().worldServers)
56 | .flatMap((world) -> ((List)world.loadedEntityList).stream())
57 | .filter((entity) -> entity.getPersistentID().equals(message.uuid))
58 | .findFirst()
59 | .orElse(null);
60 | if(e == null){
61 | FormattedText.parse(EnumChatFormatting.RED + "Woops! This entity no longer exists!").addChatMessage(player);
62 | return;
63 | }
64 | Teleport.teleportPlayer(player, e.dimension, e.posX, e.posY, e.posZ);
65 | });
66 | return null;
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/server/TeleportToTileEntityRequestHandler.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.server;
24 |
25 | import com.falsepattern.laggoggles.Main;
26 | import com.falsepattern.laggoggles.packet.CPacketRequestTileEntityTeleport;
27 | import com.falsepattern.laggoggles.packet.SPacketMessage;
28 | import com.falsepattern.laggoggles.util.Perms;
29 | import com.falsepattern.laggoggles.util.Teleport;
30 |
31 | import net.minecraft.entity.player.EntityPlayerMP;
32 | import cpw.mods.fml.common.network.simpleimpl.IMessage;
33 | import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
34 | import cpw.mods.fml.common.network.simpleimpl.MessageContext;
35 |
36 | public class TeleportToTileEntityRequestHandler implements IMessageHandler {
37 |
38 | @Override
39 | public IMessage onMessage(final CPacketRequestTileEntityTeleport message, MessageContext ctx) {
40 | EntityPlayerMP player = ctx.getServerHandler().playerEntity;
41 | if(Perms.hasPermission(player, Perms.Permission.FULL) == false){
42 | Main.LOGGER.info(player.getDisplayName() + " tried to teleport, but was denied to do so!");
43 | return new SPacketMessage("No permission");
44 | }
45 | Teleport.teleportPlayer(player, message.dim, message.x, message.y, message.z);
46 | return null;
47 | }
48 | }
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/util/Calculations.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.util;
24 |
25 | import com.falsepattern.laggoggles.client.ClientConfig;
26 | import com.falsepattern.laggoggles.client.gui.GuiScanResultsWorld;
27 | import com.falsepattern.laggoggles.packet.ObjectData;
28 | import com.falsepattern.laggoggles.profiler.ProfileResult;
29 | import com.falsepattern.laggoggles.profiler.TimingManager;
30 |
31 | import cpw.mods.fml.relauncher.Side;
32 | import cpw.mods.fml.relauncher.SideOnly;
33 |
34 | import static com.falsepattern.laggoggles.util.Graphical.mu;
35 |
36 | @SideOnly(Side.CLIENT)
37 | public class Calculations {
38 |
39 | public static final double NANOS_IN_A_TICK = 50000000;
40 |
41 | public static double heat(long nanos, ProfileResult result) {
42 | return Math.min((muPerTick(nanos, result) / ClientConfig.GRADIENT_MAXED_OUT_AT_MICROSECONDS) * 100, 100);
43 | }
44 |
45 | public static double heatThread(GuiScanResultsWorld.LagSource source, ProfileResult result){
46 | if(source.data.type != ObjectData.Type.EVENT_BUS_LISTENER){
47 | throw new IllegalArgumentException("Expected heat calculation for thread, not " + source.data.type);
48 | }
49 | TimingManager.EventTimings.ThreadType type = TimingManager.EventTimings.ThreadType.values()[source.data.getValue(ObjectData.Entry.EVENT_BUS_THREAD_TYPE)];
50 | if(type == TimingManager.EventTimings.ThreadType.CLIENT) {
51 | return Math.min(((double) source.nanos / (double) result.getTotalTime()) * 100,100);
52 | }else if (type == TimingManager.EventTimings.ThreadType.ASYNC){
53 | return 0;
54 | }else if(type == TimingManager.EventTimings.ThreadType.SERVER){
55 | return Math.floor((source.nanos / result.getTickCount()) / NANOS_IN_A_TICK * 10000) / 100d;
56 | }else{
57 | throw new IllegalStateException("Terminator_NL forgot to add code here... Please submit an issue at github!");
58 | }
59 | }
60 |
61 | public static double heatNF(long nanos, ProfileResult result) {
62 | return Math.min(((double) nanos/(double) result.getTotalFrames() / (double) ClientConfig.GRADIENT_MAXED_OUT_AT_NANOSECONDS_FPS) * 100D, 100);
63 | }
64 |
65 | public static String NFString(long nanos, long frames) {
66 | long nf = nanos/frames;
67 | if(nf > 1000) {
68 | return nf/1000+"k ns/F";
69 | }else{
70 | return nf +" ns/F";
71 | }
72 | }
73 |
74 | public static String NFStringSimple(long nanos, long frames) {
75 | return nanos/frames + " ns/F";
76 | }
77 |
78 | public static String tickPercent(long nanos, ProfileResult result) {
79 | if(result == null || result.getTickCount() == 0){
80 | return "?";
81 | }
82 | return Math.floor((nanos / result.getTickCount()) / NANOS_IN_A_TICK * 10000) / 100d + "%";
83 | }
84 |
85 | public static String nfPercent(long nanos, ProfileResult result) {
86 | if(result == null || result.getTotalFrames() == 0){
87 | return "?";
88 | }
89 | return Math.floor((nanos / (double) result.getTotalTime()) * 10000D) / 100D + "%";
90 | }
91 |
92 | public static double muPerTick(long nanos, ProfileResult result) {
93 | if(result == null){
94 | return 0;
95 | }
96 | return (nanos / result.getTickCount()) / 1000;
97 | }
98 |
99 | public static double muPerTickCustomTotals(long nanos, long totalTicks) {
100 | return (nanos / totalTicks) / 1000;
101 | }
102 |
103 | public static String muPerTickString(long nanos, ProfileResult result) {
104 | if(result == null){
105 | return "?";
106 | }
107 | return Double.valueOf((nanos / result.getTickCount()) / 1000).intValue() + " " + mu + "s/t";
108 | }
109 |
110 | }
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/util/ClickableLink.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.util;
24 |
25 |
26 | import com.falsepattern.lib.text.FormattedText;
27 | import lombok.val;
28 |
29 | import net.minecraft.event.ClickEvent;
30 | import net.minecraft.util.ChatComponentText;
31 | import net.minecraft.util.EnumChatFormatting;
32 |
33 | public class ClickableLink {
34 |
35 | public static ChatComponentText getLink(String link){
36 | val text = FormattedText.parse(EnumChatFormatting.BLUE + link).toChatText().get(0);
37 | val style = text.getChatStyle();
38 | style.setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, link));
39 | return text;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/util/Coder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.util;
24 |
25 | import io.netty.buffer.ByteBuf;
26 |
27 | import cpw.mods.fml.common.network.ByteBufUtils;
28 |
29 | import java.util.UUID;
30 |
31 | public abstract class Coder{
32 |
33 | public static final Coder INTEGER = new Coder() {
34 | @Override
35 | public Integer read(ByteBuf buf) {
36 | return buf.readInt();
37 | }
38 |
39 | @Override
40 | public void write(Integer var, ByteBuf buf) {
41 | buf.writeInt(var);
42 | }
43 | };
44 |
45 | public static final Coder STRING = new Coder() {
46 | @Override
47 | public String read(ByteBuf buf) {
48 | return ByteBufUtils.readUTF8String(buf);
49 | }
50 |
51 | @Override
52 | public void write(String var, ByteBuf buf) {
53 | ByteBufUtils.writeUTF8String(buf, var);
54 | }
55 | };
56 |
57 | public static final Coder UUID = new Coder() {
58 | @Override
59 | public UUID read(ByteBuf buf) {
60 | return new java.util.UUID(buf.readLong(), buf.readLong());
61 | }
62 |
63 | @Override
64 | public void write(UUID var, ByteBuf buf) {
65 | buf.writeLong(var.getMostSignificantBits());
66 | buf.writeLong(var.getLeastSignificantBits());
67 | }
68 | };
69 |
70 | public static final Coder LONG = new Coder() {
71 | @Override
72 | public Long read(ByteBuf buf) {
73 | return buf.readLong();
74 | }
75 |
76 | @Override
77 | public void write(Long var, ByteBuf buf) {
78 | buf.writeLong(var);
79 | }
80 | };
81 |
82 | public static final Coder BOOLEAN = new Coder() {
83 | @Override
84 | public Boolean read(ByteBuf buf) {
85 | return buf.readBoolean();
86 | }
87 |
88 | @Override
89 | public void write(Boolean var, ByteBuf buf) {
90 | buf.writeBoolean(var);
91 | }
92 | };
93 |
94 | abstract public T read(ByteBuf buf);
95 | abstract public void write(T var, ByteBuf buf);
96 | }
97 |
98 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/util/ColorBlindMode.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.util;
24 |
25 | import static com.falsepattern.laggoggles.util.Graphical.BLUE_CHANNEL;
26 | import static com.falsepattern.laggoggles.util.Graphical.GREEN_CHANNEL;
27 | import static com.falsepattern.laggoggles.util.Graphical.RED_CHANNEL;
28 |
29 | public enum ColorBlindMode {
30 |
31 | GREEN_TO_RED(GREEN_CHANNEL, RED_CHANNEL, BLUE_CHANNEL),
32 | BLUE_TO_RED(BLUE_CHANNEL, RED_CHANNEL, GREEN_CHANNEL),
33 | GREEN_TO_BLUE(GREEN_CHANNEL, BLUE_CHANNEL, RED_CHANNEL);
34 |
35 | private final int bad;
36 | private final int good;
37 | private final int neutral;
38 |
39 | ColorBlindMode(int good, int bad, int neutral){
40 | this.bad = bad;
41 | this.good = good;
42 | this.neutral = neutral;
43 | }
44 |
45 | public double[] heatToColor(double heat){
46 | double[] rgb = new double[3];
47 | rgb[neutral] = 0;
48 |
49 | if(heat < 50){
50 | rgb[bad] = (heat / 50);
51 | rgb[good] = 1;
52 | return rgb;
53 | }else if(heat == 50){
54 | rgb[bad] = 1;
55 | rgb[good] = 1;
56 | return rgb;
57 | }else{
58 | rgb[bad] = 1;
59 | rgb[good] = 1 - ((heat-50) / 50);
60 | return rgb;
61 | }
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/util/Graphical.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.util;
24 |
25 | import com.falsepattern.laggoggles.client.ClientConfig;
26 |
27 | public class Graphical {
28 |
29 | public static final String mu = "\u00B5";
30 |
31 | public static String formatClassName(String in){
32 | return in.startsWith("class ") ? in.substring(6) : in;
33 | }
34 |
35 | public static final int RED_CHANNEL = 0;
36 | public static final int GREEN_CHANNEL = 1;
37 | public static final int BLUE_CHANNEL = 2;
38 |
39 | public static double[] heatToColor(double heat){
40 | return ClientConfig.COLORS.heatToColor(heat);
41 | }
42 |
43 | public static int RGBtoInt(double[] rgb){
44 | int R = (int) (rgb[0] * 255);
45 | R = (R << 8) + (int) (rgb[1] * 255);
46 | return (R << 8) + (int) (rgb[2] * 255);
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/util/Helpers.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.util;
24 |
25 | import com.falsepattern.lib.compat.BlockPos;
26 | import lombok.AccessLevel;
27 | import lombok.NoArgsConstructor;
28 |
29 | import net.minecraft.block.Block;
30 | import net.minecraft.world.World;
31 |
32 | import java.util.Random;
33 |
34 | import static com.falsepattern.laggoggles.profiler.ProfileManager.PROFILE_ENABLED;
35 | import static com.falsepattern.laggoggles.profiler.ProfileManager.timingManager;
36 |
37 | @NoArgsConstructor(access = AccessLevel.PRIVATE)
38 | public final class Helpers {
39 | public static void measureBlockUpdateTick_server(Block instance, World world, int x, int y, int z, Random rng) {
40 | if (PROFILE_ENABLED.get()) {
41 | long start = System.nanoTime();
42 | instance.updateTick(world, x, y, z, rng);
43 | long end = System.nanoTime();
44 | timingManager.addBlockTime(world.provider.dimensionId, new BlockPos(x, y, z), end - start);
45 | } else {
46 | instance.updateTick(world, x, y, z, rng);
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/util/IMixinASMEventHandler.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.util;
24 |
25 | import cpw.mods.fml.common.ModContainer;
26 |
27 | public interface IMixinASMEventHandler {
28 | ModContainer getOwner();
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/util/Perms.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.util;
24 |
25 | import com.falsepattern.laggoggles.packet.ObjectData;
26 | import com.falsepattern.laggoggles.profiler.ProfileResult;
27 | import com.falsepattern.laggoggles.server.RequestDataHandler;
28 | import com.falsepattern.laggoggles.server.ServerConfig;
29 | import lombok.val;
30 |
31 | import net.minecraft.entity.Entity;
32 | import net.minecraft.entity.player.EntityPlayerMP;
33 | import net.minecraft.server.MinecraftServer;
34 | import net.minecraft.world.WorldServer;
35 | import net.minecraftforge.common.DimensionManager;
36 | import cpw.mods.fml.common.FMLCommonHandler;
37 |
38 | import java.util.ArrayList;
39 | import java.util.List;
40 |
41 | public class Perms {
42 |
43 | public static final double MAX_RANGE_FOR_PLAYERS_HORIZONTAL_SQ = ServerConfig.NON_OPS_MAX_HORIZONTAL_RANGE * ServerConfig.NON_OPS_MAX_HORIZONTAL_RANGE;
44 | public static final double MAX_RANGE_FOR_PLAYERS_VERTICAL_SQ = ServerConfig.NON_OPS_MAX_VERTICAL_RANGE * ServerConfig.NON_OPS_MAX_HORIZONTAL_RANGE;
45 |
46 | public enum Permission{
47 | NONE,
48 | GET,
49 | START,
50 | FULL
51 | }
52 |
53 | public static Permission getPermission(EntityPlayerMP p){
54 | val profile = p.getGameProfile();
55 | val manager = MinecraftServer.getServer().getConfigurationManager();
56 | if (manager.func_152596_g(profile)) {
57 | return Permission.FULL;
58 | } else {
59 | return ServerConfig.NON_OP_PERMISSION_LEVEL;
60 | }
61 | }
62 |
63 | public static boolean hasPermission(EntityPlayerMP player, Permission permission){
64 | return getPermission(player).ordinal() >= permission.ordinal();
65 | }
66 |
67 | @SuppressWarnings("unchecked")
68 | public static ArrayList getLagGogglesUsers(){
69 | ArrayList list = new ArrayList<>();
70 | MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
71 | if(server == null){
72 | return list;
73 | }
74 | ((List) MinecraftServer.getServer().getConfigurationManager().playerEntityList)
75 | .stream()
76 | .filter((ent) -> RequestDataHandler.playersWithLagGoggles.contains(ent.getPersistentID()))
77 | .forEach(list::add);
78 | return list;
79 | }
80 |
81 | public static ProfileResult getResultFor(EntityPlayerMP player, ProfileResult result){
82 | Permission permission = getPermission(player);
83 | if(permission == Permission.NONE){
84 | return ProfileResult.EMPTY_RESULT;
85 | }
86 | if(permission == Permission.FULL){
87 | return result;
88 | }
89 | ProfileResult trimmedResult = result.copyStatsOnly();
90 | for(ObjectData data : result.getData()){
91 | if(isInRange(data, player)){
92 | trimmedResult.addData(data);
93 | }
94 | }
95 | return trimmedResult;
96 | }
97 |
98 | @SuppressWarnings("unchecked")
99 | public static boolean isInRange(ObjectData data, EntityPlayerMP player){
100 | if(data.type == ObjectData.Type.EVENT_BUS_LISTENER){
101 | return ServerConfig.ALLOW_NON_OPS_TO_SEE_EVENT_SUBSCRIBERS;
102 | }
103 | if(data.getValue(ObjectData.Entry.WORLD_ID) != player.dimension){
104 | return false;
105 | }
106 | switch(data.type){
107 | case ENTITY:
108 | WorldServer world = DimensionManager.getWorld(data.getValue(ObjectData.Entry.WORLD_ID));
109 | Entity e;
110 | val uuid = data.getValue(ObjectData.Entry.ENTITY_UUID);
111 | if(world != null && (e = ((List)world.loadedEntityList).stream().filter((ent) -> ent.getPersistentID().equals(uuid))
112 | .findFirst()
113 | .orElse(null)) != null){
114 | return checkRange(player, e.posX, e.posY, e.posZ);
115 | }
116 | return false;
117 | case BLOCK:
118 | case TILE_ENTITY:
119 | return checkRange(player, data.getValue(ObjectData.Entry.BLOCK_POS_X), data.getValue(ObjectData.Entry.BLOCK_POS_Y), data.getValue(ObjectData.Entry.BLOCK_POS_Z));
120 | default:
121 | return false;
122 | }
123 | }
124 |
125 | public static boolean checkRange(EntityPlayerMP player, Integer x, Integer y, Integer z){
126 | return checkRange(player, x.doubleValue(), y.doubleValue(), z.doubleValue());
127 | }
128 |
129 | public static boolean checkRange(EntityPlayerMP player, double x, double y, double z){
130 | double xD = x - player.posX;
131 | double zD = z - player.posZ;
132 |
133 | /* Check horizontal range */
134 | if(xD*xD + zD*zD > MAX_RANGE_FOR_PLAYERS_HORIZONTAL_SQ){
135 | return false;
136 | }
137 |
138 | /* If it's within range, we check if the Y level is whitelisted */
139 | if(y > ServerConfig.NON_OPS_WHITELIST_HEIGHT_ABOVE){
140 | return true;
141 | }
142 |
143 | /* If it's underground, we restrict the results, so you can't abuse it to find spawners, chests, minecarts.. etc. */
144 | double yD = y - player.posY;
145 | return !(yD * yD > MAX_RANGE_FOR_PLAYERS_VERTICAL_SQ);
146 | }
147 | }
148 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/util/RunInClientThread.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.util;
24 |
25 | import cpw.mods.fml.common.FMLCommonHandler;
26 | import cpw.mods.fml.common.eventhandler.SubscribeEvent;
27 | import cpw.mods.fml.common.gameevent.TickEvent;
28 |
29 | public class RunInClientThread {
30 |
31 | private final Runnable runnable;
32 |
33 | public RunInClientThread(Runnable runnable){
34 | this.runnable = runnable;
35 | FMLCommonHandler.instance().bus().register(this);
36 | }
37 |
38 | @SubscribeEvent
39 | public void onClientTick(TickEvent.ClientTickEvent e){
40 | FMLCommonHandler.instance().bus().unregister(this);
41 | runnable.run();
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/util/RunInServerThread.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.util;
24 |
25 | import cpw.mods.fml.common.FMLCommonHandler;
26 | import cpw.mods.fml.common.eventhandler.SubscribeEvent;
27 | import cpw.mods.fml.common.gameevent.TickEvent;
28 |
29 | public class RunInServerThread {
30 |
31 | private final Runnable runnable;
32 |
33 | public RunInServerThread(Runnable runnable){
34 | this.runnable = runnable;
35 | FMLCommonHandler.instance().bus().register(this);
36 | }
37 |
38 | @SubscribeEvent
39 | public void onServerTick(TickEvent.ServerTickEvent e){
40 | FMLCommonHandler.instance().bus().unregister(this);
41 | runnable.run();
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/util/Side.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.util;
24 |
25 | import net.minecraft.client.Minecraft;
26 | import net.minecraft.server.MinecraftServer;
27 | import cpw.mods.fml.common.FMLCommonHandler;
28 |
29 | public enum Side {
30 | DEDICATED_SERVER,
31 | CLIENT_WITHOUT_SERVER,
32 | CLIENT_WITH_SERVER,
33 | UNKNOWN;
34 |
35 | public static Side getSide(){
36 | MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
37 | if(server == null){
38 | return CLIENT_WITHOUT_SERVER;
39 | }else if(server.isDedicatedServer()){
40 | return DEDICATED_SERVER;
41 | }else if(Minecraft.getMinecraft().isSingleplayer()){
42 | return CLIENT_WITH_SERVER;
43 | }
44 | return UNKNOWN;
45 | }
46 |
47 | public boolean isServer(){
48 | return this == DEDICATED_SERVER;
49 | }
50 |
51 | public boolean isPlayingOnServer(){
52 | return this == CLIENT_WITHOUT_SERVER;
53 | }
54 |
55 | public boolean isClient(){
56 | switch (this){
57 | case CLIENT_WITH_SERVER:
58 | case CLIENT_WITHOUT_SERVER:
59 | return true;
60 | default:
61 | return false;
62 | }
63 | }
64 |
65 | public boolean isSinglePlayer(){
66 | switch (this){
67 | case DEDICATED_SERVER:
68 | case CLIENT_WITHOUT_SERVER:
69 | case UNKNOWN:
70 | return false;
71 | case CLIENT_WITH_SERVER:
72 | return true;
73 | }
74 | throw new RuntimeException("Someone forgot to update this piece of code!");
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/util/Teleport.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.util;
24 |
25 | import net.minecraft.entity.Entity;
26 | import net.minecraft.entity.player.EntityPlayerMP;
27 | import net.minecraft.util.ChatComponentText;
28 | import net.minecraft.util.ChatStyle;
29 | import net.minecraft.util.EnumChatFormatting;
30 | import net.minecraft.world.Teleporter;
31 | import net.minecraft.world.WorldServer;
32 | import cpw.mods.fml.common.FMLCommonHandler;
33 |
34 | public class Teleport {
35 |
36 | public static void teleportPlayer(EntityPlayerMP player, int dim, double x, double y, double z){
37 | new RunInServerThread(new Runnable() {
38 | @Override
39 | public void run() {
40 | if(player.dimension != dim) {
41 | teleportPlayerToDimension(player, dim, x, y, z);
42 | }else{
43 | player.setPositionAndUpdate(x,y,z);
44 | }
45 | player.addChatMessage(new ChatComponentText("Teleported to: ").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GREEN))
46 | .appendSibling(new ChatComponentText(" Dim: " + dim).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GRAY)))
47 | .appendSibling(new ChatComponentText(", " + (int) x + ", " + (int) y + ", " + (int) z).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.WHITE))));
48 | }
49 | });
50 | }
51 |
52 | /* Shamelessly stolen from the SpongeCommon source, then ported it to forge. For more info:
53 | * https://github.com/SpongePowered/SpongeCommon/blob/292baf720df84345e02347d75085926b834abfea/src/main/java/org/spongepowered/common/entity/EntityUtil.java
54 | */
55 | protected static class LocalTeleporter extends Teleporter {
56 | protected final WorldServer worldServerInstance;
57 |
58 | public LocalTeleporter(WorldServer world) {
59 | super(world);
60 | this.worldServerInstance = world;
61 | }
62 |
63 | @Override
64 | public void placeInPortal(Entity entity, double d, double d1, double d2, float d3) {
65 | int posX = (int) Math.round(entity.posX);
66 | int posY = (int) Math.round(entity.posY);
67 | int posZ = (int) Math.round(entity.posZ);
68 |
69 | worldServerInstance.getBlock(posX, posY, posZ); // Used to generate chunk
70 | posY = worldServerInstance.getHeightValue(posX, posZ) + 1;
71 | entity.setPosition(entity.posX, posY, entity.posZ);
72 | }
73 | }
74 | private static void teleportPlayerToDimension(EntityPlayerMP playerIn, int suggestedDimensionId, double x, double y, double z) {
75 | WorldServer toWorld = FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(suggestedDimensionId);
76 | playerIn.mcServer.getConfigurationManager().transferPlayerToDimension(playerIn, suggestedDimensionId, new LocalTeleporter(toWorld));
77 | playerIn.setPositionAndUpdate(x, y, z);
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/src/main/java/com/falsepattern/laggoggles/util/ThreadChecker.java:
--------------------------------------------------------------------------------
1 | /*
2 | * LagGoggles: Legacy
3 | *
4 | * Copyright (C) 2022-2025 FalsePattern
5 | * All Rights Reserved
6 | *
7 | * The above copyright notice and this permission notice shall be included
8 | * in all copies or substantial portions of the Software.
9 | *
10 | * This program is free software: you can redistribute it and/or modify
11 | * it under the terms of the GNU Lesser General Public License as published by
12 | * the Free Software Foundation, only version 3 of the License.
13 | *
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | */
22 |
23 | package com.falsepattern.laggoggles.util;
24 |
25 | import com.falsepattern.laggoggles.profiler.TimingManager;
26 |
27 | import net.minecraft.server.MinecraftServer;
28 | import cpw.mods.fml.common.FMLCommonHandler;
29 |
30 | public class ThreadChecker {
31 |
32 | //TODO evil black magic
33 | public static TimingManager.EventTimings.ThreadType getThreadType(){
34 | MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
35 | if(server == null){
36 | /* No server at all. Multiplayer... probably. */
37 | if(Thread.currentThread().getName().equals("Client thread")){
38 | return TimingManager.EventTimings.ThreadType.CLIENT;
39 | }
40 | }else{
41 | if (server.isDedicatedServer()) {
42 | /* Dedicated server */
43 | if (Thread.currentThread().getName().equals("Server thread")) {
44 | return TimingManager.EventTimings.ThreadType.SERVER;
45 | }
46 | } else {
47 | /* Not a dedicated server, we have both the client and server classes. */
48 | if (Thread.currentThread().getName().equals("Server thread")) {
49 | return TimingManager.EventTimings.ThreadType.SERVER;
50 | } else if (Thread.currentThread().getName().equals("Client thread")) {
51 | return TimingManager.EventTimings.ThreadType.CLIENT;
52 | }
53 | }
54 | }
55 | return TimingManager.EventTimings.ThreadType.ASYNC;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/main/resources/META-INF/laggoggles_at.cfg:
--------------------------------------------------------------------------------
1 | public net.minecraft.client.renderer.WorldRenderer field_78915_A # isInitialized
--------------------------------------------------------------------------------
/src/main/resources/assets/laggoggles/donate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FalsePattern/LagGogglesLegacy/d57008315911b906100a64ce1a042a9fcab635a2/src/main/resources/assets/laggoggles/donate.png
--------------------------------------------------------------------------------
/src/main/resources/assets/laggoggles/download.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FalsePattern/LagGogglesLegacy/d57008315911b906100a64ce1a042a9fcab635a2/src/main/resources/assets/laggoggles/download.png
--------------------------------------------------------------------------------
/src/main/resources/assets/laggoggles/lang/en_US.lang:
--------------------------------------------------------------------------------
1 | #%1$s are for line breaks.
2 | config.laggoggles.client.gradientworld=Gradient maxed out at microseconds
3 | config.laggoggles.client.gradientworld.tooltip=Define the number of microseconds at which an object is marked with a deep red colour for WORLD lag.
4 | config.laggoggles.client.gradientfps=Gradient maxed out at nanoseconds fps
5 | config.laggoggles.client.gradientfps.tooltip=Define the number of nanoseconds at which an object is marked with a deep red colour for FPS lag.
6 | config.laggoggles.client.minmicros=Minimum amount of microseconds threshold
7 | config.laggoggles.client.minmicros.tooltip=What is the minimum amount of microseconds required before an object is tracked in the client?\nThis is only for WORLD lag.\nThis also affects the analyze results window
8 | config.laggoggles.client.colors=Colors
9 | config.laggoggles.client.colors.tooltip=If you're colorblind, change this to fit your needs.
10 | gui.laggoggles.button.donate.name=Donate
11 | gui.laggoggles.button.download.hover=Download the latest available%1$sworld result from the server.
12 | gui.laggoggles.button.download.hover.notop=Because you're not opped, the results%1$swill be trimmed to your surroundings.
13 | gui.laggoggles.button.download.hover.cooldown=Remember: There's a cooldown on this, you%1$smay have to wait before you can use it again.
14 | gui.laggoggles.button.options.name=Options
15 | gui.laggoggles.button.profile.fps.name=FPS
16 | gui.laggoggles.button.profile.world.name=World
17 | gui.laggoggles.button.profile.server.noperms=No perms
18 | gui.laggoggles.text.fpswarning=Profiling FPS... For the best results, do not look around.
19 | gui.laggoggles.text.cantseeresults=You can't see these results because the%1$sserver has disabled it in their config.
20 | gui.laggoggles.text.threadtype.async=Asynchronous
21 | gui.laggoggles.text.threadtype.gui=GUI thread
22 | gui.laggoggles.text.threadtype.server=Server thread
23 | gui.laggoggles.text.fpsresults.titledescription=profile data for FPS scan results
24 | gui.laggoggles.text.fpsresults.present=Times are presented in nanoseconds per frame
25 | gui.laggoggles.text.worldresults.titledescription=profile data for WORLD scan results
26 | gui.laggoggles.text.worldresults.present=Times are presented in microseconds
27 | gui.laggoggles.text.results.singleentities=Single entities
28 | gui.laggoggles.text.results.teleport=Doubleclick to teleport
29 | gui.laggoggles.text.results.entitiesbytype=Entities by type
30 | gui.laggoggles.text.results.eventsub=Event subscribers
31 | gui.laggoggles.text.profile.start=Profile for %d seconds
32 | gui.laggoggles.text.profile.limited=Limited to %d seconds
33 | gui.laggoggles.text.profile.running=%s > %d seconds
34 | gui.laggoggles.text.profile.sending=Sending command...
35 | gui.laggoggles.text.profile.hide=Hide latest scan results
36 | gui.laggoggles.text.profile.show=Show latest scan results
37 | gui.laggoggles.text.profile.analyze=Analyze results
38 | gui.laggoggles.text.profile.scrollhint=Scroll while hovering over the button%1$sto change the time!
39 | gui.laggoggles.text.error=Error! Please submit an issue on github
--------------------------------------------------------------------------------
/src/main/resources/assets/laggoggles/lang/es_ES.lang:
--------------------------------------------------------------------------------
1 | #%1$s are for line breaks.
2 | config.laggoggles.client.gradientworld=Gradiente llegó al máximo en microsegundos
3 | config.laggoggles.client.gradientworld.tooltip=Define el número de microsegundos en los que un objeto se marca con un color rojo intenso para WORLD lag.
4 | config.laggoggles.client.gradientfps=Gradiente llegó al máximo en microsengundos fps
5 | config.laggoggles.client.gradientfps.tooltip=Define el número de microsegundos en los que un objeto se marca con un color rojo intenso para FPS lag.
6 | config.laggoggles.client.minmicros=Umbral de microsegundos mínimo
7 | config.laggoggles.client.minmicros.tooltip=¿Cuál es la cantidad mínima de microsegundos necesaria para que un objeto sea rastreado en el cliente?\nEsto es apenas para WORLD lag.\nEsto también afecta a la ventana de análisis de resultados
8 | config.laggoggles.client.colors=Colores
9 | config.laggoggles.client.colors.tooltip=Si eres daltónico(a), cambia esto para que se ajuste a tus necesidades.
10 | gui.laggoggles.button.donate.name=Donativo
11 | gui.laggoggles.button.download.hover=Descargue el último resultado%1$sdel mundo disponible en el servidor.
12 | gui.laggoggles.button.download.hover.notop=Porque no tienes permissiones de admin, tus resultados%1$svan ser ajustados a tus alrededores.
13 | gui.laggoggles.button.download.hover.cooldown=Remember: Hay un cooldown en esto, tu%1$spuedes tener que esperar antes de poder usarlo de nuevo.
14 | gui.laggoggles.button.options.name=Opciones
15 | gui.laggoggles.button.profile.fps.name=FPS
16 | gui.laggoggles.button.profile.world.name=World
17 | gui.laggoggles.button.profile.server.noperms=Sin permissiones
18 | gui.laggoggles.text.fpswarning=Profilando FPS... Para obtener los mejores resultados, no mire a su alrededor.
19 | gui.laggoggles.text.cantseeresults=No puedes ver estos resultados porque%1$sel servidor lo ha desactivado en su configuración.
20 | gui.laggoggles.text.threadtype.async=Asíncrono
21 | gui.laggoggles.text.threadtype.gui=GUI thread
22 | gui.laggoggles.text.threadtype.server=Server thread
23 | gui.laggoggles.text.fpsresults.titledescription=datos del perfil para los resultados de la exploración FPS
24 | gui.laggoggles.text.fpsresults.present=Tiempos son apresentados por nanosegundos por frame
25 | gui.laggoggles.text.worldresults.titledescription=datos del perfil para los resultados de la exploración WORLD
26 | gui.laggoggles.text.worldresults.present=Tiempos son apresentados por nanosegundos
27 | gui.laggoggles.text.results.singleentities=Entidades únicas
28 | gui.laggoggles.text.results.teleport=Doble-Clic para teletransportar
29 | gui.laggoggles.text.results.entitiesbytype=Entidades por tipo
30 | gui.laggoggles.text.results.eventsub=Event subscribers
31 | gui.laggoggles.text.profile.start=Perfil por %d seconds
32 | gui.laggoggles.text.profile.limited=Limitado a %d segundos
33 | gui.laggoggles.text.profile.running=%s > %d segundos
34 | gui.laggoggles.text.profile.sending=Enviando comando...
35 | gui.laggoggles.text.profile.hide=Muestre últimos resultados del escaneo
36 | gui.laggoggles.text.profile.show=Oculta últimos resultados del escaneo
37 | gui.laggoggles.text.profile.analyze=Analíze los resultados
38 | gui.laggoggles.text.profile.scrollhint=¡Use el scroll wheel al pasar por encima del botón%1$spara mudar el tiempo!
39 | gui.laggoggles.text.error=¡Error! Por favor, envíe un problema en github
40 |
--------------------------------------------------------------------------------
/src/main/resources/assets/laggoggles/lang/pt_PT.lang:
--------------------------------------------------------------------------------
1 | #%1$s are for line breaks.
2 | config.laggoggles.client.gradientworld=Gradiente maximizou em microssegundos
3 | config.laggoggles.client.gradientworld.tooltip=Define o número de microssegundos em que um objeto é marcado com uma cor vermelha profunda para WORLD lag.
4 | config.laggoggles.client.gradientfps=Gradiente maximizou em nanossegundos fps
5 | config.laggoggles.client.gradientfps.tooltip=Define o número de microssegundos em que um objeto é marcado com uma cor vermelha profunda para FPS lag.
6 | config.laggoggles.client.minmicros=Limite de quantidade mínima de microssegundos
7 | config.laggoggles.client.minmicros.tooltip=Qual é a quantidade mínima de microssegundos necessária antes que um objeto seja rastreado no cliente?\nIsto é apenas para WORLD lag.\nIsto também afeta a janela de resultados da análise
8 | config.laggoggles.client.colors=Cores
9 | config.laggoggles.client.colors.tooltip=Se és daltónico(a), muda isto para as tuas necessidades.
10 | gui.laggoggles.button.donate.name=Doações
11 | gui.laggoggles.button.download.hover=Baixe o resultado do mundo%1$sdisponível mais recente do servidor.
12 | gui.laggoggles.button.download.hover.notop=Porque não tens permissões de admin, os resultados%1$svão ser reduzidos aos teus arredores.
13 | gui.laggoggles.button.download.hover.cooldown=Lembra-te: Tens um cooldown nisto, vais%1$ster de espera antes de usá-lo outra vez.
14 | gui.laggoggles.button.options.name=Opções
15 | gui.laggoggles.button.profile.fps.name=FPS
16 | gui.laggoggles.button.profile.world.name=World
17 | gui.laggoggles.button.profile.server.noperms=Sem permissões
18 | gui.laggoggles.text.fpswarning=Traçando FPS... Para os melhores resultados, não te movas.
19 | gui.laggoggles.text.cantseeresults=Não podes ver os resultados porque o%1$sservidor desativou-o na sua configuração.
20 | gui.laggoggles.text.threadtype.async=Assíncrono
21 | gui.laggoggles.text.threadtype.gui=GUI thread
22 | gui.laggoggles.text.threadtype.server=Server thread
23 | gui.laggoggles.text.fpsresults.titledescription=Perfil de dados para resultados de escaneamento de FPS
24 | gui.laggoggles.text.fpsresults.present=Os tempos são apresentados em nanossegundos por frame
25 | gui.laggoggles.text.worldresults.titledescription=Perfil de dados para resultados de escaneamento de WORLD
26 | gui.laggoggles.text.worldresults.present=Tempos são apresentados em microssegundos
27 | gui.laggoggles.text.results.singleentities=Entidades singulares
28 | gui.laggoggles.text.results.teleport=Duplo-clique para teletransportar
29 | gui.laggoggles.text.results.entitiesbytype=Entidades por tipo
30 | gui.laggoggles.text.results.eventsub=Event subscribers
31 | gui.laggoggles.text.profile.start=Escaneie por %d segundos
32 | gui.laggoggles.text.profile.limited=Limitado a %d segundos
33 | gui.laggoggles.text.profile.running=%s > %d segundos
34 | gui.laggoggles.text.profile.sending=Enviando comando...
35 | gui.laggoggles.text.profile.hide=Esconde resultados de scan mais recentes
36 | gui.laggoggles.text.profile.show=Mostra resultados de scan mais recentes
37 | gui.laggoggles.text.profile.analyze=Analize resultados
38 | gui.laggoggles.text.profile.scrollhint=Use o scroll wheel enquanto paira sobre o botão%1$spara mudar o tempo!
39 | gui.laggoggles.text.error=Erro! Por favor, submeta um problema no github
40 |
--------------------------------------------------------------------------------
/src/main/resources/assets/laggoggles/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FalsePattern/LagGogglesLegacy/d57008315911b906100a64ce1a042a9fcab635a2/src/main/resources/assets/laggoggles/logo.png
--------------------------------------------------------------------------------
/src/main/resources/mcmod.info:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modid": "${modId}",
4 | "name": "${modName}",
5 | "description": "Find lag on the server with ease.",
6 | "version": "${modVersion}",
7 | "mcversion": "${minecraftVersion}",
8 | "url": "https://github.com/FalsePattern/LagGogglesLegacy",
9 | "updateUrl": "",
10 | "authorList": ["Terminator_NL", "FalsePattern"],
11 | "credits": "",
12 | "logoFile": "assets/laggoggles/logo.png",
13 | "screenshots": [],
14 | "dependencies": ["falsepatternlib"]
15 | }
16 | ]
17 |
--------------------------------------------------------------------------------
/src/main/resources/mixins.laggoggles.json:
--------------------------------------------------------------------------------
1 | {
2 | "required": true,
3 | "minVersion": "0.8.5",
4 | "package": "com.falsepattern.laggoggles.mixin.mixins",
5 | "plugin": "com.falsepattern.laggoggles.mixin.plugin.MixinPlugin",
6 | "refmap": "mixins.laggoggles.refmap.json",
7 | "target": "@env(DEFAULT)",
8 | "compatibilityLevel": "JAVA_8"
9 | }
10 |
11 |
--------------------------------------------------------------------------------
/src/main/resources/mixins.preinit.json:
--------------------------------------------------------------------------------
1 | {
2 | "required": true,
3 | "minVersion": "0.8.3",
4 | "package": "com.falsepattern.laggoggles.mixin.mixins",
5 | "refmap": "mixins.laggoggles.refmap.json",
6 | "target": "@env(PREINIT)",
7 | "compatibilityLevel": "JAVA_8",
8 | "mixins": [
9 | "common.vanilla.MixinEventBus"
10 | ]
11 | }
12 |
13 |
--------------------------------------------------------------------------------
/src/main/resources/pack.mcmeta:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------