aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSoopyboo32 <49228220+Soopyboo32@users.noreply.github.com>2022-05-29 12:04:52 +0800
committerSoopyboo32 <49228220+Soopyboo32@users.noreply.github.com>2022-05-29 12:04:52 +0800
commita6593709b0e1e99e241b6c163fe66623685b6efc (patch)
tree9714e82716caf9edd6be05a1822fa492eb6756ed
parenta7dcf231cc43c9ef73d6a969203c2dafd2ce8caf (diff)
downloadSoopyV2-a6593709b0e1e99e241b6c163fe66623685b6efc.tar.gz
SoopyV2-a6593709b0e1e99e241b6c163fe66623685b6efc.tar.bz2
SoopyV2-a6593709b0e1e99e241b6c163fe66623685b6efc.zip
first part of supporting java side rendering
-rw-r--r--featureClass/class.js11
-rw-r--r--featureClass/featureManager.js4
-rw-r--r--featureClass/forgeEvents.js24
-rw-r--r--features/dungeonSolvers/index.js4
-rw-r--r--features/globalSettings/index.js4
-rw-r--r--features/hud/HudTextElement.js53
-rw-r--r--features/hud/index.js28
-rw-r--r--features/lockedFeatures/index.js5
-rw-r--r--features/mining/index.js7
-rw-r--r--features/settings/settingThings/location.js3
-rw-r--r--features/settings/settingThings/toggle.js24
-rw-r--r--features/slayers/index.js7
-rw-r--r--index.js4
-rw-r--r--utils/renderJavaUtils.js319
14 files changed, 387 insertions, 110 deletions
diff --git a/featureClass/class.js b/featureClass/class.js
index d595e4b..b8a17d9 100644
--- a/featureClass/class.js
+++ b/featureClass/class.js
@@ -79,17 +79,16 @@ class Feature {
delete this.soopyEvents[event.id]
}
- registerForge(event, func, messageIfError) {
+ registerForge(event, func, priority) {
let theEvent
try {
- theEvent = this.FeatureManager.registerForge(event, func, this)
- } catch (e) { //TODO: option to disable this chat message + fallback register for some that support (eg fallback of RenderWorldLastEvent to ct 'renderWorld')
- if (!messageIfError) messageIfError = "An error occured while registering the event " + event.class.toString().split(".").pop() + ", this may cause " + this.constructor.name + " to not work properly."
- ChatLib.chat(this.FeatureManager.messagePrefix + messageIfError)
+ theEvent = this.FeatureManager.registerForge(event, func, priority, this)
+ } catch (e) {
+ ChatLib.chat(this.FeatureManager.messagePrefix + "An error occured while registering the event " + event.class.toString().split(".").pop() + ", this may cause " + this.constructor.name + " to not work properly.")
}
if (theEvent) this.forgeEvents[theEvent.id] = theEvent
- return new ForgeEvent(theEvent, theEvent.trigger, [event, func, messageIfError], this)
+ return new ForgeEvent(theEvent, theEvent.trigger, [event, func, priority], this)
}
unregisterForge(event) {
diff --git a/featureClass/featureManager.js b/featureClass/featureManager.js
index e27208f..991f549 100644
--- a/featureClass/featureManager.js
+++ b/featureClass/featureManager.js
@@ -439,13 +439,13 @@ class FeatureManager {
return this.customEvents[id]
}
- registerForge(event, func, context) {
+ registerForge(event, func, priority, context) {
let id = this.lastForgeEventId++
this.forgeEvents[id] = {
func: func,
context: context,
- trigger: registerForgeBase(event, (...args) => {
+ trigger: registerForgeBase(event, priority, (...args) => {
try {
if (context.enabled) {
if (this.recordingPerformanceUsage) this.startRecordingPerformance(context.constructor.name, event.class.name)
diff --git a/featureClass/forgeEvents.js b/featureClass/forgeEvents.js
index e852c49..fb723b1 100644
--- a/featureClass/forgeEvents.js
+++ b/featureClass/forgeEvents.js
@@ -4,15 +4,20 @@ importPackage(org.objectweb.asm)
importClass(java.lang.ClassLoader)
importClass(org.apache.commons.lang3.RandomStringUtils)
importClass(java.util.function.Consumer)
+importClass(net.minecraftforge.fml.common.eventhandler.EventPriority)
const L = s => `L${s};`
-
const LoadedInsts = []
-function defineClassBytes(name, bytes) {
+function defineClassBytes(name, bytes) {//should support multymc? ty dawjaw https://canary.discord.com/channels/119493402902528000/688773480954855537/979959207124168744
const classLoader = Packages.com.chattriggers.ctjs.CTJS.class.getClassLoader()
- const defClass = ClassLoader.class.getDeclaredMethods()[23] // defineClass()
+ let defClass;
+ ClassLoader.class.getDeclaredMethods().forEach(m => {
+ if (m.toString() === "protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int) throws java.lang.ClassFormatError") {
+ defClass = m;
+ }
+ })
defClass.setAccessible(true)
@@ -22,7 +27,7 @@ function defineClassBytes(name, bytes) {
return defClass.invoke(classLoader, n, bytes, o, s)
}
-const registerForge = (e, cb) => {
+const registerForge = (e, priority = EventPriority.NORMAL, cb) => {
const cw = new ClassWriter(0)
const event = Type.getType(e.class).internalName
@@ -35,7 +40,7 @@ const registerForge = (e, cb) => {
const obj = Type.getType(java.lang.Object.class).internalName
cw.visit(Opcodes.V1_8, Opcodes.ACC_PUBLIC, name, null, obj, null)
- // cw.visitInnerClass("net/minecraftforge/event/entity/player/PlayerEvent$BreakSpeed", "net/minecraftforge/event/entity/player/PlayerEvent", "BreakSpeed", ACC_PUBLIC + ACC_STATIC);
+ //cw.visitInnerClass("net/minecraftforge/event/entity/player/PlayerEvent$BreakSpeed","net/minecraftforge/event/entity/player/PlayerEvent","BreakSpeed",ACC_PUBLIC+ACC_STATIC);
{
cw.visitField(Opcodes.ACC_PRIVATE + Opcodes.ACC_FINAL, "callback", L(consumer), L(consumer + "<" + L(event) + ">"), null).visitEnd()
}
@@ -44,7 +49,7 @@ const registerForge = (e, cb) => {
con.visitCode()
con.visitVarInsn(Opcodes.ALOAD, 0)
con.visitMethodInsn(Opcodes.INVOKESPECIAL, obj, "<init>", "()V", false)
-
+
con.visitVarInsn(Opcodes.ALOAD, 0)
con.visitVarInsn(Opcodes.ALOAD, 1)
con.visitFieldInsn(Opcodes.PUTFIELD, name, "callback", L(consumer))
@@ -59,6 +64,7 @@ const registerForge = (e, cb) => {
const mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "on", "(" + L(event) + ")V", null, null)
{
const av = mv.visitAnnotation(L(subscribeEvent), true)
+ av.visitEnum("priority", "Lnet/minecraftforge/fml/common/eventhandler/EventPriority;", priority.name());
av.visitEnd()
}
mv.visitCode()
@@ -75,7 +81,7 @@ const registerForge = (e, cb) => {
const inst = defineClassBytes(name, cw.toByteArray())
.getDeclaredConstructor(Consumer.class)
.newInstance(new java.util.function.Consumer({
- accept: function (t) { cb(t) }
+ accept: function (t) { cb(t) }
}))
LoadedInsts.push(inst)
return inst;
@@ -86,8 +92,8 @@ const unregisterForge = inst => {
}
register("gameUnload", () => {
- LoadedInsts.forEach(unregisterForge)
+ LoadedInsts.forEach(unregisterForge)
LoadedInsts.length = 0
})
-export { registerForge, unregisterForge }
+export { registerForge, unregisterForge } \ No newline at end of file
diff --git a/features/dungeonSolvers/index.js b/features/dungeonSolvers/index.js
index 5b675a7..d753b43 100644
--- a/features/dungeonSolvers/index.js
+++ b/features/dungeonSolvers/index.js
@@ -487,10 +487,6 @@ class DungeonSolvers extends Feature {
} else {
this.spiritBearSpawnElement.setText("");
}
-
- for (let element of this.hudElements) {
- element.render();
- }
}
onWorldLoad() {
diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js
index 39a2714..b77fd0e 100644
--- a/features/globalSettings/index.js
+++ b/features/globalSettings/index.js
@@ -73,10 +73,6 @@ class GlobalSettings extends Feature {
this.registerEvent("tick", this.fixNEU)
}
- if (net.minecraftforge.fml.common.Loader.isModLoaded("SoopyV2")) {
-
- }
-
this.registerCommand("soopyweight", (user = Player.getName()) => {
this.soopyWeight(user)
})
diff --git a/features/hud/HudTextElement.js b/features/hud/HudTextElement.js
index 46c660d..de031a2 100644
--- a/features/hud/HudTextElement.js
+++ b/features/hud/HudTextElement.js
@@ -1,3 +1,5 @@
+import { HudText } from "../../utils/renderJavaUtils"
+
class HudTextElement {
constructor() {
this.text = ""
@@ -5,8 +7,6 @@ class HudTextElement {
this.toggleSetting = undefined
this.locationSetting = undefined
- this.blackText = "&0" + ChatLib.removeFormatting(this.text)
-
this.editTempTimeV = 0
this.editTempTextV = undefined
@@ -16,8 +16,9 @@ class HudTextElement {
this.tempDisableTime = 0
this.renderTextCache = [""]
- this.renderBlackTextCache = [""]
this.textChanged = false
+
+ this.renderElm = new HudText([""], 0, 0, true).startRender()
}
setBaseEditWidth(width) {
@@ -34,25 +35,30 @@ class HudTextElement {
if (text === this.text) return this
this.text = text
- if (this.locationSetting && this.locationSetting.shadowType === 2) {
- this.blackText = "&0" + ChatLib.removeFormatting(text)
- }
+ this.renderTextCache = ChatLib.addColor(this.text).split("\n")
- this.renderTextCache = this.text.split("\n")
- this.renderBlackTextCache = this.blackText.split("\n")
+ this.renderElm.setText(this.renderTextCache)
return this
}
setToggleSetting(setting) {
this.toggleSetting = setting
+ setting.onChange = () => {
+ if (this.toggleSetting.getValue()) {
+ this.renderElm.startRender()
+ } else {
+ this.renderElm.stopRender()
+ }
+ }
return this
}
setLocationSetting(setting) {
this.locationSetting = setting
setting.setParent(this)
- if (this.locationSetting.shadowType === 2) {
- this.blackText = "&0" + ChatLib.removeFormatting(text)
+ setting.onChange = () => {
+ this.renderElm.setX(this.locationSetting.x).setY(this.locationSetting.y).setScale(this.locationSetting.scale)
}
+ this.renderElm.setX(this.locationSetting.x).setY(this.locationSetting.y).setScale(this.locationSetting.scale)
return this
}
@@ -93,24 +99,6 @@ class HudTextElement {
return this.renderTextCache
}
- getBlackText() {
- if (Date.now() - this.editTempTimeV < 100) {
- let text = this.text
- let blackText = this.blackText
- if (this.editTempTextV) {
- text = this.editTempTextV
- blackText = "&0" + ChatLib.removeFormatting(text)
- }
-
- if (ChatLib.removeFormatting(text) === "") {
- blackText = "&0Empty string"
- }
-
- return blackText.split("\n")
- }
- return this.renderBlackTextCache
- }
-
renderRaw() {
let text = this.getText()
@@ -123,15 +111,6 @@ class HudTextElement {
case 1:
Renderer.drawStringWithShadow(line, this.locationSetting.x / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i)
break;
- case 2:
- let blackText = this.getBlackText()
- Renderer.drawString(blackText[i], (this.locationSetting.x + 1) / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i)
- Renderer.drawString(blackText[i], (this.locationSetting.x - 1) / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i)
- Renderer.drawString(blackText[i], this.locationSetting.x / this.locationSetting.scale, (this.locationSetting.y + 1) / this.locationSetting.scale + 9 * i)
- Renderer.drawString(blackText[i], this.locationSetting.x / this.locationSetting.scale, (this.locationSetting.y - 1) / this.locationSetting.scale + 9 * i)
-
- Renderer.drawString(line, this.locationSetting.x / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i)
- break;
}
}
}
diff --git a/features/hud/index.js b/features/hud/index.js
index c6254d4..7d07085 100644
--- a/features/hud/index.js
+++ b/features/hud/index.js
@@ -137,6 +137,7 @@ class Hud extends Feature {
scale: this.spotifyElement.locationSetting.scale,
shadowType: this.spotifyElement.locationSetting.shadowType
})
+ this.spotifyElement2.renderElm.stopRender()
let hudStatTypes = {
"cata": "Catacombs level + Exp",
@@ -311,6 +312,14 @@ class Hud extends Feature {
}
tick() {
+ if (this.fpsFastSetting.getValue()) {
+ if (this.fpsLowSetting.getValue()) {
+ this.fpsElement.setText("&6Fps&7> &f" + Math.round(this.fps.get()) + "&7/" + Math.round(this.lowFps.get()))
+ } else {
+ this.fpsElement.setText("&6Fps&7> &f" + Math.round(this.fps.get()))
+ }
+ }
+
if (!this.lagEnabled.getValue()) return
if (this.packetMoves > 0) {
this.secondPackets++
@@ -329,22 +338,9 @@ class Hud extends Feature {
}
renderHud() {
- if (this.fpsFastSetting.getValue()) {
- if (this.fpsLowSetting.getValue()) {
- this.fpsElement.setText("&6Fps&7> &f" + Math.round(this.fps.get()) + "&7/" + Math.round(this.lowFps.get()))
- } else {
- this.fpsElement.setText("&6Fps&7> &f" + Math.round(this.fps.get()))
- }
- }
-
- for (let element of this.hudElements) {
- element.render()
- }
-
if (this.showSpotifyPlaying.getValue() && Date.now() - this.spotifyElement.tempDisableTime > 100) {
let scale = this.spotifyElement.locationSetting.scale
let spotifyWidth1 = this.spotifyElement.getWidth() * scale
- this.spotifyElement.render()
this.spotifyElement2.locationSetting.x = this.spotifyElement.locationSetting.x + spotifyWidth1
this.spotifyElement2.locationSetting.y = this.spotifyElement.locationSetting.y
this.spotifyElement2.locationSetting.scale = scale
@@ -373,10 +369,6 @@ class Hud extends Feature {
if (this.witherImpactCooldownSetting.getValue() && Date.now() - this.lastWitherImpact < 10000) {
Renderer.drawString(Math.max(0, Math.ceil((5000 - (Date.now() - this.lastWitherImpact)) / 1000)) + "s", Renderer.screen.getWidth() / 2 - Renderer.getStringWidth(Math.max(0, Math.ceil((5000 - (Date.now() - this.lastWitherImpact)) / 1000)) + "s") / 2, Renderer.screen.getHeight() / 2 - 15)
}
-
- for (let stat of this.hudStat) {
- stat.textElement.render()
- }
}
renderWorld() {
@@ -484,7 +476,7 @@ class Hud extends Feature {
if (!Player.getPlayer()) return
if (!Player.getInventory()) return
- if (!this.FeatureManager.features["dataLoader"].class.isInSkyblock) {
+ if (this.FeatureManager.features["dataLoader"] && !this.FeatureManager.features["dataLoader"].class.isInSkyblock) {
this.soulflowElement.setText("")
this.petElement.setText("")
return
diff --git a/features/lockedFeatures/index.js b/features/lockedFeatures/index.js
index 44a4139..2826626 100644
--- a/features/lockedFeatures/index.js
+++ b/features/lockedFeatures/index.js
@@ -29,7 +29,6 @@ class LockedFeatures extends Feature {
this.eventCommand = undefined
this.registerStep(true, 1, this.step)
- this.registerEvent("renderOverlay", this.renderOverlay).registeredWhen(() => this.guildEventLb.getValue())
}
step() {
@@ -107,10 +106,6 @@ class LockedFeatures extends Feature {
this.guildLbElement.setText(text)
}
- renderOverlay() {
- this.hudElements.forEach(a => a.render())
- }
-
initVariables() {
}
diff --git a/features/mining/index.js b/features/mining/index.js
index a05552d..8c6ce12 100644
--- a/features/mining/index.js
+++ b/features/mining/index.js
@@ -53,7 +53,6 @@ class Mining extends Feature {
this.armourstandClass = Java.type("net.minecraft.entity.item.EntityArmorStand").class
- this.registerEvent("renderOverlay", this.renderOverlay).registeredWhen(() => this.balRespawnHud.getValue() || this.compactProgressHud.getValue())
this.registerEvent("tick", this.tick)
this.registerEvent("itemTooltip", this.itemTooltipEvent).registeredWhen(() => this.showContainedGemstoneSlots.getValue() || this.showUnlockedGemstoneSlots.getValue())
this.registerEvent("renderWorld", this.renderWorld).registeredWhen(() => this.guessBalHp.getValue())
@@ -218,12 +217,6 @@ class Mining extends Feature {
}
}
- renderOverlay() {
- for (let element of this.hudElements) {
- element.render()
- }
- }
-
initVariables() {
this.hudElements = undefined
this.guessBalHp = undefined
diff --git a/features/settings/settingThings/location.js b/features/settings/settingThings/location.js
index 70e1527..9cd13af 100644
--- a/features/settings/settingThings/location.js
+++ b/features/settings/settingThings/location.js
@@ -26,6 +26,8 @@ class LocationSetting extends ButtonSetting {
this.resizePoint = 0
this.resizeInitialPos = [0, 0, 0, 0, 0, 0]
+ this.onChange = undefined
+
this.parent = undefined
this.soopyGui = new SoopyGui()
@@ -146,6 +148,7 @@ class LocationSetting extends ButtonSetting {
_updateValue() {
this.setValue([this.x, this.y, this.scale, this.shadowType])
+ if (this.onChange) this.onChange()
}
editTempText(text) {
diff --git a/features/settings/settingThings/toggle.js b/features/settings/settingThings/toggle.js
index d839b8f..200ac87 100644
--- a/features/settings/settingThings/toggle.js
+++ b/features/settings/settingThings/toggle.js
@@ -4,47 +4,51 @@ import Toggle from "../../../../guimanager/GuiElement/Toggle";
import SettingBase from "./settingBase";
class ToggleSetting extends SettingBase {
- constructor(name, description, defaultVal, settingId, module){
+ constructor(name, description, defaultVal, settingId, module) {
super(name, description, defaultVal, settingId, module)
+ this.onChange = undefined
+
this.toggleObject = new Toggle().setLocation(0, 0.3, 0.8, 0.4).setValue(this.getValue())
this.settingObject.addChild(this.toggleObject)
- this.toggleObject.addEvent(new SoopyContentChangeEvent().setHandler((newVal, oldVal, resetFun)=>{
+ this.toggleObject.addEvent(new SoopyContentChangeEvent().setHandler((newVal, oldVal, resetFun) => {
this.setValue(newVal)
}))
}
- setValue(newVal){
+ setValue(newVal) {
super.setValue(newVal)
this.toggleObject.setValue(newVal)
+ if (this.onChange) this.onChange()
+
return this
}
- requires(toggleSetting){
+ requires(toggleSetting) {
this.requiresO = toggleSetting
- toggleSetting.toggleObject.addEvent(new SoopyContentChangeEvent().setHandler((newVal, oldVal, resetFun)=>{
- if(newVal){
+ toggleSetting.toggleObject.addEvent(new SoopyContentChangeEvent().setHandler((newVal, oldVal, resetFun) => {
+ if (newVal) {
this.setValue(this.temp_val)
- this.toggleObject.triggerEvent(Enum.EVENT.CONTENT_CHANGE, [this.temp_val, false, ()=>{}])
+ this.toggleObject.triggerEvent(Enum.EVENT.CONTENT_CHANGE, [this.temp_val, false, () => { }])
this.guiObject.location.size.y.set(0.2, 500)
- }else{
+ } else {
this.temp_val = this.getValue()
this.setValue(false)
- this.toggleObject.triggerEvent(Enum.EVENT.CONTENT_CHANGE, [false, this.temp_val, ()=>{}])
+ this.toggleObject.triggerEvent(Enum.EVENT.CONTENT_CHANGE, [false, this.temp_val, () => { }])
this.guiObject.location.size.y.set(0, 500)
}
}))
let newVal = this.requiresO.getValue()
- if(!newVal){
+ if (!newVal) {
let temp_val = this.temp_val
this.setValue(false)
this.temp_val = temp_val
diff --git a/features/slayers/index.js b/features/slayers/index.js
index a7b0f73..16ac357 100644
--- a/features/slayers/index.js
+++ b/features/slayers/index.js
@@ -127,7 +127,6 @@ class Slayers extends Feature {
this.registerEvent("tick", this.tick);
this.registerEvent("renderWorld", this.renderWorld);
this.registerEvent("worldLoad", this.worldLoad);
- this.registerEvent("renderOverlay", this.renderHud);
this.registerStep(true, 2, this.step);
}
@@ -139,12 +138,6 @@ class Slayers extends Feature {
this.slayerLocationDataH[user] = [loc, Date.now()]
}
- renderHud() {
- for (let element of this.hudElements) {
- element.render();
- }
- }
-
worldLoad() {
this.todoE = [];
this.beaconPoints = {};
diff --git a/index.js b/index.js
index 84e4292..68bfe02 100644
--- a/index.js
+++ b/index.js
@@ -41,4 +41,6 @@ if (new File("./config/ChatTriggers/modules/SoopyV2UpdateButtonPatcher").exists(
ChatLib.chat("&7Deleting SoopyV2UpdateButtonPatcher as its no longer needed")
FileLib.deleteDirectory(new File("./config/ChatTriggers/modules/SoopyV2UpdateButtonPatcher"))
}).start()
-} \ No newline at end of file
+}
+
+require("./utils/renderJavaUtils.js") \ No newline at end of file
diff --git a/utils/renderJavaUtils.js b/utils/renderJavaUtils.js
new file mode 100644
index 0000000..b9a3f83
--- /dev/null
+++ b/utils/renderJavaUtils.js
@@ -0,0 +1,319 @@
+let SoopyV2Forge = Java.type("me.soopyboo32.soopyv2forge.SoopyV2Forge").INSTANCE
+
+let LASTEST_SOOPYFORGE_VER = "1.0"
+
+let ArrayList = Java.type("java.util.ArrayList")
+
+let Vec3 = Java.type("net.minecraft.util.Vec3")
+let Vector2f = Java.type("javax.vecmath.Vector2f")
+let RenderPointsC = Java.type("me.soopyboo32.soopyv2forge.RenderTypes.Points")
+let RenderWorldTextC = Java.type("me.soopyboo32.soopyv2forge.RenderTypes.WorldText")
+let RenderBeaconC = Java.type("me.soopyboo32.soopyv2forge.RenderTypes.Beacon")
+let HudPointsC = Java.type("me.soopyboo32.soopyv2forge.RenderTypes.HudPoints")
+let HudTextC = Java.type("me.soopyboo32.soopyv2forge.RenderTypes.HudText")
+
+let RenderWorldThings = new Set()
+let RenderHudThings = new Set()
+
+class RenderWorldAble {
+ startRender() {
+ RenderWorldThings.add(this.javaObj)
+ SoopyV2Forge.setRenderWorldList(new ArrayList([...RenderWorldThings]))
+ return this
+ }
+ stopRender() {
+ RenderWorldThings.delete(this.javaObj)
+ SoopyV2Forge.setRenderWorldList(new ArrayList([...RenderWorldThings]))
+ return this
+ }
+}
+class RenderHudAble {
+ startRender() {
+ RenderHudThings.add(this.javaObj)
+ SoopyV2Forge.setRenderHudList(new ArrayList([...RenderHudThings]))
+ return this
+ }
+ stopRender() {
+ RenderHudThings.delete(this.javaObj)
+ SoopyV2Forge.setRenderHudList(new ArrayList([...RenderHudThings]))
+ return this
+ }
+}
+
+export class Points extends RenderWorldAble {
+ constructor(points, r, g, b, a, thickness, depth) {
+ this.javaObj = new RenderPointsC(new ArrayList(points.map(a => new Vec3(...a))), r, g, b, a, thickness, depth)
+ }
+
+ setPoints(points) {
+ this.javaObj.points = new ArrayList(points.map(a => new Vec3(...a)))
+ return this
+ }
+ setRGBA(r, g, b, a) {
+ this.javaObj.red = r
+ this.javaObj.green = g
+ this.javaObj.blue = b
+ this.javaObj.alpha = a
+ return this
+ }
+ setThickness(thickness) {
+ this.javaObj.thickness = thickness
+ return this
+ }
+ setDepth(depth) {
+ this.javaObj.depthtest = depth
+ return this
+ }
+ setDisableCullFace(disable) {
+ this.javaObj.disableCullFace = disable
+ return this
+ }
+ setGLMode(glMode) {
+ this.javaObj.glmode = glMode
+ return this
+ }
+}
+export class FilledPoints extends Points {
+ constructor(points, r, g, b, a, thickness, depth) {
+ super(points, r, g, b, a, thickness, depth)
+
+ this.setGLMode(GL11.GL_QUADS)
+ this.setDisableCullFace(true)
+ }
+}
+export class Box extends Points {
+ constructor(location, size, r, g, b, a, thickness, depth) {
+ super(Box.getPointsFromLocationSize(location, size), r, g, b, a, thickness, depth)
+ }
+
+ setLocationSize(location, size) {
+ this.setPoints(Box.getPointsFromLocationSize(location, size))
+ return this
+ }
+
+ static getPointsFromLocationSize(location, size) {
+ let [x, y, z] = location
+ let [width, height, width2] = size
+
+ return [[x + width, y + height, z + width2],
+ [x + width, y + height, z],
+ [x, y + height, z],
+ [x, y + height, z + width2],
+ [x + width, y + height, z + width2],
+ [x + width, y, z + width2],
+ [x + width, y, z],
+ [x, y, z],
+ [x, y, z + width2],
+ [x, y, z],
+ [x, y + height, z],
+ [x, y, z],
+ [x + width, y, z],
+ [x + width, y + height, z],
+ [x + width, y, z],
+ [x + width, y, z + width2],
+ [x, y, z + width2],
+ [x, y + height, z + width2],
+ [x + width, y + height, z + width2]]
+ }
+}
+export class FilledBox extends FilledPoints {
+ constructor(location, size, r, g, b, a, thickness, depth) {
+ super(FilledBox.getPointsFromLocationSize(location, size), r, g, b, a, thickness, depth)
+ }
+
+ setLocationSize(location, size) {
+ this.setPoints(FilledBox.getPointsFromLocationSize(location, size))
+ return this
+ }
+
+ static getPointsFromLocationSize(location, size) {
+ let [x, y, z] = location
+ let [w, h, w2] = size
+
+ return [
+ [x + w, y + 0, z + w2],
+ [x + w, y + 0, z],
+ [x, y + 0, z],
+ [x, y + 0, z + w2],
+
+ [x + w, y + h, z + w2],
+ [x + w, y + h, z],
+ [x, y + h, z],
+ [x, y + h, z + w2],
+
+ [x, y + h, z + w2],
+ [x, y + h, z],
+ [x, y + 0, z],
+ [x, y + 0, z + w2],
+
+ [x + w, y + h, z + w2],
+ [x + w, y + h, z],
+ [x + w, y + 0, z],
+ [x + w, y + 0, z + w2],
+
+ [x + w, y + h, z],
+ [x, y + h, z],
+ [x, y + 0, z],
+ [x + w, y + 0, z],
+
+ [x, y + h, z + w2],
+ [x + w, y + h, z + w2],
+ [x + w, y + 0, z + w2],
+ [x, y + 0, z + w2]
+ ]
+ }
+}
+export class WorldText extends RenderWorldAble {
+ constructor(location, text, depth, scale) {
+ this.javaObj = new RenderWorldTextC(new Vec3(...location), text, depth, scale)
+ }
+
+ setLocation(location) {
+ this.javaObj.location = location
+ return this
+ }
+ setText(text) {
+ this.javaObj.text = text
+ return this
+ }
+ setDepthtest(depthtest) {
+ this.javaObj.depthtest = depthtest
+ return this
+ }
+ setScale(scale) {
+ this.javaObj.scale = scale
+ return this
+ }
+ setShadow(shadow) {
+ this.javaObj.shadow = shadow
+ return this
+ }
+}
+
+export class Beacon extends RenderWorldAble {
+ constructor(location, r, g, b, a, depth) {
+ this.javaObj = new RenderBeaconC(new Vec3(...location), r, g, b, a, depth)
+ }
+
+ setLocation(location) {
+ this.javaObj.location = location
+ return this
+ }
+ setRGBA(r, g, b, a) {
+ this.javaObj.red = r
+ this.javaObj.green = g
+ this.javaObj.blue = b
+ this.javaObj.alpha = a
+ return this
+ }
+ setDepthtest(depthtest) {
+ this.javaObj.depthtest = depthtest
+ return this
+ }
+
+}
+export class HudPoints extends RenderHudAble {
+ constructor(points, r, g, b, a, thickness) {
+ this.javaObj = new HudPointsC(new ArrayList(points.map(a => new Vector2f(...a))), r, g, b, a, thickness)
+ }
+
+ setPoints(points) {
+ this.javaObj.points = new ArrayList(points.map(a => new Vec3(...a)))
+ return this
+ }
+ setRGBA(r, g, b, a) {
+ this.javaObj.colorR = r
+ this.javaObj.colorG = g
+ this.javaObj.colorB = b
+ this.javaObj.colorA = a
+ return this
+ }
+ setThickness(thickness) {
+ this.javaObj.thickness = thickness
+ return this
+ }
+ setGlmode(glmode) {
+ this.javaObj.glmode = glmode
+ return this
+ }
+}
+export class HudText extends RenderHudAble {
+ constructor(text, x, y, shadow) {
+ this.javaObj = new HudTextC(text, x, y, shadow)
+ }
+
+ setText(text) {
+ this.javaObj.textLines = text
+ return this
+ }
+ setX(x) {
+ this.javaObj.x = x
+ return this
+ }
+ setY(y) {
+ this.javaObj.y = y
+ return this
+ }
+ setScale(scale) {
+ this.javaObj.scale = scale
+ return this
+ }
+ setShadow(shadow) {
+ this.javaObj.shadow = shadow
+ return this
+ }
+}
+
+new Box([128, 72, 58], [1, 1, 1], 1, 0, 0, 1, 1, true).startRender()
+new FilledBox([128, 72, 58], [1, 1, 1], 1, 0, 0, 0.25, 1, true).startRender()
+
+// let data = []
+
+// data.push(createPoints([[108, 70, 63], [108, 71, 63], [108, 70, 67], [108, 70, 63]], 1, 0, 0, 1, 2, true))
+// data.push(createWorldText([115, 73, 63], "Text §dWOW §6YEP", true, 1))
+// data.push(createBeacon([115, 75, 63], 0, 1, 0, 1, true))
+
+// SoopyV2Forge.setRenderWorldList(new ArrayList(data))
+
+// let data2 = []
+
+// data2.push(createHudPoints([[10, 10], [50, 10], [50, 20], [10, 10]], 0, 0, 1, 1, 5))
+// data2[data2.length - 1].glmode = 5
+// data2.push(createHudText("Text §dWOW §6YEP", 10, 30, true))
+
+// SoopyV2Forge.setRenderHudList(new ArrayList(data2))
+
+register("worldLoad", () => {
+ if (!net.minecraftforge.fml.common.Loader.isModLoaded("soopyv2forge")) {
+ ChatLib.chat("&1" + ChatLib.getChatBreak("-").trim())
+ ChatLib.chat("§cWARNING: You dont have the forge mod for soopyv2 installed")
+ ChatLib.chat("§cWARNING: If you have the mod installed it will take over rendering")
+ ChatLib.chat("§cWARNING: And improve performance quite a bit")
+ new TextComponent(" &e[CLICK] &7- Download").setHover("show_text", "&2Download").setClick("open_url", "https://github.com/Soopyboo32/SoopyV2Forge/releases").chat()
+ ChatLib.chat("&1" + ChatLib.getChatBreak("-").trim())
+ }
+ if (SoopyV2Forge.getVersion() !== LASTEST_SOOPYFORGE_VER) {
+ ChatLib.chat("&1" + ChatLib.getChatBreak("-").trim())
+ ChatLib.chat("§cWARNING: Your forge version of soopyv2 is outdated")
+ ChatLib.chat("§cWARNING: Chattriggers will take over rendering")
+ ChatLib.chat("§cWARNING: This will hurt performance quite a bit")
+ new TextComponent(" &e[CLICK] &7- Download").setHover("show_text", "&2Download update").setClick("open_url", "https://github.com/Soopyboo32/SoopyV2Forge/releases").chat()
+ ChatLib.chat("&1" + ChatLib.getChatBreak("-").trim())
+ }
+})
+
+let renderWorldList
+let renderHudList
+
+let shouldUseForgeRendering = net.minecraftforge.fml.common.Loader.isModLoaded("soopyv2forge") && SoopyV2Forge.getVersion() === LASTEST_SOOPYFORGE_VER
+
+if (!shouldUseForgeRendering) {
+ renderWorldList = []
+ renderHudList = []
+ register("renderOverlay", (ticks) => {
+
+ })
+ register("renderWorld", (ticks) => {
+
+ })
+} \ No newline at end of file