Renamed method getTranslationComponent to createTranslationTextComponent

This commit is contained in:
Mike van der Velde 2020-01-05 18:33:40 +01:00
parent 0469014ab7
commit f6a99e57d8
2 changed files with 12 additions and 14 deletions

View file

@ -6,8 +6,6 @@ import com.simibubi.create.Create;
import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.command.CommandSource; import net.minecraft.command.CommandSource;
import net.minecraft.command.Commands; import net.minecraft.command.Commands;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TranslationTextComponent;
public class KillTPSCommand { public class KillTPSCommand {
@ -19,11 +17,11 @@ public class KillTPSCommand {
.requires(cs -> cs.hasPermissionLevel(2)) .requires(cs -> cs.hasPermissionLevel(2))
.executes(ctx -> { .executes(ctx -> {
//killtps no arguments //killtps no arguments
ctx.getSource().sendFeedback(Lang.getTranslationComponent("command.killTPSCommand.status.slowed_by.0", Create.lagger.isLagging() ? Create.lagger.getTickTime() : 0), true); ctx.getSource().sendFeedback(Lang.createTranslationTextComponent("command.killTPSCommand.status.slowed_by.0", Create.lagger.isLagging() ? Create.lagger.getTickTime() : 0), true);
if (Create.lagger.isLagging()) if (Create.lagger.isLagging())
ctx.getSource().sendFeedback(Lang.getTranslationComponent("command.killTPSCommand.status.usage.0"), true); ctx.getSource().sendFeedback(Lang.createTranslationTextComponent("command.killTPSCommand.status.usage.0"), true);
else else
ctx.getSource().sendFeedback(Lang.getTranslationComponent("command.killTPSCommand.status.usage.1"),true); ctx.getSource().sendFeedback(Lang.createTranslationTextComponent("command.killTPSCommand.status.usage.1"),true);
return 1; return 1;
}) })
@ -33,10 +31,10 @@ public class KillTPSCommand {
int tickTime = Create.lagger.getTickTime(); int tickTime = Create.lagger.getTickTime();
if (tickTime > 0){ if (tickTime > 0){
Create.lagger.setLagging(true); Create.lagger.setLagging(true);
ctx.getSource().sendFeedback((Lang.getTranslationComponent("command.killTPSCommand.status.slowed_by.1", tickTime)),true); ctx.getSource().sendFeedback((Lang.createTranslationTextComponent("command.killTPSCommand.status.slowed_by.1", tickTime)),true);
ctx.getSource().sendFeedback(Lang.getTranslationComponent("command.killTPSCommand.status.usage.0"),true); ctx.getSource().sendFeedback(Lang.createTranslationTextComponent("command.killTPSCommand.status.usage.0"),true);
} else { } else {
ctx.getSource().sendFeedback(Lang.getTranslationComponent("command.killTPSCommand.status.usage.1"),true); ctx.getSource().sendFeedback(Lang.createTranslationTextComponent("command.killTPSCommand.status.usage.1"),true);
} }
return 1; return 1;
@ -47,8 +45,8 @@ public class KillTPSCommand {
int tickTime = IntegerArgumentType.getInteger(ctx, Lang.translate("command.killTPSCommand.argument.tickTime")); int tickTime = IntegerArgumentType.getInteger(ctx, Lang.translate("command.killTPSCommand.argument.tickTime"));
Create.lagger.setTickTime(tickTime); Create.lagger.setTickTime(tickTime);
Create.lagger.setLagging(true); Create.lagger.setLagging(true);
ctx.getSource().sendFeedback((Lang.getTranslationComponent("command.killTPSCommand.status.slowed_by.1", tickTime)),true); ctx.getSource().sendFeedback((Lang.createTranslationTextComponent("command.killTPSCommand.status.slowed_by.1", tickTime)),true);
ctx.getSource().sendFeedback(Lang.getTranslationComponent("command.killTPSCommand.status.usage.0"),true); ctx.getSource().sendFeedback(Lang.createTranslationTextComponent("command.killTPSCommand.status.usage.0"),true);
return 1; return 1;
}) })
@ -58,7 +56,7 @@ public class KillTPSCommand {
.executes(ctx -> { .executes(ctx -> {
//killtps stop //killtps stop
Create.lagger.setLagging(false); Create.lagger.setLagging(false);
ctx.getSource().sendFeedback(Lang.getTranslationComponent("command.killTPSCommand.status.slowed_by.2"), false); ctx.getSource().sendFeedback(Lang.createTranslationTextComponent("command.killTPSCommand.status.slowed_by.2"), false);
return 1; return 1;
}) })

View file

@ -12,15 +12,15 @@ import net.minecraft.util.text.TranslationTextComponent;
public class Lang { public class Lang {
public static String translate(String key, Object... args) { public static String translate(String key, Object... args) {
return getTranslationComponent(key, args).getFormattedText(); return createTranslationTextComponent(key, args).getFormattedText();
} }
public static TranslationTextComponent getTranslationComponent(String key, Object... args) { public static TranslationTextComponent createTranslationTextComponent(String key, Object... args) {
return new TranslationTextComponent(Create.ID + "." + key, args); return new TranslationTextComponent(Create.ID + "." + key, args);
} }
public static void sendStatus(PlayerEntity player, String key, Object... args) { public static void sendStatus(PlayerEntity player, String key, Object... args) {
player.sendStatusMessage(getTranslationComponent(key, args), true); player.sendStatusMessage(createTranslationTextComponent(key, args), true);
} }
public static List<String> translatedOptions(String prefix, String... keys) { public static List<String> translatedOptions(String prefix, String... keys) {