From fbd989275cd941474c18ffe957af8337745498c5 Mon Sep 17 00:00:00 2001 From: NK Date: Mon, 6 Mar 2023 15:45:36 +0000 Subject: [PATCH] so hard to fix ;-; --- .../lilase/features/flip/Flipper.java | 22 ++++++------------- .../night0721/lilase/gui/ImageRenderer.java | 2 +- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/src/main/java/me/night0721/lilase/features/flip/Flipper.java b/src/main/java/me/night0721/lilase/features/flip/Flipper.java index f4c3801..961f656 100644 --- a/src/main/java/me/night0721/lilase/features/flip/Flipper.java +++ b/src/main/java/me/night0721/lilase/features/flip/Flipper.java @@ -10,12 +10,8 @@ import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.util.StringUtils; import javax.net.ssl.HttpsURLConnection; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.OutputStream; +import java.io.*; import java.net.URL; -import java.nio.charset.StandardCharsets; public class Flipper { @@ -151,18 +147,14 @@ public class Flipper { } public JsonObject getItemData() throws IOException { - URL url = new URL("https://www.night0721.me/api//skyblock"); + URL url = new URL("https://www.night0721.me/api/skyblock"); HttpsURLConnection connection = (HttpsURLConnection) url.openConnection(); - connection.addRequestProperty("Content-Type", "application/json"); - connection.addRequestProperty("User-Agent", "Mozilla/5.0 (X11; U; Linux i686) Gecko/20071127 Firefox/2.0.0.11"); + connection.addRequestProperty("Content-Type", "text/plain"); connection.setDoOutput(true); - connection.setRequestMethod("GET"); - OutputStream stream = connection.getOutputStream(); - JsonObject bd = new JsonObject(); - bd.addProperty("ByteData", bytedata); - stream.write(bd.toString().getBytes(StandardCharsets.UTF_16)); - stream.flush(); - stream.close(); + connection.setRequestMethod("POST"); + OutputStreamWriter out = new OutputStreamWriter(connection.getOutputStream()); + out.write(bytedata); + out.close(); BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); String inputLine; StringBuilder content = new StringBuilder(); diff --git a/src/main/java/me/night0721/lilase/gui/ImageRenderer.java b/src/main/java/me/night0721/lilase/gui/ImageRenderer.java index 885c320..17c9e0f 100644 --- a/src/main/java/me/night0721/lilase/gui/ImageRenderer.java +++ b/src/main/java/me/night0721/lilase/gui/ImageRenderer.java @@ -20,7 +20,7 @@ public class ImageRenderer { } @SubscribeEvent - public void onRender(RenderGameOverlayEvent e) { + public void onRender(RenderGameOverlayEvent.Post e) { if (e.type == RenderGameOverlayEvent.ElementType.ALL) { draw(); }