Skip to content

Commit

Permalink
更新元宵节相关内容
Browse files Browse the repository at this point in the history
  • Loading branch information
Gu-ZT committed Feb 20, 2024
1 parent c36e1d4 commit 24f2c35
Show file tree
Hide file tree
Showing 11 changed files with 162 additions and 57 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
* 修改苦力怕烟花形状为龙
* 修改兔肉煲物品的模型为饺子
* 修改甜菜汤物品的模型为汤圆
* [ ] 元旦节
* [ ] 元宵节
* [X] 元宵节
* 修改灯笼、灵魂灯笼的模型为灯笼
* 修改甜菜汤物品的模型为汤圆
* [ ] 端午节
* [ ] 七夕节
* [X] 中秋节
Expand All @@ -34,6 +35,7 @@

* 古镇天Gugle(代码)
* Xe_Kr(策划,美工)
* Cjsah(代码)

### 使用到的项目

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,13 @@
import net.minecraft.commands.Commands;
import net.minecraft.network.chat.Component;

import java.util.function.Function;
import java.util.function.Supplier;

public class DebugCommands {
public static float test = 0;
public static Function<String, Component> SUCCESS_MSG = (id) ->
Component.translatable("command.debug.message", Component.translatable("festival." + id + ".name"));

public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
LiteralArgumentBuilder<CommandSourceStack> command = Commands.literal("festivals")
Expand All @@ -38,7 +43,7 @@ public static ArgumentBuilder<CommandSourceStack, LiteralArgumentBuilder<Command
ArgumentBuilder<CommandSourceStack, LiteralArgumentBuilder<CommandSourceStack>> node = Commands.literal("set").requires(commandSourceStack -> commandSourceStack.hasPermission(3));
node.then(Commands.literal("none").executes(context -> {
ChineseFestivals.debugFestival = null;
context.getSource().sendSuccess(() -> Component.literal("Festivals have been set as " + ChineseFestivals.debugFestival.getId()), false);
context.getSource().sendSuccess(() -> SUCCESS_MSG.apply(ChineseFestivals.debugFestival.getId()), false);
return 0;
}));
for (IFestival festival : Festivals.FESTIVALS) {
Expand All @@ -47,7 +52,7 @@ public static ArgumentBuilder<CommandSourceStack, LiteralArgumentBuilder<Command
ChineseFestivals.debugFestival = festival;
festival.refresh();
if (oldFestival != null) oldFestival.refresh();
context.getSource().sendSuccess(() -> Component.literal("Festivals have been set as " + ChineseFestivals.debugFestival.getId()), true);
context.getSource().sendSuccess(() -> SUCCESS_MSG.apply(ChineseFestivals.debugFestival.getId()), true);
return 0;
}));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ public class Festivals {
public static boolean hasChanged = false;
// 春节
public static final IFestival CHINESE_SPRING_FESTIVAL = new SpringFestival();
// 元旦节
public static final IFestival NEW_YEAR = new Festival("new_year", 1, 1);
// 元宵节
public static final IFestival LANTERN_FESTIVAL = new LunarFestival("lantern", 1, 15);
public static final IFestival LANTERN_FESTIVAL = new LanternFestival();
// 端午节
public static final IFestival DRAGON_BOAT_FESTIVAL = new LunarFestival("dragon_boat", 5, 5);
// 七夕节
Expand All @@ -27,7 +25,6 @@ public class Festivals {

public static void init() {
FESTIVALS.add(CHINESE_SPRING_FESTIVAL);
FESTIVALS.add(NEW_YEAR);
FESTIVALS.add(LANTERN_FESTIVAL);
FESTIVALS.add(DRAGON_BOAT_FESTIVAL);
FESTIVALS.add(QIXI_FESTIVAL);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package dev.dubhe.chinesefestivals.festivals;

import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.LanternBlock;
import net.minecraft.world.level.block.state.BlockState;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Supplier;

public class LanternFestival extends LunarFestival {
public LanternFestival() {
super("lantern", 1, 15);
}

@Override
public ModelResourceLocation getBlockReplace(BlockState blockState) {
if (blockState.is(Blocks.LANTERN) && blockState.getValue(LanternBlock.HANGING)) {
return SpringFestival.LANTERN;
}
if (blockState.is(Blocks.SOUL_LANTERN) && blockState.getValue(LanternBlock.HANGING)) {
return SpringFestival.TALL_LANTERN;
}
return null;
}

@Override
public String getBlockTranslateReplace(Block block) {
var key = BuiltInRegistries.BLOCK.getKey(block);
if (!(block instanceof LanternBlock && "minecraft".equals(key.getNamespace()))) return null;
return switch (key.getPath()) {
case "lantern" -> "block.chinesefestivals.lantern";
case "soul_lantern" -> "block.chinesefestivals.tall_lantern";
default -> null;
};
}

@Override
public Map<Item, Supplier<Item>> getItemReplace() {
Map<Item, Supplier<Item>> map = new ConcurrentHashMap<>();
map.put(Items.BEETROOT_SOUP, LabaFestival.SWEET_DUMPLINGS);
return map;
}

@Override
public Map<String, Supplier<String>> getTranslationReplace() {
return new ConcurrentHashMap<>() {{
this.put("item.minecraft.beetroot_soup", () -> "item.chinesefestivals.sweet_dumplings");
}};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
public class SpringFestival extends LunarFestival {
private static final ModelResourceLocation DARK_PLATE = IFestival.registerBlockModel(new BlockModelData("plate").property("dark", "true", BooleanProperty::create));
private static final ModelResourceLocation PLATE = IFestival.registerBlockModel(new BlockModelData("plate").property("dark", "false", BooleanProperty::create));
private static final ModelResourceLocation LANTERN = IFestival.registerBlockModel(new BlockModelData("lantern_hanging"));
private static final ModelResourceLocation TALL_LANTERN = IFestival.registerBlockModel(new BlockModelData("tall_lantern_hanging"));
public static final ModelResourceLocation LANTERN = IFestival.registerBlockModel(new BlockModelData("lantern_hanging"));
public static final ModelResourceLocation TALL_LANTERN = IFestival.registerBlockModel(new BlockModelData("tall_lantern_hanging"));
private static final PaintingVariant COUPLET_LEFT = IFestival.registerPainting("couplet_left", 16, 32);
private static final PaintingVariant COUPLET_RIGHT = IFestival.registerPainting("couplet_right", 16, 32);
private static final PaintingVariant COUPLET_TOP = IFestival.registerPainting("couplet_top", 32, 16);
Expand Down
29 changes: 19 additions & 10 deletions common/src/main/resources/assets/chinesefestivals/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
{
"item.chinesefestivals.mooncake": "Mooncake",
"block.chinesefestivals.hotpot_n": "Clear Soup Hot Pot",
"block.chinesefestivals.hotpot_s": "Jiugongge Hot Pot",
"block.chinesefestivals.lantern": "Lantern",
"block.chinesefestivals.mooncakes": "Mooncakes",
"block.chinesefestivals.tall_lantern": "Tall Lantern",
"command.debug.message": "Festivals have been set as %s.",
"entity.chinesefestivals.plate": "Plate",
"entity.chinesefestivals.plate_dark": "Dark plate",
"festival.dong_zhi.name": "Dongzhi Festival",
"festival.double_ninth.name": "Double Ninth Festival",
"festival.dragon_boat.name": "Dragon Boat Festival",
"festival.laba.name": "Laba Festival",
"festival.lantern.name": "Lantern Festival",
"festival.moon.name": "Moon Festival",
"festival.qixi.name": "Qixi Festival",
"festival.spring.name": "Spring Festival",
"item.chinesefestivals.dumplings": "Dumplings",
"item.chinesefestivals.flower_cake": "Flower cake",
"item.chinesefestivals.hotpot_s": "Jiugongge Hot Pot",
"item.chinesefestivals.hotpot_n": "Clear Soup Hot Pot",
"item.chinesefestivals.dumplings": "Dumplings",
"item.chinesefestivals.hotpot_s": "Jiugongge Hot Pot",
"item.chinesefestivals.laba_congee": "Laba Congee",
"item.chinesefestivals.mooncake": "Mooncake",
"item.chinesefestivals.sweet_dumplings": "Sweet Dumplings",
"block.chinesefestivals.mooncakes": "Mooncakes",
"block.chinesefestivals.hotpot_s": "Jiugongge Hot Pot",
"block.chinesefestivals.hotpot_n": "Clear Soup Hot Pot",
"entity.chinesefestivals.plate": "Plate",
"entity.chinesefestivals.plate_dark": "Dark plate",
"block.chinesefestivals.lantern": "Lantern",
"block.chinesefestivals.tall_lantern": "Tall Lantern",
"item.firework_star.shape.dragon": "Dragon-shaped"
}
27 changes: 18 additions & 9 deletions common/src/main/resources/assets/chinesefestivals/lang/lzh.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
{
"block.chinesefestivals.hotpot_n": "清湯古董羹",
"block.chinesefestivals.hotpot_s": "九宮格古董羹",
"block.chinesefestivals.lantern": "燈籠",
"block.chinesefestivals.mooncakes": "月團",
"item.chinesefestivals.mooncake": "月團",
"block.chinesefestivals.tall_lantern": "高燈籠",
"command.debug.message": "節已為%s。",
"entity.chinesefestivals.plate": "玉盤",
"entity.chinesefestivals.plate_dark": "玄玉盤",
"festival.dong_zhi.name": "冬至",
"festival.double_ninth.name": "重陽",
"festival.dragon_boat.name": "端午",
"festival.laba.name": "臘八",
"festival.lantern.name": "元宵",
"festival.moon.name": "仲秋",
"festival.qixi.name": "乞巧",
"festival.spring.name": "春節",
"item.chinesefestivals.dumplings": "交子",
"item.chinesefestivals.flower_cake": "重陽糕",
"item.chinesefestivals.hotpot_s": "九宮格古董羹",
"item.chinesefestivals.hotpot_n": "清湯古董羹",
"item.chinesefestivals.dumplings": "交子",
"block.chinesefestivals.hotpot_s": "九宮格古董羹",
"block.chinesefestivals.hotpot_n": "清湯古董羹",
"item.chinesefestivals.hotpot_s": "九宮格古董羹",
"item.chinesefestivals.laba_congee": "臘八粥",
"item.chinesefestivals.mooncake": "月團",
"item.chinesefestivals.sweet_dumplings": "浮圓子",
"entity.chinesefestivals.plate": "玉盤",
"entity.chinesefestivals.plate_dark": "玄玉盤",
"block.chinesefestivals.lantern": "燈籠",
"block.chinesefestivals.tall_lantern": "高燈籠",
"item.firework_star.shape.dragon": "龍狀"
}
27 changes: 18 additions & 9 deletions common/src/main/resources/assets/chinesefestivals/lang/zh_cn.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
{
"block.chinesefestivals.hotpot_n": "清汤火锅",
"block.chinesefestivals.hotpot_s": "九宫格火锅",
"block.chinesefestivals.lantern": "灯笼",
"block.chinesefestivals.mooncakes": "月饼",
"item.chinesefestivals.mooncake": "月饼",
"block.chinesefestivals.tall_lantern": "高灯笼",
"command.debug.message": "节日已变更为%s。",
"entity.chinesefestivals.plate": "盘子",
"entity.chinesefestivals.plate_dark": "暗色盘子",
"festival.dong_zhi.name": "冬至",
"festival.double_ninth.name": "重阳",
"festival.dragon_boat.name": "端午",
"festival.laba.name": "腊八",
"festival.lantern.name": "元宵节",
"festival.moon.name": "中秋",
"festival.qixi.name": "七夕",
"festival.spring.name": "春节",
"item.chinesefestivals.dumplings": "饺子",
"item.chinesefestivals.flower_cake": "重阳糕",
"item.chinesefestivals.hotpot_s": "九宫格火锅",
"item.chinesefestivals.hotpot_n": "清汤火锅",
"item.chinesefestivals.dumplings": "饺子",
"block.chinesefestivals.hotpot_s": "九宫格火锅",
"block.chinesefestivals.hotpot_n": "清汤火锅",
"item.chinesefestivals.hotpot_s": "九宫格火锅",
"item.chinesefestivals.laba_congee": "腊八粥",
"item.chinesefestivals.mooncake": "月饼",
"item.chinesefestivals.sweet_dumplings": "汤圆",
"entity.chinesefestivals.plate": "盘子",
"entity.chinesefestivals.plate_dark": "暗色盘子",
"block.chinesefestivals.lantern": "灯笼",
"block.chinesefestivals.tall_lantern": "高灯笼",
"item.firework_star.shape.dragon": "龙形"
}
27 changes: 18 additions & 9 deletions common/src/main/resources/assets/chinesefestivals/lang/zh_hk.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
{
"block.chinesefestivals.hotpot_n": "清湯火鍋",
"block.chinesefestivals.hotpot_s": "九宮格火鍋",
"block.chinesefestivals.lantern": "燈籠",
"block.chinesefestivals.mooncakes": "月餅",
"item.chinesefestivals.mooncake": "月餅",
"block.chinesefestivals.tall_lantern": "高燈籠",
"command.debug.message": "節日已變更為%s。",
"entity.chinesefestivals.plate": "盤子",
"entity.chinesefestivals.plate_dark": "暗色盤子",
"festival.dong_zhi.name": "冬至",
"festival.double_ninth.name": "重陽",
"festival.dragon_boat.name": "端午",
"festival.laba.name": "臘八",
"festival.lantern.name": "元宵節",
"festival.moon.name": "中秋",
"festival.qixi.name": "七夕",
"festival.spring.name": "春節",
"item.chinesefestivals.dumplings": "餃子",
"item.chinesefestivals.flower_cake": "重陽糕",
"item.chinesefestivals.hotpot_s": "九宮格火鍋",
"item.chinesefestivals.hotpot_n": "清湯火鍋",
"item.chinesefestivals.dumplings": "餃子",
"block.chinesefestivals.hotpot_s": "九宮格火鍋",
"block.chinesefestivals.hotpot_n": "清湯火鍋",
"item.chinesefestivals.hotpot_s": "九宮格火鍋",
"item.chinesefestivals.laba_congee": "臘八粥",
"item.chinesefestivals.mooncake": "月餅",
"item.chinesefestivals.sweet_dumplings": "湯圓",
"entity.chinesefestivals.plate": "盤子",
"entity.chinesefestivals.plate_dark": "暗色盤子",
"block.chinesefestivals.lantern": "燈籠",
"block.chinesefestivals.tall_lantern": "高燈籠",
"item.firework_star.shape.dragon": "龍形"
}
27 changes: 18 additions & 9 deletions common/src/main/resources/assets/chinesefestivals/lang/zh_tw.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
{
"block.chinesefestivals.hotpot_n": "清湯火鍋",
"block.chinesefestivals.hotpot_s": "九宮格火鍋",
"block.chinesefestivals.lantern": "燈籠",
"block.chinesefestivals.mooncakes": "月餅",
"item.chinesefestivals.mooncake": "月餅",
"block.chinesefestivals.tall_lantern": "高燈籠",
"command.debug.message": "節日已變更為%s。",
"entity.chinesefestivals.plate": "盤子",
"entity.chinesefestivals.plate_dark": "暗色盤子",
"festival.dong_zhi.name": "冬至",
"festival.double_ninth.name": "重陽",
"festival.dragon_boat.name": "端午",
"festival.laba.name": "臘八",
"festival.lantern.name": "元宵節",
"festival.moon.name": "中秋",
"festival.qixi.name": "七夕",
"festival.spring.name": "春節",
"item.chinesefestivals.dumplings": "餃子",
"item.chinesefestivals.flower_cake": "重陽糕",
"item.chinesefestivals.hotpot_s": "九宮格火鍋",
"item.chinesefestivals.hotpot_n": "清湯火鍋",
"item.chinesefestivals.dumplings": "餃子",
"block.chinesefestivals.hotpot_s": "九宮格火鍋",
"block.chinesefestivals.hotpot_n": "清湯火鍋",
"item.chinesefestivals.hotpot_s": "九宮格火鍋",
"item.chinesefestivals.laba_congee": "臘八粥",
"item.chinesefestivals.mooncake": "月餅",
"item.chinesefestivals.sweet_dumplings": "湯圓",
"entity.chinesefestivals.plate": "盤子",
"entity.chinesefestivals.plate_dark": "暗色盤子",
"block.chinesefestivals.lantern": "燈籠",
"block.chinesefestivals.tall_lantern": "高燈籠",
"item.firework_star.shape.dragon": "龍形"
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx8G
minecraft_version=1.20.4

archives_base_name=ChineseFestivals
mod_version=0.0.7
mod_version=0.0.8
maven_group=dev.dubhe
build_number=undefined

Expand Down

0 comments on commit 24f2c35

Please sign in to comment.