From a936f34dbe84c615696b0c6c4c1d4ffba5719fa3 Mon Sep 17 00:00:00 2001 From: Yuqi154 <1123489751@qq.com> Date: Mon, 2 Sep 2024 20:33:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E7=82=B9=E5=8D=95?= =?UTF-8?q?=E6=B8=B2=E6=9F=93=E9=94=99=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../content/client/overlay/OrdersOverlay.java | 60 ++++++++++++++++--- 1 file changed, 51 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/hiedacamellia/mystiasizakaya/content/client/overlay/OrdersOverlay.java b/src/main/java/org/hiedacamellia/mystiasizakaya/content/client/overlay/OrdersOverlay.java index 34aea97c..b8d740ba 100644 --- a/src/main/java/org/hiedacamellia/mystiasizakaya/content/client/overlay/OrdersOverlay.java +++ b/src/main/java/org/hiedacamellia/mystiasizakaya/content/client/overlay/OrdersOverlay.java @@ -75,18 +75,54 @@ public static void eventHandler(RenderGuiEvent.Pre event) { if (!statical) { int reali; int start_x; - int axis = 0; + int axis; if (tick >= 16) { tick = 0; statical = true; }else { + boolean left=false; + boolean right=false; + boolean middle=false; + refreshNowOrders(cuisinesorders_list); + for (int i = 0; i < 8; i++) { + if(!cuisinesorders_list.get(i).isEmpty()||!beveragesorders_list.get(i).isEmpty()){ + if(iflag) + left = true; + } + if(left&&right){ + middle = true; + left = false; + right = false; + break; + } + } reali = 0; + //Debug.getLogger().debug(String.valueOf(now_orders)); if (add) { axis = 16 - tick; - start_x = x_mid - now_orders * 17 - 17; + if(now_orders==1) { + //Debug.getLogger().debug("1"); + start_x = x_mid - 17; + }else { + if (middle) { + start_x = x_mid - now_orders * 17 - 17; + }else { + start_x = x_mid - now_orders * 17; + } + } } else { axis = tick; - start_x = x_mid - now_orders * 17 - 34; + if(now_orders==0) { + start_x = x_mid - 17; + }else { + if (middle) { + start_x = x_mid - now_orders * 17 - 34; + }else { + start_x = x_mid - now_orders * 17 - 17; + } + } } for (int i = 0; i < flag; i++) { cuisines = cuisinesorders_list.get(i); @@ -119,21 +155,18 @@ public static void eventHandler(RenderGuiEvent.Pre event) { } } if (statical) { - now_orders = 0; + refreshNowOrders(cuisinesorders_list); for (int i = 0; i < 8; i++) { - if (!cuisinesorders_list.get(i).isEmpty()) { - now_orders++; - } if (!(ItemStack.isSameItem(cuisinesorders_list.get(i), last_orders.get(i)))) { if (last_orders.get(i).isEmpty()) { - Debug.getLogger().debug("add"); + //Debug.getLogger().debug("add"); flag_cuisine = last_orders.get(i); flag_beverage = last_beverage.get(i); add = true; } else { flag_cuisine = last_orders.get(i); flag_beverage = last_beverage.get(i); - Debug.getLogger().debug("delete"); + //Debug.getLogger().debug("delete"); add = false; } last_beverage.set(i, beveragesorders_list.get(i)); @@ -224,4 +257,13 @@ public static List getLast_beverage() { return new ArrayList<>(List.of(ItemStack.EMPTY, ItemStack.EMPTY, ItemStack.EMPTY, ItemStack.EMPTY, ItemStack.EMPTY, ItemStack.EMPTY, ItemStack.EMPTY, ItemStack.EMPTY)); return last_beverage; } + + private static void refreshNowOrders(List list) { + now_orders = 0; + for (int i = 0; i < 8; i++) { + if (!list.get(i).isEmpty()) { + now_orders++; + } + } + } }