Skip to content

Commit 1fb86f3

Browse files
committed
修复可能的翻译错误
1 parent 351adc5 commit 1fb86f3

7 files changed

Lines changed: 65 additions & 12 deletions

File tree

src/ww_ag/java/org/polaris2023/ww_ag/common/registrate/entry/PlanksEntry.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import com.tterrag.registrate.util.entry.BlockEntry;
44
import com.tterrag.registrate.util.entry.ItemEntry;
5-
import lombok.Getter;
65
import lombok.Setter;
76
import lombok.experimental.Accessors;
87
import net.minecraft.MethodsReturnNonnullByDefault;
@@ -17,19 +16,19 @@
1716
import net.minecraft.world.level.block.entity.BlockEntityType;
1817
import net.minecraft.world.level.block.state.properties.BlockSetType;
1918
import net.minecraft.world.level.block.state.properties.WoodType;
20-
import net.neoforged.bus.api.IEventBus;
2119
import net.neoforged.fml.common.asm.enumextension.EnumProxy;
2220
import net.neoforged.neoforge.event.BlockEntityTypeAddBlocksEvent;
21+
import org.apache.commons.lang3.text.StrBuilder;
2322
import org.polaris2023.ww_ag.common.registrate.WWRegistrate;
2423
import org.polaris2023.ww_ag.utils.planks.*;
2524

2625
import javax.annotation.ParametersAreNonnullByDefault;
27-
import java.util.HashMap;
2826
import java.util.Locale;
29-
import java.util.Map;
3027
import java.util.Objects;
3128
import java.util.function.Supplier;
3229

