blob: 2f7da5f260e7d8989368c7a01fc80061b9d5e3da (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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
|
package net.tylermurphy.Minecraft.Scripts;
import static net.tylermurphy.Minecraft.UI.UIMaster.bindUI;
import static net.tylermurphy.Minecraft.UI.UIMaster.getImage;
import static net.tylermurphy.Minecraft.UI.UIMaster.getText;
import static net.tylermurphy.Minecraft.UI.UIMaster.setEnabled;
import net.tylermurphy.Minecraft.Main;
import net.tylermurphy.Minecraft.Scene.World;
import net.tylermurphy.Minecraft.UI.UIImage;
import net.tylermurphy.Minecraft.UI.UIFactory.*;
import net.tylermurphy.Minecraft.Render.Data.Display;
public class UIScript extends Script {
public void Init() {
UIStore.InitalizeStoreData();
CoreUI.initCoreUI();
F3UI.initF3UI();
SavingUI.initSavingUI();
CommandUI.initCommandUI();
}
public void Update() {
bindUI(0);
for(int i=1;i<=10;i++) {
UIImage heart = getImage("heart" + i);
if(World.player.health >= i*2) {
heart.setTexture(UIStore.TEXTURES.get("heart_full_texture"));
} else if(World.player.health >= i*2-1) {
heart.setTexture(UIStore.TEXTURES.get("heart_half_texture"));
} else {
heart.setTexture(UIStore.TEXTURES.get("heart_empty_texture"));
}
}
}
public void Tick() {
String position = "Position: "+(int)(World.player.getTransform().getGlobalPosition().x())+","+(int) World.player.getTransform().getGlobalPosition().y()+","+(int)(World.player.getTransform().getGlobalPosition().z());
String rotation = "Rotation: "+(int) World.player.getTransform().getRotation().x+","+(int) World.player.getTransform().getRotation().y+","+(int) World.player.getTransform().getRotation().z;
bindUI(1);
getText("position").setText(position);
getText("rotation").setText(rotation);
getText("freemem").setText("Free memory (bytes): " + Runtime.getRuntime().freeMemory());
if(Main.getTicks() % 20 == 0) {
getText("fps").setText("FPS: " + (int)(1/Display.getFrameTimeSeconds()));
getText("tps").setText("TPS: " + Main.getTPS());
}
}
public void End() {
bindUI(0);
setEnabled(false);
bindUI(1);
setEnabled(false);
bindUI(2);
setEnabled(true);
bindUI(3);
setEnabled(false);
}
}
|