Skip to content

Commit

Permalink
大修命令
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuqi154 committed Jun 10, 2024
1 parent 9fb704e commit 88d383f
Show file tree
Hide file tree
Showing 35 changed files with 331 additions and 444 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import net.touhou.mystiasizakaya.world.inventory.CookingRangeUiMenu;
import net.touhou.mystiasizakaya.procedures.ReProcedure;
import net.touhou.mystiasizakaya.cooking.Main;
import net.touhou.mystiasizakaya.procedures.InitialCookProcedure;
import net.touhou.mystiasizakaya.cooking.Init;
import net.touhou.mystiasizakaya.procedures.CleanProcedure;
import net.touhou.mystiasizakaya.block.entity.CookingRangeBlockEntity;

Expand Down Expand Up @@ -100,7 +100,7 @@ public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
public void onPlace(BlockState blockstate, Level world, BlockPos pos, BlockState oldState, boolean moving) {
super.onPlace(blockstate, world, pos, oldState, moving);
world.scheduleTick(pos, this, 1);
InitialCookProcedure.execute(world, pos.getX(), pos.getY(), pos.getZ());
Init.execute(world, pos.getX(), pos.getY(), pos.getZ());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

package net.touhou.mystiasizakaya.client.screens;

import net.touhou.mystiasizakaya.network.Variables;
import net.touhou.mystiasizakaya.procedures.ShowbalanceLProcedure;
import net.touhou.mystiasizakaya.network.MystiasIzakayaModVariables;

import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.eventbus.api.SubscribeEvent;
Expand All @@ -23,8 +23,8 @@ public static void eventHandler(RenderGuiEvent.Pre event) {
Player entity = Minecraft.getInstance().player;
String text = Component.translatable("gui.mystias_izakaya.balance").getString() + ""
+ new java.text.DecimalFormat("#######")
.format((entity.getCapability(MystiasIzakayaModVariables.PLAYER_VARIABLES_CAPABILITY, null)
.orElse(new MystiasIzakayaModVariables.PlayerVariables())).balance)
.format((entity.getCapability(Variables.PLAYER_VARIABLES_CAPABILITY, null)
.orElse(new Variables.PlayerVariables())).balance)
+ "\u5186";
int strlength = Minecraft.getInstance().font.width(text);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@

package net.touhou.mystiasizakaya.client.screens;

import org.checkerframework.checker.units.qual.h;

import net.touhou.mystiasizakaya.procedures.GetCuisinesTextureProcedure;
import net.touhou.mystiasizakaya.procedures.GetBeveragesTextureProcedure;
import net.touhou.mystiasizakaya.orders.GetCuisinesTexture;
import net.touhou.mystiasizakaya.orders.GetBeveragesTexture;

import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.eventbus.api.SubscribeEvent;
Expand All @@ -15,7 +13,6 @@
import net.minecraft.world.level.Level;
import net.minecraft.world.entity.player.Player;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.network.chat.Component;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.client.Minecraft;

Expand Down Expand Up @@ -51,8 +48,8 @@ public static void eventHandler(RenderGuiEvent.Pre event) {
String fmb = "";
int reali = 0;
for (int i = 0; i < 7; i++) {
fm = GetCuisinesTextureProcedure.execute(i);
fmb = GetBeveragesTextureProcedure.execute(i);
fm = GetCuisinesTexture.execute(i, entity);
fmb = GetBeveragesTexture.execute(i, entity);
if (fm != "" || fmb != "") {

event.getGuiGraphics().blit(new ResourceLocation("mystias_izakaya:textures/screens/page.png"),
Expand Down
95 changes: 95 additions & 0 deletions src/main/java/net/touhou/mystiasizakaya/command/Addcurrency.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@

package net.touhou.mystiasizakaya.command;

import net.touhou.mystiasizakaya.command.sub.Set;
import net.touhou.mystiasizakaya.command.sub.Add;
import net.touhou.mystiasizakaya.command.sub.Qurey;

import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.event.RegisterCommandsEvent;

import net.minecraft.commands.arguments.EntityArgument;
import net.minecraft.commands.Commands;

import java.util.HashMap;

import com.mojang.brigadier.arguments.StringArgumentType;
import com.mojang.brigadier.arguments.DoubleArgumentType;

@Mod.EventBusSubscriber
public class Addcurrency {
@SubscribeEvent
public static void registerCommand(RegisterCommandsEvent event) {
event.getDispatcher().register(Commands.literal("mi_currency").requires(s -> s.hasPermission(3)).then(Commands.literal("add")
.then(Commands.argument("player", EntityArgument.player()).then(Commands.argument("number", DoubleArgumentType.doubleArg(0)).then(Commands.argument("arguments", StringArgumentType.greedyString()).executes(arguments -> {
HashMap<String, String> cmdparams = new HashMap<>();
int index = -1;
for (String param : arguments.getInput().split("\\s+")) {
if (index >= 0)
cmdparams.put(Integer.toString(index), param);
index++;
}

Add.execute(arguments);
return 0;
})).executes(arguments -> {
HashMap<String, String> cmdparams = new HashMap<>();
int index = -1;
for (String param : arguments.getInput().split("\\s+")) {
if (index >= 0)
cmdparams.put(Integer.toString(index), param);
index++;
}
Add.execute(arguments);
return 0;
})))).then(Commands.literal("query")
.then(Commands.argument("player", EntityArgument.player()).then(Commands.argument("number", DoubleArgumentType.doubleArg(0)).then(Commands.argument("arguments", StringArgumentType.greedyString()).executes(arguments -> {
HashMap<String, String> cmdparams = new HashMap<>();
int index = -1;
for (String param : arguments.getInput().split("\\s+")) {
if (index >= 0)
cmdparams.put(Integer.toString(index), param);
index++;
}

Qurey.execute(arguments);
return 0;
})).executes(arguments -> {
HashMap<String, String> cmdparams = new HashMap<>();
int index = -1;
for (String param : arguments.getInput().split("\\s+")) {
if (index >= 0)
cmdparams.put(Integer.toString(index), param);
index++;
}

Qurey.execute(arguments);
return 0;
}))))
.then(Commands.literal("set")
.then(Commands.argument("player", EntityArgument.player()).then(Commands.argument("number", DoubleArgumentType.doubleArg(0)).then(Commands.argument("arguments", StringArgumentType.greedyString()).executes(arguments -> {
HashMap<String, String> cmdparams = new HashMap<>();
int index = -1;
for (String param : arguments.getInput().split("\\s+")) {
if (index >= 0)
cmdparams.put(Integer.toString(index), param);
index++;
}

Set.execute(arguments);
return 0;
})).executes(arguments -> {
HashMap<String, String> cmdparams = new HashMap<>();
int index = -1;
for (String param : arguments.getInput().split("\\s+")) {
if (index >= 0)
cmdparams.put(Integer.toString(index), param);
index++;
}

Set.execute(arguments);
return 0;
})))));
}
}

This file was deleted.

Loading

0 comments on commit 88d383f

Please sign in to comment.