为各类提示添加i18n
This commit is contained in:
parent
8a9f6ba3e7
commit
01f5d867be
7 changed files with 42 additions and 14 deletions
|
@ -31,7 +31,7 @@ public class AmmoCommand {
|
|||
case SNIPER -> c.sniperAmmo;
|
||||
}
|
||||
).orElse(0);
|
||||
context.getSource().sendSuccess(() -> Component.literal("Current " + type.name + " ammo: " + value), true);
|
||||
context.getSource().sendSuccess(() -> Component.translatable("commands.ammo.get", Component.translatable(type.translatableKey).getString(), value), true);
|
||||
return 0;
|
||||
}))))
|
||||
.then(Commands.literal("set").then(Commands.argument("players", EntityArgument.players()).then(Commands.argument("type", EnumArgument.enumArgument(GunInfo.Type.class)).then(Commands.argument("value", IntegerArgumentType.integer(0)).executes(context -> {
|
||||
|
@ -51,7 +51,7 @@ public class AmmoCommand {
|
|||
});
|
||||
}
|
||||
|
||||
context.getSource().sendSuccess(() -> Component.literal("Set " + type.name + " ammo to " + value + " for " + players.size() + " player(s)"), true);
|
||||
context.getSource().sendSuccess(() -> Component.translatable("commands.ammo.set", Component.translatable(type.translatableKey).getString(), value, players.size()), true);
|
||||
return 0;
|
||||
})))))
|
||||
.then(Commands.literal("add").then(Commands.argument("players", EntityArgument.players()).then(Commands.argument("type", EnumArgument.enumArgument(GunInfo.Type.class)).then(Commands.argument("value", IntegerArgumentType.integer(0)).executes(context -> {
|
||||
|
@ -77,7 +77,7 @@ public class AmmoCommand {
|
|||
});
|
||||
}
|
||||
|
||||
context.getSource().sendSuccess(() -> Component.literal("Added " + type.name + " ammo of amount " + value + " for " + players.size() + " player(s)"), true);
|
||||
context.getSource().sendSuccess(() -> Component.translatable("commands.ammo.add", Component.translatable(type.translatableKey).getString(), value, players.size()), true);
|
||||
return 0;
|
||||
}))))));
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import net.minecraftforge.fml.common.Mod;
|
|||
public class PVPModeCommand {
|
||||
@SubscribeEvent
|
||||
public static void registerCommand(RegisterCommandsEvent event) {
|
||||
event.getDispatcher().register(Commands.literal("target:pvpmode").requires(s -> s.hasPermission(4)).executes(arguments -> {
|
||||
event.getDispatcher().register(Commands.literal("pvpmode").requires(s -> s.hasPermission(4)).executes(arguments -> {
|
||||
Level world = arguments.getSource().getUnsidedLevel();
|
||||
Entity entity = arguments.getSource().getEntity();
|
||||
if (entity == null && world instanceof ServerLevel server) {
|
||||
|
@ -29,7 +29,7 @@ public class PVPModeCommand {
|
|||
mapVariables.syncData(world);
|
||||
|
||||
if (entity instanceof Player player && !player.level().isClientSide()) {
|
||||
player.displayClientMessage(Component.literal("PVP MODE: " + (mapVariables.pvpMode ? "ON" : "OFF")), false);
|
||||
player.displayClientMessage(Component.translatable("commands.pvp_mode." + (mapVariables.pvpMode ? "on" : "off")), false);
|
||||
}
|
||||
return 0;
|
||||
}));
|
||||
|
|
|
@ -46,7 +46,7 @@ public abstract class AmmoSupplierItem extends Item {
|
|||
});
|
||||
|
||||
if (!level.isClientSide()) {
|
||||
player.displayClientMessage(Component.literal(this.type.name + " Ammo +" + ammoToAdd), false);
|
||||
player.displayClientMessage(Component.translatable("item.target.ammo_supplier.supply", Component.translatable(this.type.translatableKey).getString(), ammoToAdd), false);
|
||||
level.playSound(null, player.blockPosition(), TargetModSounds.BULLETSUPPLY.get(), SoundSource.PLAYERS, 1, 1);
|
||||
}
|
||||
return InteractionResultHolder.consume(stack);
|
||||
|
|
|
@ -56,7 +56,7 @@ public class CreativeAmmoBox extends Item {
|
|||
});
|
||||
|
||||
if (!level.isClientSide()) {
|
||||
player.displayClientMessage(Component.literal("All Ammo +2147483647"), false);
|
||||
player.displayClientMessage(Component.translatable("item.target.ammo_supplier.creative"), false);
|
||||
level.playSound(null, player.blockPosition(), TargetModSounds.BULLETSUPPLY.get(), SoundSource.VOICE, 1, 1);
|
||||
}
|
||||
return InteractionResultHolder.consume(stack);
|
||||
|
|
|
@ -2,11 +2,14 @@ package net.mcreator.target.tools;
|
|||
|
||||
public class GunInfo {
|
||||
public enum Type {
|
||||
HANDGUN("Handgun"), RIFLE("Rifle"), SHOTGUN("Shotgun"), SNIPER("Sniper");
|
||||
public final String name;
|
||||
HANDGUN("item.target.ammo.handgun"),
|
||||
RIFLE("item.target.ammo.rifle"),
|
||||
SHOTGUN("item.target.ammo.shotgun"),
|
||||
SNIPER("item.target.ammo.sniper");
|
||||
public final String translatableKey;
|
||||
|
||||
Type(String name) {
|
||||
this.name = name;
|
||||
Type(String translatableKey) {
|
||||
this.translatableKey = translatableKey;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,11 @@
|
|||
"item_group.target.target_item": "TARGET ITEM",
|
||||
"item_group.target.ammo": "TARGET AMMO",
|
||||
|
||||
"item.target.ammo.shotgun": "Shotgun",
|
||||
"item.target.ammo.handgun": "Handgun",
|
||||
"item.target.ammo.rifle": "Rifle",
|
||||
"item.target.ammo.sniper": "Sniper",
|
||||
|
||||
"item.target.sentinel": "SENTINEL",
|
||||
"item.target.rpk": "RPK",
|
||||
"item.target.m_870": "M870",
|
||||
|
@ -101,6 +106,8 @@
|
|||
"des.target.handgun_ammo_box": "Handgun Ammo *30",
|
||||
"item.target.creative_ammo_box": "Creative Ammo Box",
|
||||
"des.target.creative_ammo_box": "Creative Ammo *2147483647",
|
||||
"item.target.ammo_supplier.supply": "%s Ammo +%s",
|
||||
"item.target.ammo_supplier.creative": "All Ammo +2147483647",
|
||||
|
||||
"item.target.target_deployer": "Target",
|
||||
"item.target.senpai_spawn_egg": "Senpai Spawn Egg",
|
||||
|
@ -183,5 +190,11 @@
|
|||
"key.target.firemode": "Fire Mode",
|
||||
"key.target.zoom": "Zoom",
|
||||
|
||||
"effect.target.shock": "Shock"
|
||||
"effect.target.shock": "Shock",
|
||||
|
||||
"commands.ammo.get": "Current %s ammo: %s",
|
||||
"commands.ammo.set": "Set %s ammo to %s for %s players",
|
||||
"commands.ammo.add": "Added %s ammo of amount %s for %s players",
|
||||
"commands.pvp_mode.on": "Enabled PVP Mode",
|
||||
"commands.pvp_mode.off": "Disabled PVP Mode"
|
||||
}
|
|
@ -3,6 +3,11 @@
|
|||
"item_group.target.target_item": "TARGET物品",
|
||||
"item_group.target.ammo": "TARGET弹药",
|
||||
|
||||
"item.target.ammo.shotgun": "霰弹枪",
|
||||
"item.target.ammo.handgun": "手枪",
|
||||
"item.target.ammo.rifle": "步枪",
|
||||
"item.target.ammo.sniper": "狙击枪",
|
||||
|
||||
"item.target.sentinel": "哨兵狙击步枪",
|
||||
"item.target.rpk": "RPK轻机枪",
|
||||
"item.target.m_870": "M870霰弹枪",
|
||||
|
@ -101,6 +106,8 @@
|
|||
"des.target.handgun_ammo_box": "手枪弹药 *30",
|
||||
"item.target.creative_ammo_box": "创造弹药盒",
|
||||
"des.target.creative_ammo_box": "创造弹药 *2147483647",
|
||||
"item.target.ammo_supplier.supply": "%s弹药 +%s",
|
||||
"item.target.ammo_supplier.creative": "所有弹药 +2147483647",
|
||||
|
||||
"item.target.target_deployer": "标靶",
|
||||
"item.target.senpai_spawn_egg": "野兽先辈刷怪蛋",
|
||||
|
@ -147,7 +154,6 @@
|
|||
"death.attack.gunfire.entity": "%1$s被%2$s射爆了",
|
||||
"death.attack.gunfire.item": "%1$s被%2$s用%3$s射爆了",
|
||||
"death.attack.gunfire.player": "%1$s在逃离%2$s的时候被射爆了",
|
||||
|
||||
"death.attack.arrow_in_brain": "%1$s的脑子进矢了,凶手是%2$s",
|
||||
"death.attack.arrow_in_brain.item": "%1$s的脑子进矢了,凶手%2$s使用了%3$s",
|
||||
"death.attack.arrow_in_brain.player": "%1$s在逃离%2$s的时候脑子进矢了",
|
||||
|
@ -183,5 +189,11 @@
|
|||
"key.target.firemode": "开火模式",
|
||||
"key.target.zoom": "缩放",
|
||||
|
||||
"effect.target.shock": "麻痹"
|
||||
"effect.target.shock": "麻痹",
|
||||
|
||||
"commands.ammo.get": "当前%s弹药数量: %s",
|
||||
"commands.ammo.set": "为%3$s位玩家的%1$s弹药数量设置为%2$s",
|
||||
"commands.ammo.add": "为%3$s位玩家添加了%2$s发%1$s弹药",
|
||||
"commands.pvp_mode.on": "已启用PVP模式",
|
||||
"commands.pvp_mode.off": "已禁用PVP模式"
|
||||
}
|
Loading…
Add table
Reference in a new issue