Skip to content

Commit

Permalink
重构文件结构
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuqi154 committed Jun 5, 2024
1 parent 0c815ce commit 704a2ed
Show file tree
Hide file tree
Showing 41 changed files with 128 additions and 236 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import net.touhou.mystiasizakaya.world.inventory.CookingRangeUiMenu;
import net.touhou.mystiasizakaya.procedures.ReProcedure;
import net.touhou.mystiasizakaya.procedures.MainProcedure;
import net.touhou.mystiasizakaya.cooking.Main;
import net.touhou.mystiasizakaya.procedures.InitialCookProcedure;
import net.touhou.mystiasizakaya.procedures.CleanProcedure;
import net.touhou.mystiasizakaya.block.entity.CookingRangeBlockEntity;
Expand Down Expand Up @@ -46,10 +46,8 @@
import net.minecraft.client.gui.screens.Screen;

import java.util.List;
import java.util.Set;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedHashSet;

import io.netty.buffer.Unpooled;

Expand Down Expand Up @@ -111,7 +109,7 @@ public void tick(BlockState blockstate, ServerLevel world, BlockPos pos, RandomS
int x = pos.getX();
int y = pos.getY();
int z = pos.getZ();
MainProcedure.execute(world, x, y, z);
Main.execute(world, x, y, z);
world.scheduleTick(pos, this, 1);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package net.touhou.mystiasizakaya.client.gui;

import net.touhou.mystiasizakaya.world.inventory.BankUiMenu;
import net.touhou.mystiasizakaya.procedures.Text10Procedure;
import net.touhou.mystiasizakaya.network.BankUiButtonMessage;
import net.touhou.mystiasizakaya.MystiasIzakayaMod;

Expand Down Expand Up @@ -78,7 +77,7 @@ public void containerTick() {
protected void renderLabels(GuiGraphics guiGraphics, int mouseX, int mouseY) {
guiGraphics.drawString(this.font,

Text10Procedure.execute(), 66, 24, -12829636, false);
Component.translatable("gui.mystias_izakaya.bank_ui.bank").getString(), 66, 24, -12829636, false);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package net.touhou.mystiasizakaya.client.gui;

import net.touhou.mystiasizakaya.world.inventory.CookingRangeUiMenu;
import net.touhou.mystiasizakaya.procedures.TargetsText;
import net.touhou.mystiasizakaya.procedures.ButtunShow;
import net.touhou.mystiasizakaya.procedures.StatusProcedure;
import net.touhou.mystiasizakaya.procedures.LefttimeProcedure;
import net.touhou.mystiasizakaya.util.TargetsText;
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.MystiasIzakayaMod;

Expand Down Expand Up @@ -85,8 +85,8 @@ protected void renderLabels(GuiGraphics guiGraphics, int mouseX, int mouseY) {
guiGraphics.drawString(this.font, TargetsText.get(world, x, y, z, 2), 44, 83, -1, false);
guiGraphics.drawString(this.font, TargetsText.get(world, x, y, z, 3), 44, 110, -1, false);
guiGraphics.drawString(this.font, TargetsText.get(world, x, y, z, 4), 44, 137, -1, false);
guiGraphics.drawString(this.font, StatusProcedure.execute(world, x, y, z), 233, 26, -1, false);
guiGraphics.drawString(this.font, LefttimeProcedure.execute(world, x, y, z), 238, 65, -1, false);
guiGraphics.drawString(this.font, Status.execute(world, x, y, z), 233, 26, -1, false);
guiGraphics.drawString(this.font, Lefttime.execute(world, x, y, z), 238, 65, -1, false);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package net.touhou.mystiasizakaya.procedures;
package net.touhou.mystiasizakaya.cooking;

import net.touhou.mystiasizakaya.init.MystiasIzakayaModItems;

import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.common.capabilities.ForgeCapabilities;

import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.entity.BlockEntity;
Expand All @@ -13,16 +11,20 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.core.BlockPos;

import net.touhou.mystiasizakaya.procedures.GetItemStack;
import net.touhou.mystiasizakaya.procedures.SetSlotItem;
import net.touhou.mystiasizakaya.procedures.GetKitchenwareTagProcedure;
import net.touhou.mystiasizakaya.cooking.get.GetTagFromItemStacks;
import net.touhou.mystiasizakaya.cooking.get.GetTargetNagetivetags;
import net.touhou.mystiasizakaya.cooking.get.GetTargetTags;
import net.touhou.mystiasizakaya.util.GetItemStack;
import net.touhou.mystiasizakaya.util.GetValue;
import net.touhou.mystiasizakaya.util.SetSlotItem;

import java.util.concurrent.atomic.AtomicReference;
import java.util.Set;
import java.util.LinkedHashSet;
import java.util.HashSet;
import java.util.ArrayList;

public class ConfirmProcedure {
public class Confirm {
public static void execute(LevelAccessor world, double x, double y, double z) {
boolean bool = false;
double time = 0;
Expand All @@ -33,9 +35,9 @@ public static void execute(LevelAccessor world, double x, double y, double z) {
if ((ItemStack.EMPTY.getItem() == GetItemStack.getItemStack(world, BlockPos.containing(x, y, z), 6).getItem())
&& !(ItemStack.EMPTY.getItem() == GetItemStack.getItemStack(world, BlockPos.containing(x, y, z), 12)
.getItem()) && time == 0) {
ArrayList<String> rawtags = (ArrayList) GetTagFromItemStacksProcedure.execute(world, x, y, z);
ArrayList<String> targettags = (ArrayList) GetTargetTagsProcedure.execute(world, x, y, z);
ArrayList<String> targetntags = (ArrayList) GetTargetNagetivetagsProcedure.execute(world, x, y, z);
ArrayList<String> rawtags = (ArrayList) GetTagFromItemStacks.execute(world, x, y, z);
ArrayList<String> targettags = (ArrayList) GetTargetTags.execute(world, x, y, z);
ArrayList<String> targetntags = (ArrayList) GetTargetNagetivetags.execute(world, x, y, z);
target = GetItemStack.getItemStack(world, BlockPos.containing(x, y, z), 12);
Kitchenware = GetItemStack.getItemStack(world, BlockPos.containing(x, y, z), 0);
ArrayList<String> combinedList = new ArrayList<String>(rawtags);
Expand Down Expand Up @@ -93,7 +95,7 @@ public static void execute(LevelAccessor world, double x, double y, double z) {
BlockEntity _blockEntity = world.getBlockEntity(_bp);
BlockState _bs = world.getBlockState(_bp);
if (_blockEntity != null)
_blockEntity.getPersistentData().putDouble("timeleft", GetTimeProcedure.execute(world, x, y, z));
_blockEntity.getPersistentData().putDouble("timeleft", GetTime.execute(world, x, y, z));
if (world instanceof Level _level)
_level.sendBlockUpdated(_bp, _bs, _bs, 3);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
package net.touhou.mystiasizakaya.procedures;
package net.touhou.mystiasizakaya.cooking;

import net.touhou.mystiasizakaya.init.MystiasIzakayaModItems;

import net.minecraftforge.common.capabilities.ForgeCapabilities;

import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.item.ItemStack;
import net.minecraft.core.BlockPos;

import net.touhou.mystiasizakaya.procedures.GetItemStack;
import net.touhou.mystiasizakaya.procedures.SetSlotItem;

import java.util.concurrent.atomic.AtomicReference;
import net.touhou.mystiasizakaya.util.GetItemStack;

public class GetTimeProcedure {
public class GetTime {
public static double execute(LevelAccessor world, double x, double y, double z) {
ItemStack target = ItemStack.EMPTY;
double time = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package net.touhou.mystiasizakaya.procedures;
package net.touhou.mystiasizakaya.cooking;

import net.touhou.mystiasizakaya.cooking.kitchenwares.*;
import net.touhou.mystiasizakaya.init.MystiasIzakayaModItems;

import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.common.capabilities.ForgeCapabilities;

import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.entity.BlockEntity;
Expand All @@ -14,19 +13,16 @@
import net.minecraft.resources.ResourceLocation;
import net.minecraft.core.BlockPos;

import net.touhou.mystiasizakaya.procedures.GetItemStack;
import net.touhou.mystiasizakaya.procedures.SetSlotItem;
import net.touhou.mystiasizakaya.procedures.GetValue;
import net.touhou.mystiasizakaya.util.GetItemStack;
import net.touhou.mystiasizakaya.util.SetSlotItem;
import net.touhou.mystiasizakaya.util.GetValue;

import java.util.regex.Pattern;
import java.util.regex.Matcher;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.List;
import java.util.Set;
import java.util.ArrayList;

public class MainProcedure {
public class Main {
public static void execute(LevelAccessor world, double x, double y, double z) {
String str = "";
double i = 0;
Expand Down Expand Up @@ -101,19 +97,19 @@ public static void execute(LevelAccessor world, double x, double y, double z) {
SetSlotItem.setEmptySlot(world, x, y, z, 12);
}
if (util.getItem() == MystiasIzakayaModItems.LIAO_LI_TAI.get()) {
str = CuttingBoardProcedure.execute(world, x, y, z);
str = CuttingBoard.execute(world, x, y, z);
}
if (util.getItem() == MystiasIzakayaModItems.SHAO_KAO_JIA.get()) {
str = GrillProcedure.execute(world, x, y, z);
str = Grill.execute(world, x, y, z);
}
if (util.getItem() == MystiasIzakayaModItems.YOU_GUO.get()) {
str = FryingPanProcedure.execute(world, x, y, z);
str = FryingPan.execute(world, x, y, z);
}
if (util.getItem() == MystiasIzakayaModItems.ZHENG_GUO.get()) {
str = SteamerProcedure.execute(world, x, y, z);
str = Steamer.execute(world, x, y, z);
}
if (util.getItem() == MystiasIzakayaModItems.ZHU_GUO.get()) {
str = BoilingPotProcedure.execute(world, x, y, z);
str = BoilingPot.execute(world, x, y, z);
}
String longString = str;
String regex = "\\$start%(.*?)\\$end%"; // 创建 Pattern 对象
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
package net.touhou.mystiasizakaya.procedures;
package net.touhou.mystiasizakaya.cooking.get;

import org.checkerframework.checker.units.qual.s;
import net.touhou.mystiasizakaya.procedures.YHCProcedure;
import net.touhou.mystiasizakaya.util.GetItemStack;

import net.touhou.mystiasizakaya.init.MystiasIzakayaModItems;

import net.minecraftforge.common.capabilities.ForgeCapabilities;

import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.item.ItemStack;
import net.minecraft.core.BlockPos;

import java.util.concurrent.atomic.AtomicReference;
import java.util.List;
import java.util.ArrayList;

public class GetRawsFromSelectedFoodProcedure {
public class GetRawsFromSelectedFood {
public static ArrayList execute(LevelAccessor world, double x, double y, double z) {
ItemStack s = ItemStack.EMPTY;
ItemStack raw = ItemStack.EMPTY;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.touhou.mystiasizakaya.procedures;
package net.touhou.mystiasizakaya.cooking.get;

import net.touhou.mystiasizakaya.item.ZunYuItem;
import net.touhou.mystiasizakaya.item.ZhuZiItem;
Expand Down Expand Up @@ -62,7 +62,7 @@
import java.util.LinkedHashSet;
import java.util.ArrayList;

public class GetTagFromItemStacksProcedure {
public class GetTagFromItemStacks {
public static ArrayList execute(LevelAccessor world, double x, double y, double z) {
String str = "";
ItemStack raw = ItemStack.EMPTY;
Expand All @@ -71,7 +71,7 @@ public static ArrayList execute(LevelAccessor world, double x, double y, double
List<Object> araws = new ArrayList<>();
List<String> tags = new ArrayList<>();
List<String> negativetags = new ArrayList<>();
araws = (ArrayList) GetRawsFromSelectedFoodProcedure.execute(world, x, y, z);
araws = (ArrayList) GetRawsFromSelectedFood.execute(world, x, y, z);
i = 0;
while (i < araws.size()) {
raws.add((ForgeRegistries.ITEMS.getKey((araws.get((int) i) instanceof ItemStack _bs ? _bs : ItemStack.EMPTY).getItem()).toString()));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.touhou.mystiasizakaya.procedures;
package net.touhou.mystiasizakaya.cooking.get;

import net.touhou.mystiasizakaya.item.ZunYuItem;
import net.touhou.mystiasizakaya.item.ZhuZiItem;
Expand Down Expand Up @@ -53,23 +53,20 @@
import net.touhou.mystiasizakaya.init.MystiasIzakayaModItems;

import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.common.capabilities.ForgeCapabilities;

import net.touhou.mystiasizakaya.procedures.GetItemStack;
import net.touhou.mystiasizakaya.procedures.SetSlotItem;
import net.touhou.mystiasizakaya.procedures.YHCProcedure;
import net.touhou.mystiasizakaya.util.GetItemStack;

import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.item.ItemStack;
import net.minecraft.core.BlockPos;

import java.util.concurrent.atomic.AtomicReference;
import java.util.Set;
import java.util.List;
import java.util.LinkedHashSet;
import java.util.ArrayList;

public class GetTagFromRawsProcedure {
public class GetTagFromRaws {
public static ArrayList execute(LevelAccessor world, double x, double y, double z) {
String str = "";
ItemStack raw = ItemStack.EMPTY;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.touhou.mystiasizakaya.procedures;
package net.touhou.mystiasizakaya.cooking.get;

import net.touhou.mystiasizakaya.item.ZhuTongZhengDanItem;
import net.touhou.mystiasizakaya.item.ZhuSunChaoRouItem;
Expand Down Expand Up @@ -74,23 +74,18 @@
import net.touhou.mystiasizakaya.item.BaiGuoLuoBuPaiGuTangItem;
import net.touhou.mystiasizakaya.init.MystiasIzakayaModItems;

import net.minecraftforge.common.capabilities.ForgeCapabilities;
import net.touhou.mystiasizakaya.util.GetItemStack;

import net.touhou.mystiasizakaya.procedures.GetItemStack;
import net.touhou.mystiasizakaya.procedures.SetSlotItem;

import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.item.ItemStack;
import net.minecraft.core.BlockPos;

import java.util.concurrent.atomic.AtomicReference;
import java.util.Set;
import java.util.List;
import java.util.LinkedHashSet;
import java.util.ArrayList;

public class GetTargetNagetivetagsProcedure {
public class GetTargetNagetivetags {
public static ArrayList execute(LevelAccessor world, double x, double y, double z) {
ItemStack target = ItemStack.EMPTY;
double time = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.touhou.mystiasizakaya.procedures;
package net.touhou.mystiasizakaya.cooking.get;

import net.touhou.mystiasizakaya.item.ZhuTongZhengDanItem;
import net.touhou.mystiasizakaya.item.ZhuSunChaoRouItem;
Expand Down Expand Up @@ -74,23 +74,18 @@
import net.touhou.mystiasizakaya.item.BaiGuoLuoBuPaiGuTangItem;
import net.touhou.mystiasizakaya.init.MystiasIzakayaModItems;

import net.minecraftforge.common.capabilities.ForgeCapabilities;
import net.touhou.mystiasizakaya.util.GetItemStack;

import net.touhou.mystiasizakaya.procedures.GetItemStack;
import net.touhou.mystiasizakaya.procedures.SetSlotItem;

import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.item.ItemStack;
import net.minecraft.core.BlockPos;

import java.util.concurrent.atomic.AtomicReference;
import java.util.Set;
import java.util.List;
import java.util.LinkedHashSet;
import java.util.ArrayList;

public class GetTargetTagsProcedure {
public class GetTargetTags {
public static ArrayList execute(LevelAccessor world, double x, double y, double z) {
ItemStack target = ItemStack.EMPTY;
double time = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
package net.touhou.mystiasizakaya.procedures;
package net.touhou.mystiasizakaya.cooking.kitchenwares;

import net.touhou.mystiasizakaya.init.MystiasIzakayaModItems;

import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.common.capabilities.ForgeCapabilities;

import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.item.ItemStack;
import net.minecraft.core.BlockPos;

import net.touhou.mystiasizakaya.procedures.GetItemStack;
import net.touhou.mystiasizakaya.procedures.SetSlotItem;
import net.touhou.mystiasizakaya.procedures.YHCProcedure;
import net.touhou.mystiasizakaya.util.GetItemStack;

import java.util.concurrent.atomic.AtomicReference;
import java.util.List;
import java.util.ArrayList;

public class BoilingPotProcedure {
public class BoilingPot {
public static String execute(LevelAccessor world, double x, double y, double z) {
String str = "";
List<Object> raws = new ArrayList<>();
Expand Down
Loading

0 comments on commit 704a2ed

Please sign in to comment.