30+
import static org.polaris2023.ww_ag.common.registrate.entry.StoneEntry.upFirstName;
31+
3332
/**
3433
* @author baka4n
3534
* @code @Date 2025/6/10 15:28:54
@@ -51,7 +50,7 @@ public class PlanksEntry<T extends WWRegistrate, E extends PlanksEntry<T, E>> im
5150
ISlab<T, E>,
5251
IStairs<T, E>,
5352
IBoat<T, E>,
54-
IWW<T, E>{
53+
ICrown<T, E> {
5554
public final T registrate;
5655

5756
public final WoodType wt;
@@ -89,7 +88,7 @@ public class PlanksEntry<T extends WWRegistrate, E extends PlanksEntry<T, E>> im
8988
public ItemEntry<BoatItem> chest_boat;
9089

9190
public String firstUpName() {
92-
return name.substring(0, 1).toUpperCase(Locale.ROOT) + name.substring(1);
91+
return upFirstName(name);
9392
}
9493
public PlanksEntry(T registrate, String name, Supplier<EnumProxy<Boat.Type>> btp) {
9594
this.registrate = registrate;

src/ww_ag/java/org/polaris2023/ww_ag/common/registrate/entry/StoneEntry.java

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,73 @@
11
package org.polaris2023.ww_ag.common.registrate.entry;
22

3+
import lombok.Setter;
4+
import lombok.experimental.Accessors;
5+
import net.minecraft.MethodsReturnNonnullByDefault;
6+
import org.jetbrains.annotations.NotNull;
37
import org.polaris2023.ww_ag.common.registrate.WWRegistrate;
48
import org.polaris2023.ww_ag.utils.ISelf;
59

10+
import javax.annotation.ParametersAreNonnullByDefault;
611
import java.util.Locale;
712

813
/**
14+
* xxx cobblestone xxx圆石(可选)
15+
* xxx stone xxx石
16+
* Smooth xxx Stone 平滑xxx石
17+
* Infested xxx Stone 被虫蚀的xxx石(可选)
18+
* xxx stone button xxx石按钮
19+
* xxx stone pressire plate xxx石压力板
20+
* xxx stone bricks xxx是赚
21+
* cracked xxx stone bricks 裂纹xxx石砖
22+
* chiseled xxx stone bricks 苔化xxx石砖
23+
* stone xxx slab xxx石楼梯
24+
* cracked xxx stone slab 裂纹xxx石楼梯(可选)
25+
* chiseled xxx stone slab 苔化xxx石楼梯(可选)
26+
* xxx stone wall xxx石墙
27+
* cracked xxx stone wall 裂纹xxx石墙
28+
* chiseled xxx stone wall 苔化xxx石墙(可选)
29+
*
930
* @author baka4n
1031
* @code @Date 2025/6/24 22:06:59
1132
*/
1233
@SuppressWarnings({"unchecked", "ClassCanBeRecord"})
34+
@ParametersAreNonnullByDefault
35+
@MethodsReturnNonnullByDefault
1336
public class StoneEntry<T extends WWRegistrate, E extends StoneEntry<T, E>> implements
1437
ISelf<E> {
1538
public final String name;
1639
public final T registrate;
1740

41+
@Setter
42+
@Accessors(fluent = true)
43+
public String zhCn,zhTw,zhHk;
44+
1845

1946
public String firstUpName() {
20-
return name.substring(0, 1).toUpperCase(Locale.ROOT) + name.substring(1);
47+
return upFirstName(name);
48+
}
49+
50+
public static String upFirstName(String name) {
51+
if (name.isEmpty()) return name;
52+
53+
StringBuilder sb = new StringBuilder(name.length());
54+
boolean capitalizeNext = true;
55+
56+
for (int i = 0; i < name.length(); i++) {
57+
char c = name.charAt(i);
58+
if (c == '_') {
59+
capitalizeNext = true;
60+
sb.append(" ");
61+
continue;
62+
}
63+
if (capitalizeNext) {
64+
sb.append(Character.toUpperCase(c));
65+
capitalizeNext = false;
66+
} else {
67+
sb.append(c);
68+
}
69+
}
70+
return sb.toString();
2171
}
2272

2373
public StoneEntry(T registrate, String name) {

src/ww_ag/java/org/polaris2023/ww_ag/config/UseItemConfig.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package org.polaris2023.ww_ag.config;
22

33
import dev.xkmc.l2core.util.ConfigInit;
4+
import lombok.Getter;
5+
import lombok.experimental.Accessors;
46
import net.neoforged.fml.config.ModConfig;
57
import net.neoforged.neoforge.common.ModConfigSpec;
68

@@ -9,6 +11,8 @@
911
* @code @Date 2025/6/4 13:06:37
1012
*/
1113

14+
@Accessors(fluent = true)
15+
@Getter
1216
public class UseItemConfig extends ConfigInit {
1317
public final ModConfigSpec.BooleanValue
1418
popped_chorus_fruit,

src/ww_ag/java/org/polaris2023/ww_ag/events/LivingEvents.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static void onUseFinish(LivingEntityUseItemEvent.Finish event) {
3232
if (!(livingEntity.level() instanceof ServerLevel serverLevel)) return;
3333

3434
if(
35-
ModConfigs.USE_ITEM.fish_bone_loot.get() && (stack.is(Tags.Items.FOODS_COOKED_FISH) ||
35+
ModConfigs.USE_ITEM.fish_bone_loot().get() && (stack.is(Tags.Items.FOODS_COOKED_FISH) ||
3636
stack.is(Tags.Items.FOODS_RAW_FISH))
3737
) {
3838
if (livingEntity instanceof Player player) {

src/ww_ag/java/org/polaris2023/ww_ag/events/PlayerEvents.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public static void rightMilkPlaceAndGet(PlayerInteractEvent.RightClickBlock even
5959
pos :
6060
pos.relative(direction);
6161

62-
if (ModConfigs.USE_ITEM.milk_block_use.get()) {
62+
if (ModConfigs.USE_ITEM.milk_block_use().get()) {
6363
if (stack.is(Items.MILK_BUCKET)) {
6464
BlockPos posNow = canBlockContainFluid(player, level, pos, state) ? pos : getFacePos;
6565
stack.shrink(1);

src/ww_ag/java/org/polaris2023/ww_ag/utils/planks/IWW.java renamed to src/ww_ag/java/org/polaris2023/ww_ag/utils/planks/ICrown.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* @author baka4n
2323
* @code @Date 2025/6/23 21:59:41
2424
*/
25-
public interface IWW<E extends WWRegistrate, T extends PlanksEntry<E, T>> extends ISelf<T> {
25+
public interface ICrown<E extends WWRegistrate, T extends PlanksEntry<E, T>> extends ISelf<T> {
2626
T setCrown(BlockEntry<RotatedPillarBlock> entry);
2727
default T crown(
2828
Supplier<Block> copy,

src/ww_vpp/java/org/polaris2023/ww_vpp/events/LivingEvents.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public static void onUseFinish(LivingEntityUseItemEvent.Finish event) {
4141
LivingEntity livingEntity = event.getEntity();
4242

4343
if (!(livingEntity.level() instanceof ServerLevel serverLevel)) return;
44-
if(ModConfigs.USE_ITEM.popped_chorus_fruit.get() && stack.is(Items.POPPED_CHORUS_FRUIT)) {
44+
if(ModConfigs.USE_ITEM.popped_chorus_fruit().get() && stack.is(Items.POPPED_CHORUS_FRUIT)) {
4545
if(livingEntity.tryTeleportToSurface(serverLevel, livingEntity.getOnPos()) || livingEntity.randomTeleportAround(serverLevel)) {
4646
serverLevel.gameEvent(GameEvent.TELEPORT, livingEntity.position(), GameEvent.Context.of(livingEntity));
4747
SoundSource soundsource;
@@ -62,7 +62,7 @@ public static void onUseFinish(LivingEntityUseItemEvent.Finish event) {
6262
player.resetCurrentImpulseContext();
6363
player.getCooldowns().addCooldown(stack.getItem(), 20);
6464
}
65-
} else if(ModConfigs.USE_ITEM.glistering_melon_slice.get() && stack.is(Items.GLISTERING_MELON_SLICE)) {
65+
} else if(ModConfigs.USE_ITEM.glistering_melon_slice().get() && stack.is(Items.GLISTERING_MELON_SLICE)) {
6666
livingEntity.heal(1.0F);
6767
}
6868

0 commit comments

Comments
 (0)