use of net.minecraft.text.TranslatableText in project VillagerConfig by DrexHD.
the class ConfigScreen method getConfigScreen.
public static Screen getConfigScreen(Screen parentScreen) {
ConfigBuilder builder = ConfigBuilder.create().setParentScreen(parentScreen).setDefaultBackgroundTexture(new Identifier("minecraft:textures/block/emerald_block.png")).setTitle(new TranslatableText("config.villagerconfig.title"));
builder.setGlobalized(true);
builder.setGlobalizedExpanded(false);
ConfigEntryBuilder entryBuilder = builder.entryBuilder();
ConfigCategory features = builder.getOrCreateCategory(new TranslatableText("config.villagerconfig.category.features"));
features.addEntry(entryBuilder.startDoubleField(new TranslatableText("config.villagerconfig.maxdiscount"), ConfigEntries.features.maxDiscount).setDefaultValue(100).setMin(0.0).setMax(100.0).setSaveConsumer(value -> ConfigEntries.features.maxDiscount = value).setTooltip(new TranslatableText("config.villagerconfig.maxdiscount.tooltip")).build());
features.addEntry(entryBuilder.startDoubleField(new TranslatableText("config.villagerconfig.maxraise"), ConfigEntries.features.maxRaise).setDefaultValue(100).setMin(0.0).setMax(100.0).setSaveConsumer(value -> ConfigEntries.features.maxRaise = value).setTooltip(new TranslatableText("config.villagerconfig.maxraise.tooltip")).build());
features.addEntry(entryBuilder.startDoubleField(new TranslatableText("config.villagerconfig.conversionchance"), ConfigEntries.features.conversionChance).setDefaultValue(-1).setMin(-1.0).setMax(100.0).setSaveConsumer(value -> ConfigEntries.features.conversionChance = value).setTooltip(new TranslatableText("config.villagerconfig.conversionchance.tooltip")).build());
features.addEntry(entryBuilder.startBooleanToggle(new TranslatableText("config.villagerconfig.tradecycling"), ConfigEntries.features.tradeCycling).setDefaultValue(true).setSaveConsumer(value -> ConfigEntries.features.tradeCycling = value).setTooltip(new TranslatableText("config.villagerconfig.tradecycling.tooltip")).build());
features.addEntry(entryBuilder.startBooleanToggle(new TranslatableText("config.villagerconfig.infiniteTrades"), ConfigEntries.features.infiniteTrades).setDefaultValue(false).setSaveConsumer(value -> ConfigEntries.features.infiniteTrades = value).setTooltip(new TranslatableText("config.villagerconfig.infiniteTrades.tooltip")).build());
ConfigCategory oldTrades = builder.getOrCreateCategory(new TranslatableText("config.villagerconfig.category.old_trades")).setCategoryBackground(new Identifier("minecraft:textures/block/emerald_block.png"));
oldTrades.addEntry(entryBuilder.startBooleanToggle(new TranslatableText("config.villagerconfig.enabled"), ConfigEntries.oldTrades.enabled).setDefaultValue(false).setSaveConsumer(value -> ConfigEntries.oldTrades.enabled = value).setTooltip(new TranslatableText("config.villagerconfig.enabled.tooltip")).build());
oldTrades.addEntry(entryBuilder.startIntField(new TranslatableText("config.villagerconfig.minuses"), ConfigEntries.oldTrades.minUses).setDefaultValue(2).setMin(0).setSaveConsumer(value -> ConfigEntries.oldTrades.minUses = value).setTooltip(new TranslatableText("config.villagerconfig.minuses.tooltip")).build());
oldTrades.addEntry(entryBuilder.startIntField(new TranslatableText("config.villagerconfig.maxuses2"), ConfigEntries.oldTrades.maxUses).setDefaultValue(12).setMin(0).setSaveConsumer(value -> ConfigEntries.oldTrades.maxUses = value).setTooltip(new TranslatableText("config.villagerconfig.maxuses2.tooltip")).build());
oldTrades.addEntry(entryBuilder.startDoubleField(new TranslatableText("config.villagerconfig.lockchance"), ConfigEntries.oldTrades.lockChance).setDefaultValue(20).setMin(0).setMax(100).setSaveConsumer(value -> ConfigEntries.oldTrades.lockChance = value).setTooltip(new TranslatableText("config.villagerconfig.lockchance.tooltip")).build());
oldTrades.addEntry(entryBuilder.startDoubleField(new TranslatableText("config.villagerconfig.unlockchance"), ConfigEntries.oldTrades.unlockChance).setDefaultValue(20).setMin(0).setMax(100).setSaveConsumer(value -> ConfigEntries.oldTrades.unlockChance = value).setTooltip(new TranslatableText("config.villagerconfig.unlockchance.tooltip")).build());
builder.setSavingRunnable(Config::saveModConfig);
return builder.build();
}
use of net.minecraft.text.TranslatableText in project JexClient by DustinRepo.
the class JexTitleScreen method initWidgetsNormal.
private void initWidgetsNormal(int y) {
JexTitleScreen titleScreen = this;
this.addDrawableChild(new ButtonWidget(2, y, 200, 20, new TranslatableText("menu.singleplayer"), button -> {
Wrapper.INSTANCE.getMinecraft().setScreen(new SelectWorldScreen(titleScreen));
}));
this.addDrawableChild(new ButtonWidget(2, y + 24, 175, 20, new TranslatableText("menu.multiplayer"), button -> {
Wrapper.INSTANCE.getMinecraft().setScreen(new MultiplayerScreen(titleScreen));
}));
this.addDrawableChild(new ButtonWidget(2, y + 24 * 2, 150, 20, new TranslatableText("menu.online"), button -> {
titleScreen.switchToRealms();
}));
this.addDrawableChild(new ButtonWidget(2, y + 24 * 3, 125, 20, new TranslatableText("menu.options"), button -> {
Wrapper.INSTANCE.getMinecraft().setScreen(new OptionsScreen(titleScreen, Wrapper.INSTANCE.getOptions()));
}));
this.addDrawableChild(new ButtonWidget(2, y + 24 * 4, 100, 20, new TranslatableText("menu.quit"), button -> {
Wrapper.INSTANCE.getMinecraft().scheduleStop();
}));
this.addDrawableChild(new ButtonWidget(2, height - 22, 100, 20, new TranslatableText("Changelog"), button -> {
Wrapper.INSTANCE.getMinecraft().setScreen(new ChangelogScreen());
}));
}
use of net.minecraft.text.TranslatableText in project JexClient by DustinRepo.
the class BlockButton method render.
@Override
public void render(MatrixStack matrixStack) {
if (isSelected()) {
Render2DHelper.INSTANCE.fillAndBorder(matrixStack, this.getX(), this.getY(), this.getX() + this.getWidth(), this.getY() + this.getHeight(), ColorHelper.INSTANCE.getClientColor(), 0x25ffffff, 1);
}
FontHelper.INSTANCE.drawCenteredString(matrixStack, new TranslatableText(block.getTranslationKey()), this.getX() + (this.getWidth() / 2), this.getY() + (this.getHeight() / 2) - 4, isEnabled() ? 0xffaaaaaa : 0xff676767);
Render2DHelper.INSTANCE.drawItem(new ItemStack(block.asItem()), (int) (getX() + 2), (int) (getY() + 2));
if (isHovered() && isEnabled())
Render2DHelper.INSTANCE.fill(matrixStack, this.getX(), this.getY(), this.getX() + this.getWidth(), this.getY() + this.getHeight(), 0x25ffffff);
this.getChildren().forEach(button -> {
button.render(matrixStack);
});
}
use of net.minecraft.text.TranslatableText in project LevelZ by Globox1997.
the class StonecutterBlockMixin method onUseMixin.
@Inject(method = "onUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;openHandledScreen(Lnet/minecraft/screen/NamedScreenHandlerFactory;)Ljava/util/OptionalInt;"), cancellable = true)
private void onUseMixin(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit, CallbackInfoReturnable<ActionResult> info) {
ArrayList<Object> levelList = LevelLists.stonecutterList;
if (!PlayerStatsManager.playerLevelisHighEnough(player, levelList, null, true)) {
player.sendMessage(new TranslatableText("item.levelz." + levelList.get(0) + ".tooltip", levelList.get(1)), true);
info.setReturnValue(ActionResult.FAIL);
}
}
use of net.minecraft.text.TranslatableText in project LevelZ by Globox1997.
the class SheepEntityMixin method interactMob.
@Inject(method = "interactMob", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/passive/SheepEntity;sheared(Lnet/minecraft/sound/SoundCategory;)V"), cancellable = true)
private void interactMob(PlayerEntity player, Hand hand, CallbackInfoReturnable<ActionResult> info) {
ArrayList<Object> levelList = LevelLists.sheepList;
if (!PlayerStatsManager.playerLevelisHighEnough(player, levelList, null, true)) {
player.sendMessage(new TranslatableText("item.levelz." + levelList.get(0) + ".tooltip", levelList.get(1)), true);
info.setReturnValue(ActionResult.FAIL);
}
}
Aggregations