online cosmetics
This commit is contained in:
@@ -0,0 +1,50 @@
|
|||||||
|
package org.saturnclient.saturnclient.auth;
|
||||||
|
|
||||||
|
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents;
|
||||||
|
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.network.PlayerListEntry;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import com.mojang.authlib.GameProfile;
|
||||||
|
|
||||||
|
public class PlayerTracker {
|
||||||
|
private static Set<UUID> trackedPlayers = new HashSet<>();
|
||||||
|
|
||||||
|
public static void initialize() {
|
||||||
|
// When client joins a server, reset tracked players
|
||||||
|
ClientPlayConnectionEvents.JOIN.register((handler, sender, client) -> {
|
||||||
|
trackedPlayers.clear();
|
||||||
|
client.execute(() -> {
|
||||||
|
checkForNewPlayers(MinecraftClient.getInstance());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Check for new players every tick
|
||||||
|
ClientTickEvents.END_CLIENT_TICK.register(client -> checkForNewPlayers(client));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void checkForNewPlayers(MinecraftClient client) {
|
||||||
|
if (client.getNetworkHandler() == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (PlayerListEntry player : client.getNetworkHandler().getPlayerList()) {
|
||||||
|
UUID playerUUID = player.getProfile().getId();
|
||||||
|
|
||||||
|
if (!trackedPlayers.contains(playerUUID)) {
|
||||||
|
// A new player has joined
|
||||||
|
onPlayerJoin(client, player);
|
||||||
|
trackedPlayers.add(playerUUID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void onPlayerJoin(MinecraftClient client, PlayerListEntry player) {
|
||||||
|
GameProfile profile = player.getProfile();
|
||||||
|
String uuid = profile.getId().toString();
|
||||||
|
SaturnSocket.player(profile.getName(), uuid);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class SaturnParser {
|
public class SaturnParser {
|
||||||
|
public String method = "";
|
||||||
private Map<String, String> params = new HashMap<>();
|
private Map<String, String> params = new HashMap<>();
|
||||||
|
|
||||||
public SaturnParser(String input) throws IOException {
|
public SaturnParser(String input) throws IOException {
|
||||||
@@ -18,6 +19,8 @@ public class SaturnParser {
|
|||||||
throw new IOException(parts[0]);
|
throw new IOException(parts[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
method = parts[0];
|
||||||
|
|
||||||
for (int i = 1; i < parts.length; i++) {
|
for (int i = 1; i < parts.length; i++) {
|
||||||
String[] keyValue = parts[i].split("=");
|
String[] keyValue = parts[i].split("=");
|
||||||
if (keyValue.length == 2) {
|
if (keyValue.length == 2) {
|
||||||
@@ -39,6 +42,15 @@ public class SaturnParser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getBool(String i) throws IOException {
|
||||||
|
String val = params.get(i);
|
||||||
|
if (val != null) {
|
||||||
|
return val.equals("true");
|
||||||
|
} else {
|
||||||
|
throw new IOException("Parameter not found " + i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String[] getArray(String i) throws IOException {
|
public String[] getArray(String i) throws IOException {
|
||||||
String val = params.get(i);
|
String val = params.get(i);
|
||||||
if (val != null) {
|
if (val != null) {
|
||||||
|
|||||||
@@ -4,14 +4,16 @@ import java.io.*;
|
|||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents;
|
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
|
||||||
import org.saturnclient.saturnclient.SaturnClient;
|
import org.saturnclient.saturnclient.SaturnClient;
|
||||||
import org.saturnclient.saturnclient.cosmetics.cloaks.Cloaks;
|
import org.saturnclient.saturnclient.cosmetics.cloaks.Cloaks;
|
||||||
|
|
||||||
public class SaturnSocket {
|
public class SaturnSocket {
|
||||||
|
|
||||||
private static final String server = "127.0.0.1";
|
private static final String server = "77.247.92.168";
|
||||||
private static final int port = 8080;
|
private static final int port = 8080;
|
||||||
|
|
||||||
public static Map<String, SaturnPlayer> players = new HashMap<>();
|
public static Map<String, SaturnPlayer> players = new HashMap<>();
|
||||||
@@ -49,8 +51,6 @@ public class SaturnSocket {
|
|||||||
writer.println(accessToken);
|
writer.println(accessToken);
|
||||||
String response = reader.readLine();
|
String response = reader.readLine();
|
||||||
|
|
||||||
SaturnClient.LOGGER.info(response);
|
|
||||||
|
|
||||||
SaturnParser parser = new SaturnParser(response);
|
SaturnParser parser = new SaturnParser(response);
|
||||||
|
|
||||||
uuid = parser.getString("uuid");
|
uuid = parser.getString("uuid");
|
||||||
@@ -58,7 +58,6 @@ public class SaturnSocket {
|
|||||||
String hat = parser.getString("hat");
|
String hat = parser.getString("hat");
|
||||||
|
|
||||||
for (String availableCloak : parser.getArray("cloaks")) {
|
for (String availableCloak : parser.getArray("cloaks")) {
|
||||||
SaturnClient.LOGGER.info("Available cloak: " + availableCloak);
|
|
||||||
Cloaks.availableCloaks.add(availableCloak);
|
Cloaks.availableCloaks.add(availableCloak);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,7 +65,8 @@ public class SaturnSocket {
|
|||||||
|
|
||||||
playerNames.put(client.getSession().getUsername(), uuid);
|
playerNames.put(client.getSession().getUsername(), uuid);
|
||||||
|
|
||||||
// Start listening for server messages
|
afterAuth();
|
||||||
|
|
||||||
startListenerThread();
|
startListenerThread();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -83,11 +83,26 @@ public class SaturnSocket {
|
|||||||
while (running) {
|
while (running) {
|
||||||
String message = reader.readLine();
|
String message = reader.readLine();
|
||||||
if (message == null) {
|
if (message == null) {
|
||||||
|
SaturnClient.LOGGER.error("Connection closed");
|
||||||
running = false;
|
running = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
SaturnClient.LOGGER.info("Received: " + message);
|
SaturnParser parser = new SaturnParser(message);
|
||||||
|
|
||||||
|
switch (parser.method) {
|
||||||
|
case "player":
|
||||||
|
String uuid = parser.getString("uuid");
|
||||||
|
if (parser.getBool("saturn")) {
|
||||||
|
String cloak = parser.getString("cloak");
|
||||||
|
String hat = parser.getString("hat");
|
||||||
|
players.put(uuid, new SaturnPlayer(cloak, hat));
|
||||||
|
Cloaks.setCloakSilent(uuid, cloak);
|
||||||
|
} else {
|
||||||
|
playerNames.entrySet().removeIf(entry -> entry.getValue().equals(uuid));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
SaturnClient.LOGGER.error("Error reading from server", e);
|
SaturnClient.LOGGER.error("Error reading from server", e);
|
||||||
@@ -118,6 +133,10 @@ public class SaturnSocket {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void afterAuth() {
|
||||||
|
PlayerTracker.initialize();
|
||||||
|
}
|
||||||
|
|
||||||
public static void setCloak(String cloakName) {
|
public static void setCloak(String cloakName) {
|
||||||
try {
|
try {
|
||||||
writer.println("set_cloak@cloak=" + cloakName);
|
writer.println("set_cloak@cloak=" + cloakName);
|
||||||
@@ -125,4 +144,21 @@ public class SaturnSocket {
|
|||||||
SaturnClient.LOGGER.error("Request failed", e);
|
SaturnClient.LOGGER.error("Request failed", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void player(String name, String uuid) {
|
||||||
|
try {
|
||||||
|
playerNames.put(name, uuid.replaceAll("-", ""));
|
||||||
|
writer.println("player@uuid=" + uuid.replaceAll("-", ""));
|
||||||
|
} catch (Exception e) {
|
||||||
|
SaturnClient.LOGGER.error("Request failed", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void joinServer(String ip) {
|
||||||
|
try {
|
||||||
|
writer.println("join_server@ip=" + ip);
|
||||||
|
} catch (Exception e) {
|
||||||
|
SaturnClient.LOGGER.error("Request failed", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.saturnclient.saturnclient.cosmetics;
|
package org.saturnclient.saturnclient.cosmetics;
|
||||||
|
|
||||||
|
import org.saturnclient.saturnclient.auth.SaturnPlayer;
|
||||||
import org.saturnclient.saturnclient.auth.SaturnSocket;
|
import org.saturnclient.saturnclient.auth.SaturnSocket;
|
||||||
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
@@ -30,8 +31,8 @@ public class HatFeatureRenderer extends FeatureRenderer<PlayerEntityRenderState,
|
|||||||
ItemStack headItem = state.equippedHeadStack;
|
ItemStack headItem = state.equippedHeadStack;
|
||||||
String uuid = SaturnSocket.playerNames.get(state.name);
|
String uuid = SaturnSocket.playerNames.get(state.name);
|
||||||
if (headItem.isEmpty() && uuid != null) {
|
if (headItem.isEmpty() && uuid != null) {
|
||||||
String hat = SaturnSocket.players.get(uuid).hat;
|
SaturnPlayer player = SaturnSocket.players.get(uuid);
|
||||||
if (hat.isEmpty()) {
|
if (player == null || player.hat == null || player.hat.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,7 +46,7 @@ public class HatFeatureRenderer extends FeatureRenderer<PlayerEntityRenderState,
|
|||||||
|
|
||||||
ItemStack customHat = new ItemStack(Items.STICK);
|
ItemStack customHat = new ItemStack(Items.STICK);
|
||||||
customHat.set(DataComponentTypes.ITEM_MODEL,
|
customHat.set(DataComponentTypes.ITEM_MODEL,
|
||||||
Identifier.of("saturnclient:hat_" + hat));
|
Identifier.of("saturnclient:hat_" + player.hat));
|
||||||
customHat.set(DataComponentTypes.EQUIPPABLE,
|
customHat.set(DataComponentTypes.EQUIPPABLE,
|
||||||
EquippableComponent.builder(EquipmentSlot.HEAD).build());
|
EquippableComponent.builder(EquipmentSlot.HEAD).build());
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,6 @@ public class ModMenu extends SaturnUi {
|
|||||||
SaturnScroll modsScroll = new SaturnScroll();
|
SaturnScroll modsScroll = new SaturnScroll();
|
||||||
|
|
||||||
for (SaturnMod mod : ModManager.MODS) {
|
for (SaturnMod mod : ModManager.MODS) {
|
||||||
SaturnClient.LOGGER.info(mod.getName());
|
|
||||||
modsScroll.draw(
|
modsScroll.draw(
|
||||||
new SaturnModComp(mod)
|
new SaturnModComp(mod)
|
||||||
.setX(modX)
|
.setX(modX)
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public abstract class NameTagMixin<S extends EntityRenderState> {
|
|||||||
@Overwrite
|
@Overwrite
|
||||||
public void renderLabelIfPresent(S state, Text text_o, MatrixStack matrices,
|
public void renderLabelIfPresent(S state, Text text_o, MatrixStack matrices,
|
||||||
VertexConsumerProvider vertexConsumers, int light) {
|
VertexConsumerProvider vertexConsumers, int light) {
|
||||||
Text text = isSaturn(state) ? Text.literal("" + "HexLeo") : text_o;
|
Text text = isSaturn(state) ? Text.literal("" + text_o.getString()) : text_o;
|
||||||
|
|
||||||
Vec3d vec3d = state.nameLabelPos;
|
Vec3d vec3d = state.nameLabelPos;
|
||||||
if (vec3d != null) {
|
if (vec3d != null) {
|
||||||
@@ -60,7 +60,8 @@ public abstract class NameTagMixin<S extends EntityRenderState> {
|
|||||||
private boolean isSaturn(S state) {
|
private boolean isSaturn(S state) {
|
||||||
if (state instanceof PlayerEntityRenderState) {
|
if (state instanceof PlayerEntityRenderState) {
|
||||||
String name = ((PlayerEntityRenderState) state).name;
|
String name = ((PlayerEntityRenderState) state).name;
|
||||||
return SaturnSocket.playerNames.containsKey(name);
|
String uuid = SaturnSocket.playerNames.get(name);
|
||||||
|
return uuid != null && SaturnSocket.players.containsKey(uuid);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,17 +13,14 @@ import net.minecraft.text.Style;
|
|||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
import org.saturnclient.saturnclient.SaturnClient;
|
|
||||||
|
|
||||||
public class SaturnUi extends Screen {
|
public class SaturnUi extends Screen {
|
||||||
|
|
||||||
private final ScheduledExecutorService scheduler =
|
private final ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor();
|
||||||
Executors.newSingleThreadScheduledExecutor();
|
|
||||||
|
|
||||||
public static MutableText text(String text) {
|
public static MutableText text(String text) {
|
||||||
return Text.literal(text).setStyle(
|
return Text.literal(text).setStyle(
|
||||||
Style.EMPTY.withFont(Identifier.of("saturnclient:panton"))
|
Style.EMPTY.withFont(Identifier.of("saturnclient:panton")));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SaturnWidget> widgets = new ArrayList<>();
|
public List<SaturnWidget> widgets = new ArrayList<>();
|
||||||
@@ -39,8 +36,7 @@ public class SaturnUi extends Screen {
|
|||||||
this::saturnTick,
|
this::saturnTick,
|
||||||
0,
|
0,
|
||||||
7,
|
7,
|
||||||
TimeUnit.MILLISECONDS
|
TimeUnit.MILLISECONDS);
|
||||||
);
|
|
||||||
super.init();
|
super.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,17 +52,16 @@ public class SaturnUi extends Screen {
|
|||||||
DrawContext context,
|
DrawContext context,
|
||||||
int mouseX,
|
int mouseX,
|
||||||
int mouseY,
|
int mouseY,
|
||||||
float delta
|
float delta) {
|
||||||
) {
|
|
||||||
renderBackground(context, mouseX, mouseY, delta);
|
renderBackground(context, mouseX, mouseY, delta);
|
||||||
|
|
||||||
for (SaturnWidget widget : new ArrayList<>(widgets)) {
|
for (SaturnWidget widget : new ArrayList<>(widgets)) {
|
||||||
if (!widget.visible) continue;
|
if (!widget.visible)
|
||||||
|
continue;
|
||||||
|
|
||||||
double adjustedMouseX = mouseX - widget.x;
|
double adjustedMouseX = mouseX - widget.x;
|
||||||
double adjustedMouseY = mouseY - widget.y;
|
double adjustedMouseY = mouseY - widget.y;
|
||||||
boolean isMouseInside =
|
boolean isMouseInside = adjustedMouseX >= 0 &&
|
||||||
adjustedMouseX >= 0 &&
|
|
||||||
adjustedMouseX <= (widget.width * widget.scale) &&
|
adjustedMouseX <= (widget.width * widget.scale) &&
|
||||||
adjustedMouseY >= 0 &&
|
adjustedMouseY >= 0 &&
|
||||||
adjustedMouseY <= (widget.height * widget.scale);
|
adjustedMouseY <= (widget.height * widget.scale);
|
||||||
@@ -79,8 +74,7 @@ public class SaturnUi extends Screen {
|
|||||||
context,
|
context,
|
||||||
isMouseInside,
|
isMouseInside,
|
||||||
(int) (adjustedMouseX / widget.scale),
|
(int) (adjustedMouseX / widget.scale),
|
||||||
(int) (adjustedMouseY / widget.scale)
|
(int) (adjustedMouseY / widget.scale));
|
||||||
);
|
|
||||||
matrices.pop();
|
matrices.pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -90,29 +84,21 @@ public class SaturnUi extends Screen {
|
|||||||
if (button == 0) {
|
if (button == 0) {
|
||||||
for (SaturnWidget widget : new ArrayList<>(widgets)) {
|
for (SaturnWidget widget : new ArrayList<>(widgets)) {
|
||||||
widget.focused = false;
|
widget.focused = false;
|
||||||
if (!widget.visible) continue;
|
if (!widget.visible)
|
||||||
|
continue;
|
||||||
|
|
||||||
double adjustedMouseX = mouseX - widget.x;
|
double adjustedMouseX = mouseX - widget.x;
|
||||||
double adjustedMouseY = mouseY - widget.y;
|
double adjustedMouseY = mouseY - widget.y;
|
||||||
boolean isMouseInside =
|
boolean isMouseInside = adjustedMouseX >= 0 &&
|
||||||
adjustedMouseX >= 0 &&
|
|
||||||
adjustedMouseX <= (widget.width * widget.scale) &&
|
adjustedMouseX <= (widget.width * widget.scale) &&
|
||||||
adjustedMouseY >= 0 &&
|
adjustedMouseY >= 0 &&
|
||||||
adjustedMouseY <= (widget.height * widget.scale);
|
adjustedMouseY <= (widget.height * widget.scale);
|
||||||
|
|
||||||
SaturnClient.LOGGER.info(
|
|
||||||
"CLick mouse X: " +
|
|
||||||
adjustedMouseX +
|
|
||||||
", mouse Y: " +
|
|
||||||
adjustedMouseY
|
|
||||||
);
|
|
||||||
|
|
||||||
if (isMouseInside) {
|
if (isMouseInside) {
|
||||||
widget.focused = true;
|
widget.focused = true;
|
||||||
widget.click(
|
widget.click(
|
||||||
(int) (adjustedMouseX / widget.scale),
|
(int) (adjustedMouseX / widget.scale),
|
||||||
(int) (adjustedMouseY / widget.scale)
|
(int) (adjustedMouseY / widget.scale));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -123,7 +109,8 @@ public class SaturnUi extends Screen {
|
|||||||
@Override
|
@Override
|
||||||
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
|
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
|
||||||
for (SaturnWidget widget : new ArrayList<>(widgets)) {
|
for (SaturnWidget widget : new ArrayList<>(widgets)) {
|
||||||
if (!widget.visible && !widget.focused) continue;
|
if (!widget.visible && !widget.focused)
|
||||||
|
continue;
|
||||||
|
|
||||||
widget.keyPressed(keyCode, scanCode, modifiers);
|
widget.keyPressed(keyCode, scanCode, modifiers);
|
||||||
|
|
||||||
@@ -140,13 +127,11 @@ public class SaturnUi extends Screen {
|
|||||||
double mouseX,
|
double mouseX,
|
||||||
double mouseY,
|
double mouseY,
|
||||||
double horizontalAmount,
|
double horizontalAmount,
|
||||||
double verticalAmount
|
double verticalAmount) {
|
||||||
) {
|
|
||||||
for (SaturnWidget widget : new ArrayList<>(widgets)) {
|
for (SaturnWidget widget : new ArrayList<>(widgets)) {
|
||||||
double adjustedMouseX = mouseX - widget.x;
|
double adjustedMouseX = mouseX - widget.x;
|
||||||
double adjustedMouseY = mouseY - widget.y;
|
double adjustedMouseY = mouseY - widget.y;
|
||||||
boolean isMouseInside =
|
boolean isMouseInside = adjustedMouseX >= 0 &&
|
||||||
adjustedMouseX >= 0 &&
|
|
||||||
adjustedMouseX <= (widget.width * widget.scale) &&
|
adjustedMouseX <= (widget.width * widget.scale) &&
|
||||||
adjustedMouseY >= 0 &&
|
adjustedMouseY >= 0 &&
|
||||||
adjustedMouseY <= (widget.height * widget.scale);
|
adjustedMouseY <= (widget.height * widget.scale);
|
||||||
@@ -156,8 +141,7 @@ public class SaturnUi extends Screen {
|
|||||||
(int) (adjustedMouseX / widget.scale),
|
(int) (adjustedMouseX / widget.scale),
|
||||||
(int) (adjustedMouseY / widget.scale),
|
(int) (adjustedMouseY / widget.scale),
|
||||||
horizontalAmount,
|
horizontalAmount,
|
||||||
verticalAmount
|
verticalAmount);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,8 +149,7 @@ public class SaturnUi extends Screen {
|
|||||||
mouseX,
|
mouseX,
|
||||||
mouseY,
|
mouseY,
|
||||||
horizontalAmount,
|
horizontalAmount,
|
||||||
verticalAmount
|
verticalAmount);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private char getCharFromKey(int keyCode, int modifiers) {
|
private char getCharFromKey(int keyCode, int modifiers) {
|
||||||
@@ -209,10 +192,8 @@ public class SaturnUi extends Screen {
|
|||||||
for (SaturnWidget widget : widgets) {
|
for (SaturnWidget widget : widgets) {
|
||||||
if (widget.visible && widget.animations != null) {
|
if (widget.visible && widget.animations != null) {
|
||||||
for (SaturnAnimation animation : widget.animations) {
|
for (SaturnAnimation animation : widget.animations) {
|
||||||
if (
|
if (animation != null &&
|
||||||
animation != null &&
|
tick - animation.lastTick == animation.delay) {
|
||||||
tick - animation.lastTick == animation.delay
|
|
||||||
) {
|
|
||||||
if (animation.run(widget, tick)) {
|
if (animation.run(widget, tick)) {
|
||||||
animation = null;
|
animation = null;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ public class SaturnFloat extends SaturnWidget {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void charTyped(char chr) {
|
public void charTyped(char chr) {
|
||||||
SaturnClient.LOGGER.info("current digit: " + chr);
|
|
||||||
if ((Character.isDigit(chr) || chr == '.') && text.length() < 10) {
|
if ((Character.isDigit(chr) || chr == '.') && text.length() < 10) {
|
||||||
if (text.equals("0") && cursorPosition == 1) {
|
if (text.equals("0") && cursorPosition == 1) {
|
||||||
text = "" + chr;
|
text = "" + chr;
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ public class SaturnInteger extends SaturnWidget {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void charTyped(char chr) {
|
public void charTyped(char chr) {
|
||||||
SaturnClient.LOGGER.info("current digit: " + chr);
|
|
||||||
if (Character.isDigit(chr) && text.length() < 10) {
|
if (Character.isDigit(chr) && text.length() < 10) {
|
||||||
if (text.equals("0") && cursorPosition == 1) {
|
if (text.equals("0") && cursorPosition == 1) {
|
||||||
text = "" + chr;
|
text = "" + chr;
|
||||||
|
|||||||
Reference in New Issue
Block a user