From 431e4fc9d1657a50ebc34b8ac24f9bfaea06417f Mon Sep 17 00:00:00 2001
From: Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com>
Date: Sat, 17 Sep 2022 19:39:05 +0800
Subject: Initial move to babel + change fetch to use async/await
---
src/features/performance/hiddenRequirement.js | 7 ++
src/features/performance/index.js | 128 ++++++++++++++++++++++++++
src/features/performance/metadata.json | 8 ++
3 files changed, 143 insertions(+)
create mode 100644 src/features/performance/hiddenRequirement.js
create mode 100644 src/features/performance/index.js
create mode 100644 src/features/performance/metadata.json
(limited to 'src/features/performance')
diff --git a/src/features/performance/hiddenRequirement.js b/src/features/performance/hiddenRequirement.js
new file mode 100644
index 0000000..bc74bfc
--- /dev/null
+++ b/src/features/performance/hiddenRequirement.js
@@ -0,0 +1,7 @@
+let allowedUUIDS = [
+ "dc8c39647b294e03ae9ed13ebd65dd29"
+]
+
+module.exports = {hidden: function(featureManager){
+ return !allowedUUIDS.includes(Player.getUUID().toString().replace(/-/g, ""))
+}}
\ No newline at end of file
diff --git a/src/features/performance/index.js b/src/features/performance/index.js
new file mode 100644
index 0000000..634b994
--- /dev/null
+++ b/src/features/performance/index.js
@@ -0,0 +1,128 @@
+///
+///
+import Feature from "../../featureClass/class";
+import SettingBase from "../settings/settingThings/settingBase";
+import ToggleSetting from "../settings/settingThings/toggle";
+
+class Performance extends Feature {
+ constructor() {
+ super()
+ }
+
+ onEnable() {
+ return;
+ new SettingBase("NOTE: If you dont use any of the features, disable this", "Having performance enabled will decrease performance if no features are used\n(this is due to it using the render entity event)", true, "hide_performance_description", this)
+
+ this.armourStandCapSetting = new ToggleSetting("Armorstand render cap", "Limits the max number of armor stands rendered to 50\n(50 closest to player)", true, "armorstand_render_cap", this)
+
+ this.entitysRenderingTemp = {}
+ this.entitysRendering = {}
+
+ this.dontRender = {}
+
+ // this.removeHiddenEnts = []
+
+ this.nextUpdateDontRender = 0
+ this.maxEntsRender = 50
+ this.armourstandClass = Java.type("net.minecraft.entity.item.EntityArmorStand").class
+ this.armourstandClassString = this.armourstandClass.toString()
+
+ this.registerStep(true, 5, this.updateDontRender)
+
+ this.registerEvent("renderEntity", this.renderEntity)
+ this.registerEvent("renderWorld", this.renderWorld)
+
+ // this.registerForge(net.minecraftforge.event.entity.living.LivingAttackEvent, this.entityAttackEvent);
+ }
+
+ // entityAttackEvent(event) { //TODO: maby make an actual feature for this (0ping 1tap)
+ // if (event.source.func_76346_g() === Player.getPlayer()) {
+ // if(event.entity.func_110143_aJ()<800000){
+
+ // let uuid = new Entity(event.entity).getUUID().toString()
+ // this.dontRender[uuid] = "hit"
+ // this.removeHiddenEnts.push([uuid, Date.now()+1000])
+ // }
+ // }
+ // }
+
+ renderWorld() {
+ if (!this.armourStandCapSetting.getValue()) return
+ this.entitysRendering = {}
+ Object.keys(this.entitysRenderingTemp).forEach(a => {
+ this.entitysRendering[a] = true
+ })
+ this.entitysRenderingTemp = {}
+ }
+
+ updateDontRender() {
+ if (!this.armourStandCapSetting.getValue()) return
+
+ // this.removeHiddenEnts = this.removeHiddenEnts.filter(([uuid, time])=>{
+ // if(Date.now()