From e25d403f1cf08baea93dd60472c2b1acf05272b5 Mon Sep 17 00:00:00 2001 From: Yuqi154 <1123489751@qq.com> Date: Mon, 10 Jun 2024 14:11:24 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=A7=E7=BB=AD=E5=A4=A7=E4=BF=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../client/gui/BankUiScreen.java | 6 ++-- .../client/gui/CookingRangeUiScreen.java | 26 ++++++++-------- .../client/screens/OrdersOverlay.java | 13 ++------ .../touhou/mystiasizakaya/command/Debug.java | 4 +-- ...UiButtonMessage.java => BankUiButton.java} | 12 ++++---- ...Message.java => CookingRangeUiButton.java} | 14 ++++----- .../mystiasizakaya/network/Variables.java | 7 ++--- .../mystiasizakaya/orders/Addorder.java | 25 ++++++++++++++++ .../mystiasizakaya/orders/Deleteorder.java | 22 ++++++++++++++ .../orders/GetBeveragesTexture.java | 3 +- .../orders/GetCuisinesTexture.java | 3 +- .../mystiasizakaya/orders/Initorders.java | 8 ++--- .../procedures/AddordersProcedure.java | 12 -------- .../procedures/DeleteordersProcedure.java | 12 -------- .../procedures/GetTextureProcedure.java | 30 ------------------- 15 files changed, 89 insertions(+), 108 deletions(-) rename src/main/java/net/touhou/mystiasizakaya/network/{BankUiButtonMessage.java => BankUiButton.java} (79%) rename src/main/java/net/touhou/mystiasizakaya/network/{CookingRangeUiButtonMessage.java => CookingRangeUiButton.java} (79%) create mode 100644 src/main/java/net/touhou/mystiasizakaya/orders/Addorder.java create mode 100644 src/main/java/net/touhou/mystiasizakaya/orders/Deleteorder.java delete mode 100644 src/main/java/net/touhou/mystiasizakaya/procedures/AddordersProcedure.java delete mode 100644 src/main/java/net/touhou/mystiasizakaya/procedures/DeleteordersProcedure.java delete mode 100644 src/main/java/net/touhou/mystiasizakaya/procedures/GetTextureProcedure.java diff --git a/src/main/java/net/touhou/mystiasizakaya/client/gui/BankUiScreen.java b/src/main/java/net/touhou/mystiasizakaya/client/gui/BankUiScreen.java index 661e86a2..f0afc3e2 100644 --- a/src/main/java/net/touhou/mystiasizakaya/client/gui/BankUiScreen.java +++ b/src/main/java/net/touhou/mystiasizakaya/client/gui/BankUiScreen.java @@ -1,7 +1,7 @@ package net.touhou.mystiasizakaya.client.gui; import net.touhou.mystiasizakaya.world.inventory.BankUiMenu; -import net.touhou.mystiasizakaya.network.BankUiButtonMessage; +import net.touhou.mystiasizakaya.network.BankUiButton; import net.touhou.mystiasizakaya.MystiasIzakayaMod; import net.minecraft.world.level.Level; @@ -113,8 +113,8 @@ public void moveCursorTo(int pos) { this.addWidget(this.input); button_take_out = Button.builder(Component.translatable("gui.mystias_izakaya.bank_ui.button_take_out"), e -> { if (true) { - MystiasIzakayaMod.PACKET_HANDLER.sendToServer(new BankUiButtonMessage(0, x, y, z)); - BankUiButtonMessage.handleButtonAction(entity, 0, x, y, z); + MystiasIzakayaMod.PACKET_HANDLER.sendToServer(new BankUiButton(0, x, y, z)); + BankUiButton.handleButtonAction(entity, 0, x, y, z); } }).bounds(this.leftPos + 31, this.topPos + 100, 110, 20).build(); guistate.put("button:button_take_out", button_take_out); diff --git a/src/main/java/net/touhou/mystiasizakaya/client/gui/CookingRangeUiScreen.java b/src/main/java/net/touhou/mystiasizakaya/client/gui/CookingRangeUiScreen.java index 55a33ce1..0c6b2fc0 100644 --- a/src/main/java/net/touhou/mystiasizakaya/client/gui/CookingRangeUiScreen.java +++ b/src/main/java/net/touhou/mystiasizakaya/client/gui/CookingRangeUiScreen.java @@ -5,7 +5,7 @@ import net.touhou.mystiasizakaya.util.ButtunShow; import net.touhou.mystiasizakaya.cooking.ui.Status; import net.touhou.mystiasizakaya.cooking.ui.Lefttime; -import net.touhou.mystiasizakaya.network.CookingRangeUiButtonMessage; +import net.touhou.mystiasizakaya.network.CookingRangeUiButton; import net.touhou.mystiasizakaya.MystiasIzakayaMod; import net.minecraft.world.level.Level; @@ -100,16 +100,16 @@ public void init() { button_confirm = Button .builder(Component.translatable("gui.mystias_izakaya.cooking_range_ui.button_confirm"), e -> { if (true) { - MystiasIzakayaMod.PACKET_HANDLER.sendToServer(new CookingRangeUiButtonMessage(0, x, y, z)); - CookingRangeUiButtonMessage.handleButtonAction(entity, 0, x, y, z); + MystiasIzakayaMod.PACKET_HANDLER.sendToServer(new CookingRangeUiButton(0, x, y, z)); + CookingRangeUiButton.handleButtonAction(entity, 0, x, y, z); } }).bounds(this.leftPos + 94, this.topPos + 60, 90, 20).build(); guistate.put("button:button_confirm", button_confirm); this.addRenderableWidget(button_confirm); button_select = Button.builder(Component.literal(""), e -> { if (ButtunShow.get(entity, 7)) { - MystiasIzakayaMod.PACKET_HANDLER.sendToServer(new CookingRangeUiButtonMessage(1, x, y, z)); - CookingRangeUiButtonMessage.handleButtonAction(entity, 1, x, y, z); + MystiasIzakayaMod.PACKET_HANDLER.sendToServer(new CookingRangeUiButton(1, x, y, z)); + CookingRangeUiButton.handleButtonAction(entity, 1, x, y, z); } }).bounds(this.leftPos + 40, this.topPos + 24, 45, 20).build(builder -> new Button(builder) { @Override @@ -122,8 +122,8 @@ public void render(GuiGraphics guiGraphics, int gx, int gy, float ticks) { this.addRenderableWidget(button_select); button_select1 = Button.builder(Component.literal(""), e -> { if (ButtunShow.get(entity, 8)) { - MystiasIzakayaMod.PACKET_HANDLER.sendToServer(new CookingRangeUiButtonMessage(2, x, y, z)); - CookingRangeUiButtonMessage.handleButtonAction(entity, 2, x, y, z); + MystiasIzakayaMod.PACKET_HANDLER.sendToServer(new CookingRangeUiButton(2, x, y, z)); + CookingRangeUiButton.handleButtonAction(entity, 2, x, y, z); } }).bounds(this.leftPos + 40, this.topPos + 51, 45, 20).build(builder -> new Button(builder) { @Override @@ -136,8 +136,8 @@ public void render(GuiGraphics guiGraphics, int gx, int gy, float ticks) { this.addRenderableWidget(button_select1); button_select2 = Button.builder(Component.literal(""), e -> { if (ButtunShow.get(entity, 9)) { - MystiasIzakayaMod.PACKET_HANDLER.sendToServer(new CookingRangeUiButtonMessage(3, x, y, z)); - CookingRangeUiButtonMessage.handleButtonAction(entity, 3, x, y, z); + MystiasIzakayaMod.PACKET_HANDLER.sendToServer(new CookingRangeUiButton(3, x, y, z)); + CookingRangeUiButton.handleButtonAction(entity, 3, x, y, z); } }).bounds(this.leftPos + 40, this.topPos + 78, 45, 20).build(builder -> new Button(builder) { @Override @@ -150,8 +150,8 @@ public void render(GuiGraphics guiGraphics, int gx, int gy, float ticks) { this.addRenderableWidget(button_select2); button_select3 = Button.builder(Component.literal(""), e -> { if (ButtunShow.get(entity, 10)) { - MystiasIzakayaMod.PACKET_HANDLER.sendToServer(new CookingRangeUiButtonMessage(4, x, y, z)); - CookingRangeUiButtonMessage.handleButtonAction(entity, 4, x, y, z); + MystiasIzakayaMod.PACKET_HANDLER.sendToServer(new CookingRangeUiButton(4, x, y, z)); + CookingRangeUiButton.handleButtonAction(entity, 4, x, y, z); } }).bounds(this.leftPos + 40, this.topPos + 105, 45, 20).build(builder -> new Button(builder) { @Override @@ -164,8 +164,8 @@ public void render(GuiGraphics guiGraphics, int gx, int gy, float ticks) { this.addRenderableWidget(button_select3); button_select4 = Button.builder(Component.literal(""), e -> { if (ButtunShow.get(entity, 11)) { - MystiasIzakayaMod.PACKET_HANDLER.sendToServer(new CookingRangeUiButtonMessage(5, x, y, z)); - CookingRangeUiButtonMessage.handleButtonAction(entity, 5, x, y, z); + MystiasIzakayaMod.PACKET_HANDLER.sendToServer(new CookingRangeUiButton(5, x, y, z)); + CookingRangeUiButton.handleButtonAction(entity, 5, x, y, z); } }).bounds(this.leftPos + 40, this.topPos + 132, 45, 20).build(builder -> new Button(builder) { @Override diff --git a/src/main/java/net/touhou/mystiasizakaya/client/screens/OrdersOverlay.java b/src/main/java/net/touhou/mystiasizakaya/client/screens/OrdersOverlay.java index 2cc9acb3..2bd5981a 100644 --- a/src/main/java/net/touhou/mystiasizakaya/client/screens/OrdersOverlay.java +++ b/src/main/java/net/touhou/mystiasizakaya/client/screens/OrdersOverlay.java @@ -18,24 +18,14 @@ import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.platform.GlStateManager; +import net.touhou.mystiasizakaya.orders.Initorders; @Mod.EventBusSubscriber({ Dist.CLIENT }) public class OrdersOverlay { @SubscribeEvent(priority = EventPriority.NORMAL) public static void eventHandler(RenderGuiEvent.Pre event) { - int w = event.getWindow().getGuiScaledWidth(); int h = event.getWindow().getGuiScaledHeight(); - Level world = null; - double x = 0; - double y = 0; - double z = 0; Player entity = Minecraft.getInstance().player; - if (entity != null) { - world = entity.level(); - x = entity.getX(); - y = entity.getY(); - z = entity.getZ(); - } RenderSystem.disableDepthTest(); RenderSystem.depthMask(false); RenderSystem.enableBlend(); @@ -47,6 +37,7 @@ public static void eventHandler(RenderGuiEvent.Pre event) { String fm = ""; String fmb = ""; int reali = 0; + Initorders.init(entity); for (int i = 0; i < 7; i++) { fm = GetCuisinesTexture.execute(i, entity); fmb = GetBeveragesTexture.execute(i, entity); diff --git a/src/main/java/net/touhou/mystiasizakaya/command/Debug.java b/src/main/java/net/touhou/mystiasizakaya/command/Debug.java index 4101e9d9..c9212d73 100644 --- a/src/main/java/net/touhou/mystiasizakaya/command/Debug.java +++ b/src/main/java/net/touhou/mystiasizakaya/command/Debug.java @@ -37,7 +37,7 @@ public static void registerCommand(RegisterCommandsEvent event) { int id = (int) DoubleArgumentType.getDouble(arguments, "id"); Player player = arguments.getSource().getPlayer(); List orders_list = player.getCapability(Variables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new Variables.PlayerVariables()).orders; - orders_list.set(id, ""); + orders_list.set(id, "minecraft:air"); player.getCapability(Variables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> { capability.orders = orders_list; capability.syncPlayerVariables(player); @@ -59,7 +59,7 @@ public static void registerCommand(RegisterCommandsEvent event) { int id = (int) DoubleArgumentType.getDouble(arguments, "id"); Player player = arguments.getSource().getPlayer(); List ordersbeverages_list = player.getCapability(Variables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new Variables.PlayerVariables()).ordersbeverages; - ordersbeverages_list.set(id, ""); + ordersbeverages_list.set(id, "minecraft:air"); player.getCapability(Variables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> { capability.ordersbeverages = ordersbeverages_list; capability.syncPlayerVariables(player); diff --git a/src/main/java/net/touhou/mystiasizakaya/network/BankUiButtonMessage.java b/src/main/java/net/touhou/mystiasizakaya/network/BankUiButton.java similarity index 79% rename from src/main/java/net/touhou/mystiasizakaya/network/BankUiButtonMessage.java rename to src/main/java/net/touhou/mystiasizakaya/network/BankUiButton.java index ba23ba9e..094fdb19 100644 --- a/src/main/java/net/touhou/mystiasizakaya/network/BankUiButtonMessage.java +++ b/src/main/java/net/touhou/mystiasizakaya/network/BankUiButton.java @@ -19,31 +19,31 @@ import java.util.HashMap; @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) -public class BankUiButtonMessage { +public class BankUiButton { private final int buttonID, x, y, z; - public BankUiButtonMessage(FriendlyByteBuf buffer) { + public BankUiButton(FriendlyByteBuf buffer) { this.buttonID = buffer.readInt(); this.x = buffer.readInt(); this.y = buffer.readInt(); this.z = buffer.readInt(); } - public BankUiButtonMessage(int buttonID, int x, int y, int z) { + public BankUiButton(int buttonID, int x, int y, int z) { this.buttonID = buttonID; this.x = x; this.y = y; this.z = z; } - public static void buffer(BankUiButtonMessage message, FriendlyByteBuf buffer) { + public static void buffer(BankUiButton message, FriendlyByteBuf buffer) { buffer.writeInt(message.buttonID); buffer.writeInt(message.x); buffer.writeInt(message.y); buffer.writeInt(message.z); } - public static void handler(BankUiButtonMessage message, Supplier contextSupplier) { + public static void handler(BankUiButton message, Supplier contextSupplier) { NetworkEvent.Context context = contextSupplier.get(); context.enqueueWork(() -> { Player entity = context.getSender(); @@ -70,6 +70,6 @@ public static void handleButtonAction(Player entity, int buttonID, int x, int y, @SubscribeEvent public static void registerMessage(FMLCommonSetupEvent event) { - MystiasIzakayaMod.addNetworkMessage(BankUiButtonMessage.class, BankUiButtonMessage::buffer, BankUiButtonMessage::new, BankUiButtonMessage::handler); + MystiasIzakayaMod.addNetworkMessage(BankUiButton.class, BankUiButton::buffer, BankUiButton::new, BankUiButton::handler); } } diff --git a/src/main/java/net/touhou/mystiasizakaya/network/CookingRangeUiButtonMessage.java b/src/main/java/net/touhou/mystiasizakaya/network/CookingRangeUiButton.java similarity index 79% rename from src/main/java/net/touhou/mystiasizakaya/network/CookingRangeUiButtonMessage.java rename to src/main/java/net/touhou/mystiasizakaya/network/CookingRangeUiButton.java index a318dfd0..500fb951 100644 --- a/src/main/java/net/touhou/mystiasizakaya/network/CookingRangeUiButtonMessage.java +++ b/src/main/java/net/touhou/mystiasizakaya/network/CookingRangeUiButton.java @@ -20,31 +20,31 @@ import java.util.HashMap; @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) -public class CookingRangeUiButtonMessage { +public class CookingRangeUiButton { private final int buttonID, x, y, z; - public CookingRangeUiButtonMessage(FriendlyByteBuf buffer) { + public CookingRangeUiButton(FriendlyByteBuf buffer) { this.buttonID = buffer.readInt(); this.x = buffer.readInt(); this.y = buffer.readInt(); this.z = buffer.readInt(); } - public CookingRangeUiButtonMessage(int buttonID, int x, int y, int z) { + public CookingRangeUiButton(int buttonID, int x, int y, int z) { this.buttonID = buttonID; this.x = x; this.y = y; this.z = z; } - public static void buffer(CookingRangeUiButtonMessage message, FriendlyByteBuf buffer) { + public static void buffer(CookingRangeUiButton message, FriendlyByteBuf buffer) { buffer.writeInt(message.buttonID); buffer.writeInt(message.x); buffer.writeInt(message.y); buffer.writeInt(message.z); } - public static void handler(CookingRangeUiButtonMessage message, Supplier contextSupplier) { + public static void handler(CookingRangeUiButton message, Supplier contextSupplier) { NetworkEvent.Context context = contextSupplier.get(); context.enqueueWork(() -> { Player entity = context.getSender(); @@ -90,7 +90,7 @@ public static void handleButtonAction(Player entity, int buttonID, int x, int y, @SubscribeEvent public static void registerMessage(FMLCommonSetupEvent event) { - MystiasIzakayaMod.addNetworkMessage(CookingRangeUiButtonMessage.class, CookingRangeUiButtonMessage::buffer, - CookingRangeUiButtonMessage::new, CookingRangeUiButtonMessage::handler); + MystiasIzakayaMod.addNetworkMessage(CookingRangeUiButton.class, CookingRangeUiButton::buffer, + CookingRangeUiButton::new, CookingRangeUiButton::handler); } } diff --git a/src/main/java/net/touhou/mystiasizakaya/network/Variables.java b/src/main/java/net/touhou/mystiasizakaya/network/Variables.java index 32d16e51..e798529a 100644 --- a/src/main/java/net/touhou/mystiasizakaya/network/Variables.java +++ b/src/main/java/net/touhou/mystiasizakaya/network/Variables.java @@ -27,14 +27,13 @@ import net.minecraft.core.Direction; import net.minecraft.client.Minecraft; +import java.util.Arrays; import java.util.function.Supplier; import java.util.List; import java.util.ArrayList; @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) public class Variables { - public static List orders = new ArrayList<>(); - public static List ordersbeverages = new ArrayList<>(); @SubscribeEvent public static void init(FMLCommonSetupEvent event) { @@ -113,8 +112,8 @@ public void deserializeNBT(Tag nbt) { public static class PlayerVariables { public double balance = 0; public boolean showbalance = true; - public List orders = new ArrayList<>(); - public List ordersbeverages = new ArrayList<>(); + public List orders = Arrays.asList("minecraft:air", "minecraft:air", "minecraft:air", "minecraft:air", "minecraft:air", "minecraft:air", "minecraft:air", "minecraft:air","minecraft:air"); + public List ordersbeverages = Arrays.asList("minecraft:air", "minecraft:air", "minecraft:air", "minecraft:air", "minecraft:air", "minecraft:air", "minecraft:air", "minecraft:air","minecraft:air"); public void syncPlayerVariables(Entity entity) { if (entity instanceof ServerPlayer serverPlayer) diff --git a/src/main/java/net/touhou/mystiasizakaya/orders/Addorder.java b/src/main/java/net/touhou/mystiasizakaya/orders/Addorder.java new file mode 100644 index 00000000..355a51ff --- /dev/null +++ b/src/main/java/net/touhou/mystiasizakaya/orders/Addorder.java @@ -0,0 +1,25 @@ +package net.touhou.mystiasizakaya.orders; + +import net.minecraft.world.entity.player.Player; +import net.minecraftforge.registries.ForgeRegistries; +import net.touhou.mystiasizakaya.network.Variables; + +import net.minecraft.world.item.ItemStack; + +import java.util.List; + +public class Addorder { + public static void execute(ItemStack beverages, ItemStack cuisines, double id, Player player) { + List orders_list = player.getCapability(Variables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new Variables.PlayerVariables()).orders; + List ordersbeverages_list = player.getCapability(Variables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new Variables.PlayerVariables()).ordersbeverages; + String cuisines_str = ForgeRegistries.ITEMS.getKey(cuisines.getItem()).toString(); + String beverages_str = ForgeRegistries.ITEMS.getKey(beverages.getItem()).toString(); + orders_list.set((int) id, cuisines_str); + ordersbeverages_list.set((int) id, beverages_str); + player.getCapability(Variables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> { + capability.orders = orders_list; + capability.ordersbeverages = ordersbeverages_list; + capability.syncPlayerVariables(player); + }); + } +} diff --git a/src/main/java/net/touhou/mystiasizakaya/orders/Deleteorder.java b/src/main/java/net/touhou/mystiasizakaya/orders/Deleteorder.java new file mode 100644 index 00000000..946ba0a2 --- /dev/null +++ b/src/main/java/net/touhou/mystiasizakaya/orders/Deleteorder.java @@ -0,0 +1,22 @@ +package net.touhou.mystiasizakaya.orders; + +import net.minecraft.world.entity.player.Player; +import net.touhou.mystiasizakaya.network.Variables; + +import java.util.List; + +public class Deleteorder { + public static void execute(double id, Player player) { + List orders_list = player.getCapability(Variables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new Variables.PlayerVariables()).orders; + List ordersbeverages_list = player.getCapability(Variables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new Variables.PlayerVariables()).ordersbeverages; + String cuisines_str = "minecraft:air"; + String beverages_str = "minecraft:air"; + orders_list.set((int) id, cuisines_str); + ordersbeverages_list.set((int) id, beverages_str); + player.getCapability(Variables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> { + capability.orders = orders_list; + capability.ordersbeverages = ordersbeverages_list; + capability.syncPlayerVariables(player); + }); + } +} diff --git a/src/main/java/net/touhou/mystiasizakaya/orders/GetBeveragesTexture.java b/src/main/java/net/touhou/mystiasizakaya/orders/GetBeveragesTexture.java index 30cc9057..57bb5c2a 100644 --- a/src/main/java/net/touhou/mystiasizakaya/orders/GetBeveragesTexture.java +++ b/src/main/java/net/touhou/mystiasizakaya/orders/GetBeveragesTexture.java @@ -9,7 +9,6 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.tags.ItemTags; import net.minecraft.resources.ResourceLocation; -import net.touhou.mystiasizakaya.procedures.GetTextureProcedure; import java.util.List; @@ -23,6 +22,6 @@ public static String execute(double id, Player player) { if (!new ItemStack(ForgeRegistries.ITEMS.getValue(new ResourceLocation(order))).is(tag)) { return ""; } - return GetTextureProcedure.get(order); + return order.split(":")[1]+ "_"; } } diff --git a/src/main/java/net/touhou/mystiasizakaya/orders/GetCuisinesTexture.java b/src/main/java/net/touhou/mystiasizakaya/orders/GetCuisinesTexture.java index f05562f5..9ea595ac 100644 --- a/src/main/java/net/touhou/mystiasizakaya/orders/GetCuisinesTexture.java +++ b/src/main/java/net/touhou/mystiasizakaya/orders/GetCuisinesTexture.java @@ -10,7 +10,6 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.tags.ItemTags; import net.minecraft.resources.ResourceLocation; -import net.touhou.mystiasizakaya.procedures.GetTextureProcedure; import java.util.List; @@ -24,6 +23,6 @@ public static String execute(double id, Player player) { if (!new ItemStack(ForgeRegistries.ITEMS.getValue(new ResourceLocation(order))).is(tag)) { return ""; } - return GetTextureProcedure.get(order); + return order.split(":")[1]+ "_"; } } diff --git a/src/main/java/net/touhou/mystiasizakaya/orders/Initorders.java b/src/main/java/net/touhou/mystiasizakaya/orders/Initorders.java index 837b0b5f..e7e16fc9 100644 --- a/src/main/java/net/touhou/mystiasizakaya/orders/Initorders.java +++ b/src/main/java/net/touhou/mystiasizakaya/orders/Initorders.java @@ -11,14 +11,14 @@ public class Initorders { public static void init(Player player) { List orders_list = player.getCapability(Variables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new Variables.PlayerVariables()).orders; List ordersbeverages_list = player.getCapability(Variables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new Variables.PlayerVariables()).ordersbeverages; - if (orders_list.size() == 0) { + if (orders_list.size() < 8) { for (int i = 0; i < 10; i++) { - orders_list.add(""); + orders_list.add("minecraft:air"); } } - if (ordersbeverages_list.size() == 0) { + if (ordersbeverages_list.size() < 8) { for (int i = 0; i < 10; i++) { - ordersbeverages_list.add(""); + ordersbeverages_list.add("minecraft:air"); } } player.getCapability(Variables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> { diff --git a/src/main/java/net/touhou/mystiasizakaya/procedures/AddordersProcedure.java b/src/main/java/net/touhou/mystiasizakaya/procedures/AddordersProcedure.java deleted file mode 100644 index 1b559f33..00000000 --- a/src/main/java/net/touhou/mystiasizakaya/procedures/AddordersProcedure.java +++ /dev/null @@ -1,12 +0,0 @@ -package net.touhou.mystiasizakaya.procedures; - -import net.touhou.mystiasizakaya.network.Variables; - -import net.minecraft.world.item.ItemStack; - -public class AddordersProcedure { - public static void execute(ItemStack beverages, ItemStack cuisines, double id) { - Variables.orders.set((int) id, cuisines); - Variables.ordersbeverages.set((int) id, beverages); - } -} diff --git a/src/main/java/net/touhou/mystiasizakaya/procedures/DeleteordersProcedure.java b/src/main/java/net/touhou/mystiasizakaya/procedures/DeleteordersProcedure.java deleted file mode 100644 index cef4fb88..00000000 --- a/src/main/java/net/touhou/mystiasizakaya/procedures/DeleteordersProcedure.java +++ /dev/null @@ -1,12 +0,0 @@ -package net.touhou.mystiasizakaya.procedures; - -import net.touhou.mystiasizakaya.network.Variables; - -import net.minecraft.world.item.ItemStack; - -public class DeleteordersProcedure { - public static void execute(double id) { - Variables.orders.set((int) id, ItemStack.EMPTY); - Variables.ordersbeverages.set((int) id, ItemStack.EMPTY); - } -} diff --git a/src/main/java/net/touhou/mystiasizakaya/procedures/GetTextureProcedure.java b/src/main/java/net/touhou/mystiasizakaya/procedures/GetTextureProcedure.java deleted file mode 100644 index 4b88aa02..00000000 --- a/src/main/java/net/touhou/mystiasizakaya/procedures/GetTextureProcedure.java +++ /dev/null @@ -1,30 +0,0 @@ -package net.touhou.mystiasizakaya.procedures; - -import net.minecraftforge.registries.ForgeRegistries; - -import net.minecraft.world.item.ItemStack; - -public class GetTextureProcedure { - public static String execute(ItemStack itemstack) { - ItemStack i = ItemStack.EMPTY; - ItemStack target = ItemStack.EMPTY; - String fm = ""; - String rn = ""; - target = itemstack; - if (ItemStack.EMPTY.getItem() == target.getItem()) { - return fm; - } - fm = ForgeRegistries.ITEMS.getKey(target.getItem()).toString(); - fm = fm.split(":")[1]; - fm += "_"; - return fm; - } - public static String get(String Reg) { - String fm = ""; - fm = Reg; - fm = fm.split(":")[1]; - fm += "_"; - return fm; - } - -}