Skip to content

Commit

Permalink
Ciallo~(∠・ω< )⌒★
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuqi154 committed Sep 6, 2024
1 parent 6f544c2 commit c18f4e4
Show file tree
Hide file tree
Showing 23 changed files with 281 additions and 67 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ loader_version_range=[4,)
mod_id=mystias_izakaya
mod_name=Mystia's Izakaya
mod_license=GPLv3
mod_version=0.1.0-rc2
mod_version=0.1.0-rc3
mod_group_id=org.hiedacamellia.mystiasizakaya
mod_authors=HiedaCamellia
mod_description=
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.21 2024-09-03T23:08:01.8919636 Languages: zh_cn for mod: mystias_izakaya
5531b58ced64a027efef04bacae322a4c6d56cb4 assets/mystias_izakaya/lang/zh_cn.json
// 1.21 2024-09-06T21:17:50.8570258 Languages: zh_cn for mod: mystias_izakaya
fd29b5966bc5b85ab15935276be72f549f3eaa3a assets/mystias_izakaya/lang/zh_cn.json
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.21 2024-09-03T23:08:01.892963 Languages: en_us for mod: mystias_izakaya
2c6023acc129d79c40c68d3d0d276508361b0fe7 assets/mystias_izakaya/lang/en_us.json
// 1.21 2024-09-06T21:17:50.8590255 Languages: en_us for mod: mystias_izakaya
421f5570905649e79dcfa370b77bed8756d6edd0 assets/mystias_izakaya/lang/en_us.json
13 changes: 13 additions & 0 deletions src/generated/resources/assets/mystias_izakaya/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,19 @@
"message.mystiasizakaya.checkout.fail": "Insufficient balance",
"message.mystiasizakaya.checkout.success": "Checkout success",
"message.mystiasizakaya.telephone.colddown": "Please wait %s seconds",
"mystias_izakaya.configuration.debug": "Debug Mode",
"mystias_izakaya.configuration.debug.tooltip": "Set to true to enable debug info",
"mystias_izakaya.configuration.max_overturn": "Maximum Overturn",
"mystias_izakaya.configuration.max_overturn.tooltip": "The maximum number of turnovers to store",
"mystias_izakaya.configuration.section.mystias.izakaya.client.toml": "Client Configuration",
"mystias_izakaya.configuration.section.mystias.izakaya.client.toml.title": "Mysita's Izakaya Client Configuration",
"mystias_izakaya.configuration.section.mystias.izakaya.common.toml": "Common Configuration",
"mystias_izakaya.configuration.section.mystias.izakaya.common.toml.title": "Mystia's Izakaya Common Configuration",
"mystias_izakaya.configuration.show_balance": "Show Balance",
"mystias_izakaya.configuration.show_balance.tooltip": "Set to true to display balance in the HUD",
"mystias_izakaya.configuration.tele_cooldown": "Telephone Cooldown",
"mystias_izakaya.configuration.tele_cooldown.tooltip": "The cooldown time for the telephone(tick)",
"mystias_izakaya.configuration.title": "Mystia's Izakaya Configuration",
"network.mystiasizakaya.failed": "Failed to handle network data: %s",
"status.mystias_izakaya.free": "Free",
"status.mystias_izakaya.outputblocked": "Output Blocked",
Expand Down
13 changes: 13 additions & 0 deletions src/generated/resources/assets/mystias_izakaya/lang/zh_cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,19 @@
"message.mystiasizakaya.checkout.fail": "余额不足",
"message.mystiasizakaya.checkout.success": "购买成功",
"message.mystiasizakaya.telephone.colddown": "冷却中: %s秒",
"mystias_izakaya.configuration.debug": "调试模式",
"mystias_izakaya.configuration.debug.tooltip": "设置为true以启用调试信息",
"mystias_izakaya.configuration.max_overturn": "最大流水数",
"mystias_izakaya.configuration.max_overturn.tooltip": "要存储的最大流水次数",
"mystias_izakaya.configuration.section.mystias.izakaya.client.toml": "客户端配置",
"mystias_izakaya.configuration.section.mystias.izakaya.client.toml.title": "夜雀食堂 客户端配置",
"mystias_izakaya.configuration.section.mystias.izakaya.common.toml": "通用配置",
"mystias_izakaya.configuration.section.mystias.izakaya.common.toml.title": "夜雀食堂 通用配置",
"mystias_izakaya.configuration.show_balance": "显示余额",
"mystias_izakaya.configuration.show_balance.tooltip": "设置为true以在hud中显示余额",
"mystias_izakaya.configuration.tele_cooldown": "电话冷却时间",
"mystias_izakaya.configuration.tele_cooldown.tooltip": "电话的冷却时间(刻)",
"mystias_izakaya.configuration.title": "夜雀食堂 配置",
"network.mystiasizakaya.failed": "无法处理网络数据: %s",
"status.mystias_izakaya.free": "空闲",
"status.mystias_izakaya.outputblocked": "输出受阻",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_book": {
"conditions": {
"items": [
{
"items": "minecraft:book"
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "mystias_izakaya:ledger"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_the_recipe",
"has_book"
]
],
"rewards": {
"recipes": [
"mystias_izakaya:ledger"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_planks": {
"conditions": {
"items": [
{
"items": "#minecraft:planks"
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "mystias_izakaya:table"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_the_recipe",
"has_planks"
]
],
"rewards": {
"recipes": [
"mystias_izakaya:table"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_ender_pearl": {
"conditions": {
"items": [
{
"items": "minecraft:ender_pearl"
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "mystias_izakaya:telephone"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_the_recipe",
"has_ender_pearl"
]
],
"rewards": {
"recipes": [
"mystias_izakaya:telephone"
]
}
}
19 changes: 19 additions & 0 deletions src/generated/resources/data/mystias_izakaya/recipe/ledger.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"type": "minecraft:crafting_shapeless",
"category": "misc",
"ingredients": [
{
"item": "minecraft:book"
},
{
"item": "minecraft:paper"
},
{
"item": "minecraft:paper"
}
],
"result": {
"count": 1,
"id": "mystias_izakaya:ledger"
}
}
20 changes: 20 additions & 0 deletions src/generated/resources/data/mystias_izakaya/recipe/table.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"type": "minecraft:crafting_shaped",
"category": "misc",
"key": {
"#": {
"tag": "minecraft:wooden_slabs"
},
"X": {
"tag": "minecraft:wooden_fences"
}
},
"pattern": [
"#",
"X"
],
"result": {
"count": 1,
"id": "mystias_izakaya:table"
}
}
23 changes: 23 additions & 0 deletions src/generated/resources/data/mystias_izakaya/recipe/telephone.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"type": "minecraft:crafting_shaped",
"category": "misc",
"key": {
"#": {
"tag": "minecraft:planks"
},
"S": {
"item": "minecraft:iron_ingot"
},
"X": {
"item": "minecraft:ender_pearl"
}
},
"pattern": [
"SXS",
"###"
],
"result": {
"count": 1,
"id": "mystias_izakaya:telephone"
}
}
45 changes: 0 additions & 45 deletions src/main/java/org/hiedacamellia/mystiasizakaya/Config.java

This file was deleted.

14 changes: 12 additions & 2 deletions src/main/java/org/hiedacamellia/mystiasizakaya/MystiasIzakaya.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@
import net.neoforged.fml.ModContainer;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.config.ModConfig;
import net.neoforged.neoforge.common.NeoForge;
import net.neoforged.fml.loading.FMLLoader;
import net.neoforged.neoforge.client.gui.ConfigurationScreen;
import net.neoforged.neoforge.client.gui.IConfigScreenFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.hiedacamellia.mystiasizakaya.core.config.ClientConfig;
import org.hiedacamellia.mystiasizakaya.core.config.CommonConfig;
import org.hiedacamellia.mystiasizakaya.core.data.Data;
import org.hiedacamellia.mystiasizakaya.core.event.MIEvent;
import org.hiedacamellia.mystiasizakaya.registries.*;

@Mod("mystias_izakaya")
Expand All @@ -19,6 +24,7 @@ public class MystiasIzakaya {
public MystiasIzakaya(IEventBus modEventBus, ModContainer modContainer)
{
modEventBus.addListener(Data::onGatherData);
modEventBus.addListener(MIEvent::onCommonSetup);

MIBlock.BLOCKS.register(modEventBus);
MIBlockEntitiy.REGISTRY.register(modEventBus);
Expand All @@ -29,6 +35,10 @@ public MystiasIzakaya(IEventBus modEventBus, ModContainer modContainer)
MIAttachment.ATTACHMENTS.register(modEventBus);
MIDatacomponet.DATA_COMPONENTS.register(modEventBus);

modContainer.registerConfig(ModConfig.Type.COMMON, Config.SPEC);
modContainer.registerConfig(ModConfig.Type.COMMON, CommonConfig.SPEC);
modContainer.registerConfig(ModConfig.Type.CLIENT, ClientConfig.SPEC);
if(FMLLoader.getDist().isClient())
modContainer.registerExtensionPoint(IConfigScreenFactory.class, ConfigurationScreen::new);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.neoforge.client.event.RenderGuiEvent;
import org.hiedacamellia.mystiasizakaya.Config;
import org.hiedacamellia.mystiasizakaya.core.config.ClientConfig;
import org.hiedacamellia.mystiasizakaya.core.config.CommonConfig;
import org.hiedacamellia.mystiasizakaya.registries.MIAttachment;

@EventBusSubscriber({ Dist.CLIENT })
Expand All @@ -25,7 +26,7 @@ public static void eventHandler(RenderGuiEvent.Pre event) {
.format(entity.getData(MIAttachment.MI_BALANCE).balance()) + "\u5186";
int strlength = Minecraft.getInstance().font.width(text);

if (Config.SHOW_BALANCE.get())
if (ClientConfig.SHOW_BALANCE.get())
event.getGuiGraphics().drawString(Minecraft.getInstance().font, text, w - 20 - strlength, h - 11, -1,
false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import net.minecraft.world.entity.player.Player;
import net.neoforged.neoforge.network.PacketDistributor;
import net.neoforged.neoforge.network.handling.IPayloadContext;
import org.hiedacamellia.mystiasizakaya.Config;
import org.hiedacamellia.mystiasizakaya.core.config.CommonConfig;
import org.hiedacamellia.mystiasizakaya.MystiasIzakaya;
import org.hiedacamellia.mystiasizakaya.registries.MIAttachment;
import org.jetbrains.annotations.NotNull;
Expand Down Expand Up @@ -73,7 +73,7 @@ public MITurnover deleteTurnover(String key){
}

public MITurnover deleteOverStack(){
int stack = Config.MAX_OVERTURN.get();
int stack = CommonConfig.MAX_OVERTURN.get();
List<String> k = new ArrayList<>(this.k());
List<Double> v = new ArrayList<>(this.v());
while(k.size() > stack){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.neoforge.common.util.FakePlayerFactory;
import net.neoforged.neoforge.event.RegisterCommandsEvent;
import org.hiedacamellia.mystiasizakaya.Config;
import org.hiedacamellia.mystiasizakaya.core.config.ClientConfig;
import org.hiedacamellia.mystiasizakaya.core.config.CommonConfig;

@EventBusSubscriber
public class Showbalance {
Expand All @@ -28,7 +29,7 @@ public static void registerCommand(RegisterCommandsEvent event) {
{
boolean set = BoolArgumentType.getBool(arguments, "logic");

Config.SHOW_BALANCE.set(set);
ClientConfig.SHOW_BALANCE.set(set);

}
return 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.hiedacamellia.mystiasizakaya.core.config;

import net.neoforged.neoforge.common.ModConfigSpec;

public class ClientConfig {
private static final ModConfigSpec.Builder BUILDER = new ModConfigSpec.Builder();

public static final ModConfigSpec.BooleanValue SHOW_BALANCE = BUILDER
.comment("Set to true to display balance in the hud")
.comment("设置为true以在hud中显示余额")
.define("show_balance", false);

public static final ModConfigSpec SPEC = BUILDER.build();
}
Loading

0 comments on commit c18f4e4

Please sign in to comment.