Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

木材类 i18n 修复 #106

Merged
merged 2 commits into from
Mar 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
String en_us();
String zh_cn();
String zh_tw();
String descriptionId() default "";
Other[] other() default {};
@interface Other {
String value();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,17 @@ public void classDef(TypeElement typeElement) {
VariableElement variableElement = (VariableElement) element;
I18n i18n = variableElement.getAnnotation(I18n.class);
if (i18n != null) {
add("en_us", ".add(%s, \"%s\")".formatted(typeElement.getQualifiedName() + "." + variableElement.getSimpleName(), i18n.en_us()));
add("zh_cn", ".add(%s, \"%s\")".formatted(typeElement.getQualifiedName() + "." + variableElement.getSimpleName(), i18n.zh_cn()));
add("zh_tw", ".add(%s, \"%s\")".formatted(typeElement.getQualifiedName() + "." + variableElement.getSimpleName(), i18n.zh_tw()));
String name;
if(i18n.descriptionId().isEmpty()) {
name = typeElement.getQualifiedName() + "." + variableElement.getSimpleName();
} else {
name = "\"" + i18n.descriptionId() + "\"";
}
add("en_us", ".add(%s, \"%s\")".formatted(name, i18n.en_us()));
add("zh_cn", ".add(%s, \"%s\")".formatted(name, i18n.zh_cn()));
add("zh_tw", ".add(%s, \"%s\")".formatted(name, i18n.zh_tw()));
for (I18n.Other other : i18n.other()) {
add(other.value(), ".add(%s, \"%s\")".formatted(typeElement.getQualifiedName() + "." + variableElement.getSimpleName(), other.translate()));
add(other.value(), ".add(%s, \"%s\")".formatted(name, other.translate()));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,10 @@ public enum ModTranslateKey implements Supplier<TranslatableContents> {

ModTranslateKey(String... keys) {
StringBuilder key = new StringBuilder();
for (int i = 0; i < keys.length; i++) {
String k = keys[i];
if (i == 1) {
key.append(k);
} else {
key.append(".").append(k);
if(keys.length != 0) {
key.append(keys[0]);
for (int i = 1; i < keys.length; i++) {
key.append(".").append(keys[i]);
}
}
translatable = Component.translatable(key.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,13 @@ public class ModBlocks {
@I18n(en_us = "Azalea Sign", zh_cn = "杜鹃木告示牌", zh_tw = "杜鵑木告示牌")
public static final DeferredBlock<StandingSignBlock> AZALEA_SIGN =
register("azalea_sign", props -> new StandingSignBlock(ModWoodSettings.AZALEA.woodType, props), BlockBehaviour.Properties.ofFullCopy(Blocks.MANGROVE_SIGN));
@I18n(en_us = "Azalea Wall Sign", zh_cn = "墙上的杜鹃木告示牌", zh_tw = "牆上的杜鵑木告示牌")
@I18n(en_us = "Azalea Wall Sign", zh_cn = "墙上的杜鹃木告示牌", zh_tw = "牆上的杜鵑木告示牌", descriptionId = "block.wild_wind.azalea_wall_sign")
public static final DeferredBlock<WallSignBlock> AZALEA_WALL_SIGN =
register("azalea_wall_sign", props -> new WallSignBlock(ModWoodSettings.AZALEA.woodType, props), BlockBehaviour.Properties.ofFullCopy(Blocks.MANGROVE_WALL_SIGN).lootFrom(AZALEA_SIGN));
@I18n(en_us = "Azalea Hanging Sign", zh_cn = "悬挂式杜鹃木告示牌", zh_tw = "懸挂式杜鵑木告示牌")
public static final DeferredBlock<CeilingHangingSignBlock> AZALEA_HANGING_SIGN =
register("azalea_hanging_sign", props -> new CeilingHangingSignBlock(ModWoodSettings.AZALEA.woodType, props), BlockBehaviour.Properties.ofFullCopy(Blocks.MANGROVE_HANGING_SIGN));
@I18n(en_us = "Azalea Wall Hanging Sign", zh_cn = "墙上的杜鹃木悬挂式告示牌", zh_tw = "牆上的杜鵑木懸挂式告示牌")
@I18n(en_us = "Azalea Wall Hanging Sign", zh_cn = "墙上的杜鹃木悬挂式告示牌", zh_tw = "牆上的杜鵑木懸挂式告示牌", descriptionId = "block.wild_wind.azalea_wall_hanging_sign")
public static final DeferredBlock<WallHangingSignBlock> AZALEA_WALL_HANGING_SIGN =
register("azalea_wall_hanging_sign", props -> new WallHangingSignBlock(ModWoodSettings.AZALEA.woodType, props), BlockBehaviour.Properties.ofFullCopy(Blocks.MANGROVE_WALL_HANGING_SIGN).lootFrom(AZALEA_HANGING_SIGN));
public static final DeferredItem<BlockItem> AZALEA_LOG_ITEM =
Expand Down Expand Up @@ -298,13 +298,13 @@ public class ModBlocks {
@I18n(en_us = "Palm Sign", zh_cn = "棕榈木告示牌", zh_tw = "棕櫚木告示牌")
public static final DeferredBlock<StandingSignBlock> PALM_SIGN =
register("palm_sign", props -> new StandingSignBlock(ModWoodSettings.PALM.woodType, props), BlockBehaviour.Properties.ofFullCopy(Blocks.SPRUCE_SIGN));
@I18n(en_us = "Palm Wall Sign", zh_cn = "墙上的棕榈木告示牌", zh_tw = "牆上的棕櫚木告示牌")
@I18n(en_us = "Palm Wall Sign", zh_cn = "墙上的棕榈木告示牌", zh_tw = "牆上的棕櫚木告示牌", descriptionId = "block.wild_wind.palm_wall_sign")
public static final DeferredBlock<WallSignBlock> PALM_WALL_SIGN =
register("palm_wall_sign", props -> new WallSignBlock(ModWoodSettings.PALM.woodType, props), BlockBehaviour.Properties.ofFullCopy(Blocks.SPRUCE_WALL_SIGN).lootFrom(PALM_SIGN));
@I18n(en_us = "Palm Hanging Sign", zh_cn = "棕榈木悬挂式告示牌", zh_tw = "棕櫚木懸挂式告示牌")
public static final DeferredBlock<CeilingHangingSignBlock> PALM_HANGING_SIGN =
register("palm_hanging_sign", props -> new CeilingHangingSignBlock(ModWoodSettings.PALM.woodType, props), BlockBehaviour.Properties.ofFullCopy(Blocks.SPRUCE_HANGING_SIGN));
@I18n(en_us = "Palm Wall Hanging Sign", zh_cn = "墙上的棕榈木悬挂式告示牌", zh_tw = "牆上的棕櫚木懸挂式告示牌")
@I18n(en_us = "Palm Wall Hanging Sign", zh_cn = "墙上的棕榈木悬挂式告示牌", zh_tw = "牆上的棕櫚木懸挂式告示牌", descriptionId = "block.wild_wind.palm_wall_hanging_sign")
public static final DeferredBlock<WallHangingSignBlock> PALM_WALL_HANGING_SIGN =
register("palm_wall_hanging_sign", props -> new WallHangingSignBlock(ModWoodSettings.PALM.woodType, props), BlockBehaviour.Properties.ofFullCopy(Blocks.SPRUCE_WALL_HANGING_SIGN).lootFrom(PALM_HANGING_SIGN));
public static final DeferredItem<BlockItem> PALM_LOG_ITEM =
Expand Down Expand Up @@ -388,13 +388,13 @@ public class ModBlocks {
@I18n(en_us = "Baobab Sign", zh_cn = "猴面包木告示牌", zh_tw = "猴麵包木告示牌")
public static final DeferredBlock<StandingSignBlock> BAOBAB_SIGN =
register("baobab_sign", props -> new StandingSignBlock(ModWoodSettings.BAOBAB.woodType, props), BlockBehaviour.Properties.ofFullCopy(Blocks.ACACIA_SIGN));
@I18n(en_us = "Baobab Wall Sign", zh_cn = "墙上的猴面包木告示牌", zh_tw = "牆上的猴麵包木告示牌")
@I18n(en_us = "Baobab Wall Sign", zh_cn = "墙上的猴面包木告示牌", zh_tw = "牆上的猴麵包木告示牌", descriptionId = "block.wild_wind.baobab_wall_sign")
public static final DeferredBlock<WallSignBlock> BAOBAB_WALL_SIGN =
register("baobab_wall_sign", props -> new WallSignBlock(ModWoodSettings.BAOBAB.woodType, props), BlockBehaviour.Properties.ofFullCopy(Blocks.ACACIA_WALL_SIGN).lootFrom(BAOBAB_SIGN));
@I18n(en_us = "Baobab Hanging Sign", zh_cn = "猴面包木悬挂式告示牌", zh_tw = "猴麵包木懸挂式告示牌")
public static final DeferredBlock<CeilingHangingSignBlock> BAOBAB_HANGING_SIGN =
register("baobab_hanging_sign", props -> new CeilingHangingSignBlock(ModWoodSettings.BAOBAB.woodType, props), BlockBehaviour.Properties.ofFullCopy(Blocks.ACACIA_HANGING_SIGN));
@I18n(en_us = "Baobab Wall Hanging Sign", zh_cn = "墙上的猴面包木悬挂式告示牌", zh_tw = "牆上的猴麵包木懸挂式告示牌")
@I18n(en_us = "Baobab Wall Hanging Sign", zh_cn = "墙上的猴面包木悬挂式告示牌", zh_tw = "牆上的猴麵包木懸挂式告示牌", descriptionId = "block.wild_wind.baobab_wall_hanging_sign")
public static final DeferredBlock<WallHangingSignBlock> BAOBAB_WALL_HANGING_SIGN =
register("baobab_wall_hanging_sign", props -> new WallHangingSignBlock(ModWoodSettings.BAOBAB.woodType, props), BlockBehaviour.Properties.ofFullCopy(Blocks.ACACIA_WALL_HANGING_SIGN).lootFrom(BAOBAB_HANGING_SIGN));
public static final DeferredItem<BlockItem> BAOBAB_LOG_ITEM =
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"type": "minecraft:tree",
"config": {
"decorators": [],
"dirt_provider": {
"type": "minecraft:simple_state_provider",
"state": {
"Name": "minecraft:rooted_dirt"
}
},
"foliage_placer": {
"type": "minecraft:random_spread_foliage_placer",
"foliage_height": 2,
"leaf_placement_attempts": 50,
"offset": 0,
"radius": 3
},
"foliage_provider": {
"type": "minecraft:weighted_state_provider",
"entries": [
{
"data": {
"Name": "minecraft:azalea_leaves",
"Properties": {
"distance": "7",
"persistent": "false",
"waterlogged": "false"
}
},
"weight": 3
},
{
"data": {
"Name": "minecraft:flowering_azalea_leaves",
"Properties": {
"distance": "7",
"persistent": "false",
"waterlogged": "false"
}
},
"weight": 1
}
]
},
"force_dirt": true,
"ignore_vines": false,
"minimum_size": {
"type": "minecraft:two_layers_feature_size",
"limit": 1,
"lower_size": 0,
"upper_size": 1
},
"trunk_placer": {
"type": "minecraft:bending_trunk_placer",
"base_height": 4,
"bend_length": {
"type": "minecraft:uniform",
"max_inclusive": 2,
"min_inclusive": 1
},
"height_rand_a": 2,
"height_rand_b": 0,
"min_height_for_leaves": 3
},
"trunk_provider": {
"type": "minecraft:simple_state_provider",
"state": {
"Name": "wild_wind:azalea_log",
"Properties": {
"axis": "y"
}
}
}
}
}
Loading