Componentsn't

- Adjust to the removal of the Components class
This commit is contained in:
IThundxr 2025-01-26 13:52:29 -05:00
parent 670d8f08d6
commit 12df6e0084
Failed to generate hash of commit
164 changed files with 801 additions and 748 deletions

View file

@ -27,7 +27,7 @@ jei_minecraft_version = 1.20.1
jei_version = 15.10.0.39
curios_minecraft_version = 1.20.1
curios_version = 5.3.1
ponder_version = 0.9.20
ponder_version = 0.9.22
mixin_extras_version = 0.4.1
cc_tweaked_enable = true

View file

@ -4,6 +4,8 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.network.chat.Component;
import org.jetbrains.annotations.ApiStatus;
import com.simibubi.create.content.trains.bogey.BogeySizes;
@ -12,7 +14,6 @@ import com.simibubi.create.content.trains.bogey.BogeyStyle.SizeRenderer;
import com.simibubi.create.content.trains.bogey.StandardBogeyRenderer;
import com.simibubi.create.content.trains.bogey.StandardBogeyVisual;
import net.createmod.catnip.lang.Components;
import net.minecraft.resources.ResourceLocation;
public class AllBogeyStyles {
@ -22,13 +23,13 @@ public class AllBogeyStyles {
public static final ResourceLocation STANDARD_CYCLE_GROUP = Create.asResource("standard");
public static final BogeyStyle STANDARD =
builder("standard", STANDARD_CYCLE_GROUP).displayName(Components.translatable("create.bogey.style.standard"))
.size(BogeySizes.SMALL, AllBlocks.SMALL_BOGEY, () -> () -> new SizeRenderer(new StandardBogeyRenderer.Small(), StandardBogeyVisual.Small::new))
.size(BogeySizes.LARGE, AllBlocks.LARGE_BOGEY, () -> () -> new SizeRenderer(new StandardBogeyRenderer.Large(), StandardBogeyVisual.Large::new))
.build();
public static final BogeyStyle STANDARD
= builder("standard", STANDARD_CYCLE_GROUP).displayName(Component.translatable("create.bogey.style.standard"))
.size(BogeySizes.SMALL, AllBlocks.SMALL_BOGEY, () -> () -> new SizeRenderer(new StandardBogeyRenderer.Small(), StandardBogeyVisual.Small::new))
.size(BogeySizes.LARGE, AllBlocks.LARGE_BOGEY, () -> () -> new SizeRenderer(new StandardBogeyRenderer.Large(), StandardBogeyVisual.Large::new))
.build();
public static Map<ResourceLocation, BogeyStyle> getCycleGroup(ResourceLocation cycleGroup) {
public static Map<ResourceLocation, BogeyStyle> getCycleGroup(ResourceLocation cycleGroup) {
return CYCLE_GROUPS.getOrDefault(cycleGroup, EMPTY_GROUP);
}

View file

@ -7,6 +7,8 @@ import java.util.Set;
import java.util.function.Function;
import java.util.function.Predicate;
import net.minecraft.network.chat.Component;
import org.apache.commons.lang3.mutable.MutableObject;
import com.simibubi.create.content.contraptions.actors.seat.SeatBlock;
@ -29,7 +31,6 @@ import it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap;
import it.unimi.dsi.fastutil.objects.ReferenceArrayList;
import it.unimi.dsi.fastutil.objects.ReferenceLinkedOpenHashSet;
import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet;
import net.createmod.catnip.lang.Components;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.ItemRenderer;
import net.minecraft.client.resources.model.BakedModel;
@ -62,7 +63,7 @@ public class AllCreativeModeTabs {
public static final RegistryObject<CreativeModeTab> BASE_CREATIVE_TAB = REGISTER.register("base",
() -> CreativeModeTab.builder()
.title(Components.translatable("itemGroup.create.base"))
.title(Component.translatable("itemGroup.create.base"))
.withTabsBefore(CreativeModeTabs.SPAWN_EGGS)
.icon(() -> AllBlocks.COGWHEEL.asStack())
.displayItems(new RegistrateDisplayItemsGenerator(true, AllCreativeModeTabs.BASE_CREATIVE_TAB))
@ -70,7 +71,7 @@ public class AllCreativeModeTabs {
public static final RegistryObject<CreativeModeTab> PALETTES_CREATIVE_TAB = REGISTER.register("palettes",
() -> CreativeModeTab.builder()
.title(Components.translatable("itemGroup.create.palettes"))
.title(Component.translatable("itemGroup.create.palettes"))
.withTabsBefore(BASE_CREATIVE_TAB.getKey())
.icon(() -> AllPaletteBlocks.ORNATE_IRON_WINDOW.asStack())
.displayItems(new RegistrateDisplayItemsGenerator(false, AllCreativeModeTabs.PALETTES_CREATIVE_TAB))

View file

@ -30,13 +30,13 @@ import net.createmod.catnip.config.ui.BaseConfigScreen;
import net.createmod.catnip.config.ui.ConfigScreen;
import net.createmod.catnip.render.CachedBuffers;
import net.createmod.catnip.render.SuperByteBufferCache;
import net.createmod.catnip.lang.Components;
import net.createmod.ponder.foundation.PonderIndex;
import net.minecraft.ChatFormatting;
import net.minecraft.client.GraphicsStatus;
import net.minecraft.client.Minecraft;
import net.minecraft.core.Direction;
import net.minecraft.network.chat.ClickEvent;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.ComponentUtils;
import net.minecraft.network.chat.HoverEvent;
import net.minecraft.network.chat.MutableComponent;
@ -136,14 +136,15 @@ public class CreateClient {
if (AllConfigs.client().ignoreFabulousWarning.get())
return;
MutableComponent text = ComponentUtils.wrapInSquareBrackets(Components.literal("WARN"))
MutableComponent text = ComponentUtils.wrapInSquareBrackets(Component.literal("WARN"))
.withStyle(ChatFormatting.GOLD)
.append(Components.literal(
" Some of Create's visual features will not be available while Fabulous graphics are enabled!"))
.withStyle(style -> style
.withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/create dismissFabulousWarning"))
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
Components.literal("Click here to disable this warning"))));
.append(Component.literal(" Some of Create's visual features will not be available while Fabulous graphics are enabled!"))
.withStyle(style -> {
return style
.withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/create dismissFabulousWarning"))
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
Component.literal("Click here to disable this warning")));
});
mc.player.displayClientMessage(text, false);
}

View file

@ -4,6 +4,8 @@ import java.util.Map;
import javax.annotation.Nullable;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import org.jetbrains.annotations.NotNull;
import com.simibubi.create.AllPackets;
@ -18,7 +20,6 @@ import com.simibubi.create.foundation.utility.StringHelper;
import dan200.computercraft.api.lua.IArguments;
import dan200.computercraft.api.lua.LuaException;
import dan200.computercraft.api.lua.LuaFunction;
import net.createmod.catnip.lang.Components;
import net.minecraft.nbt.ByteTag;
import net.minecraft.nbt.CollectionTag;
import net.minecraft.nbt.CompoundTag;
@ -129,7 +130,7 @@ public class StationPeripheral extends SyncedPeripheral<StationBlockEntity> {
@LuaFunction(mainThread = true)
public final void setTrainName(String name) throws LuaException {
Train train = getTrainOrThrow();
train.name = Components.literal(name);
train.name = Component.literal(name);
AllPackets.getChannel().send(PacketDistributor.ALL.noArg(), new TrainEditPacket.TrainEditReturnPacket(train.id, name, train.icon.getId(), train.mapColorIndex));
}

View file

@ -8,6 +8,7 @@ import java.util.stream.Collectors;
import javax.annotation.ParametersAreNonnullByDefault;
import net.minecraft.network.chat.MutableComponent;
import org.jetbrains.annotations.NotNull;
import com.simibubi.create.AllFluids;
@ -23,7 +24,6 @@ import mezz.jei.api.recipe.RecipeType;
import mezz.jei.api.recipe.category.IRecipeCategory;
import mezz.jei.api.registration.IRecipeCatalystRegistration;
import mezz.jei.api.registration.IRecipeRegistration;
import net.createmod.catnip.lang.Components;
import net.minecraft.ChatFormatting;
import net.minecraft.MethodsReturnNonnullByDefault;
import net.minecraft.client.Minecraft;
@ -156,12 +156,12 @@ public abstract class CreateRecipeCategory<T extends Recipe<?>> implements IReci
}
int amount = mbAmount == -1 ? fluidStack.getAmount() : mbAmount;
Component text = Components.literal(String.valueOf(amount)).append(CreateLang.translateDirect("generic.unit.millibuckets")).withStyle(ChatFormatting.GOLD);
Component text = Component.literal(String.valueOf(amount)).append(CreateLang.translateDirect("generic.unit.millibuckets")).withStyle(ChatFormatting.GOLD);
if (tooltip.isEmpty())
tooltip.add(0, text);
else {
List<Component> siblings = tooltip.get(0).getSiblings();
siblings.add(Components.literal(" "));
siblings.add(Component.literal(" "));
siblings.add(text);
}
};

View file

@ -18,7 +18,6 @@ import mezz.jei.api.gui.ingredient.IRecipeSlotsView;
import mezz.jei.api.ingredients.IIngredientRenderer;
import mezz.jei.api.recipe.IFocusGroup;
import mezz.jei.api.recipe.RecipeIngredientRole;
import net.createmod.catnip.lang.Components;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font;
@ -189,7 +188,7 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<CraftingRec
return ingredient.getTooltipLines(player, tooltipFlag);
} catch (RuntimeException | LinkageError e) {
List<Component> list = new ArrayList<>();
MutableComponent crash = Components.translatable("jei.tooltip.error.crash");
MutableComponent crash = Component.translatable("jei.tooltip.error.crash");
list.add(crash.withStyle(ChatFormatting.RED));
return list;
}

View file

@ -21,7 +21,6 @@ import mezz.jei.api.gui.builder.IRecipeLayoutBuilder;
import mezz.jei.api.gui.ingredient.IRecipeSlotsView;
import mezz.jei.api.recipe.IFocusGroup;
import mezz.jei.api.recipe.RecipeIngredientRole;
import net.createmod.catnip.lang.Components;
import net.createmod.catnip.platform.CatnipServices;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
@ -101,7 +100,7 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
AllGuiTextures.JEI_LONG_ARROW.render(graphics, 52 + xOffset, 79);
if (!singleOutput) {
AllGuiTextures.JEI_CHANCE_SLOT.render(graphics, 150 + xOffset, 75);
Component component = Components.literal("?").withStyle(ChatFormatting.BOLD);
Component component = Component.literal("?").withStyle(ChatFormatting.BOLD);
graphics.drawString(font, component, font.width(component) / -2 + 8 + 150 + xOffset, 2 + 78,
0xefefef);
}
@ -110,7 +109,7 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
matrixStack.pushPose();
matrixStack.translate(15, 9, 0);
AllIcons.I_SEQ_REPEAT.render(graphics, 50 + xOffset, 75);
Component repeat = Components.literal("x" + recipe.getLoops());
Component repeat = Component.literal("x" + recipe.getLoops());
graphics.drawString(font, repeat, 66 + xOffset, 80, 0x888888, false);
matrixStack.popPose();
}
@ -130,7 +129,7 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
SequencedRecipe<?> sequencedRecipe = sequence.get(i);
SequencedAssemblySubCategory subCategory = getSubCategory(sequencedRecipe);
int subWidth = subCategory.getWidth();
MutableComponent component = Components.literal("" + romans[Math.min(i, 6)]);
MutableComponent component = Component.literal("" + romans[Math.min(i, 6)]);
graphics.drawString(font, component, font.width(component) / -2 + subWidth / 2, 2, 0x888888, false);
subCategory.draw(sequencedRecipe, graphics, mouseX, mouseY, i);
matrixStack.translate(subWidth + margin, 0, 0);

View file

@ -33,11 +33,11 @@ import net.createmod.catnip.animation.AnimationTickHolder;
import net.createmod.catnip.data.Couple;
import net.createmod.catnip.data.Iterate;
import net.createmod.catnip.data.Pair;
import net.createmod.catnip.lang.Components;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.renderer.Rect2i;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.FormattedText;
import net.minecraft.resources.ResourceKey;
import net.minecraft.util.FastColor;
@ -76,8 +76,9 @@ public class TrainMapManager {
graphics.bufferSource()
.endBatch();
if (hoveredElement instanceof GlobalStation station)
return List.of(Components.literal(station.name));
if (hoveredElement instanceof GlobalStation station) {
return List.of(Component.literal(station.name));
}
if (hoveredElement instanceof Train train)
return listTrainDetails(train);

View file

@ -6,8 +6,8 @@ import java.util.List;
import com.simibubi.create.foundation.item.TooltipHelper;
import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.lang.Components;
import net.createmod.catnip.lang.FontHelper.Palette;
import net.createmod.catnip.lang.Lang;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component;
@ -19,7 +19,7 @@ public interface IDisplayAssemblyExceptions {
return false;
if (!tooltip.isEmpty())
tooltip.add(Components.immutableEmpty());
tooltip.add(Lang.IMMUTABLE_EMPTY);
CreateLang.translate("gui.assembly.exception").style(ChatFormatting.GOLD)
.forGoggles(tooltip);

View file

@ -1,5 +1,7 @@
package com.simibubi.create.content.contraptions.elevator;
import net.createmod.catnip.lang.Lang;
import org.lwjgl.glfw.GLFW;
import com.google.common.collect.ImmutableList;
@ -17,7 +19,6 @@ import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.data.Pair;
import net.createmod.catnip.gui.AbstractSimiScreen;
import net.createmod.catnip.gui.element.GuiGameElement;
import net.createmod.catnip.lang.Components;
import net.minecraft.ChatFormatting;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.EditBox;
@ -107,7 +108,7 @@ public class ElevatorContactScreen extends AbstractSimiScreen {
}
private EditBox editBox(int x, int width, int chars) {
EditBox editBox = new EditBox(font, guiLeft + x, guiTop + 30, width, 10, Components.immutableEmpty());
EditBox editBox = new EditBox(font, guiLeft + x, guiTop + 30, width, 10, Lang.IMMUTABLE_EMPTY);
editBox.setTextColor(-1);
editBox.setTextColorUneditable(-1);
editBox.setBordered(false);

View file

@ -12,7 +12,7 @@ import com.simibubi.create.content.contraptions.chassis.AbstractChassisBlock;
import com.simibubi.create.foundation.utility.CreateLang;
import com.simibubi.create.foundation.utility.RaycastHelper;
import net.createmod.catnip.lang.Components;
import net.createmod.catnip.lang.Lang;
import net.createmod.catnip.outliner.Outliner;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ClientLevel;
@ -63,7 +63,7 @@ public class SuperGlueSelectionHandler {
if (clusterCooldown > 0) {
if (clusterCooldown == 25)
player.displayClientMessage(Components.immutableEmpty(), true);
player.displayClientMessage(Lang.IMMUTABLE_EMPTY, true);
Outliner.getInstance().keep(clusterOutlineSlot);
clusterCooldown--;
}

View file

@ -9,10 +9,10 @@ import com.simibubi.create.foundation.gui.widget.SelectionScrollInput;
import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.data.Pair;
import net.createmod.catnip.lang.Components;
import net.createmod.catnip.lang.Lang;
import net.minecraft.client.Minecraft;
import net.minecraft.core.Direction;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.Entity;
import net.minecraftforge.api.distmarker.Dist;
@ -59,7 +59,7 @@ public enum DoorControl {
playerFacing = SOUTH;
}
Label label = new Label(x + 4, y + 6, Components.empty()).withShadow();
Label label = new Label(x + 4, y + 6, Component.empty()).withShadow();
ScrollInput input = new SelectionScrollInput(x, y, 53, 16)
.forOptions(CreateLang.translatedOptions("contraption.door_control", valuesAsString()))
.titled(CreateLang.translateDirect("contraption.door_control"))

View file

@ -10,10 +10,11 @@ import com.simibubi.create.AllTags;
import com.simibubi.create.foundation.utility.CreateLang;
import com.simibubi.create.infrastructure.config.AllConfigs;
import net.createmod.catnip.lang.Components;
import net.createmod.catnip.lang.Lang;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.protocol.game.ClientboundSetSubtitleTextPacket;
import net.minecraft.network.protocol.game.ClientboundSetTitleTextPacket;
@ -97,9 +98,9 @@ public class BacktankUtil {
player.connection.send(new ClientboundSetTitlesAnimationPacket(10, 40, 10));
player.connection.send(new ClientboundSetSubtitleTextPacket(
Components.literal("\u26A0 ").withStyle(depleted ? ChatFormatting.RED : ChatFormatting.GOLD)
Component.literal("\u26A0 ").withStyle(depleted ? ChatFormatting.RED : ChatFormatting.GOLD)
.append(component.withStyle(ChatFormatting.GRAY))));
player.connection.send(new ClientboundSetTitleTextPacket(Components.immutableEmpty()));
player.connection.send(new ClientboundSetTitleTextPacket(Lang.IMMUTABLE_EMPTY));
}
public static int maxAir(ItemStack backtank) {

View file

@ -6,7 +6,6 @@ import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllItems;
import net.createmod.catnip.gui.element.GuiGameElement;
import net.createmod.catnip.lang.Components;
import net.createmod.catnip.theme.Color;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
@ -50,7 +49,7 @@ public class RemainingAirOverlay implements IGuiOverlay {
poseStack.translate(width / 2 + 90, height - 53 + (backtank.getItem()
.isFireResistant() ? 9 : 0), 0);
Component text = Components.literal(StringUtil.formatTickDuration(Math.max(0, timeLeft - 1) * 20));
Component text = Component.literal(StringUtil.formatTickDuration(Math.max(0, timeLeft - 1) * 20));
GuiGameElement.of(backtank)
.at(0, 0)
.render(graphics);

View file

@ -29,7 +29,6 @@ import net.createmod.catnip.animation.AnimationTickHolder;
import net.createmod.catnip.data.Couple;
import net.createmod.catnip.data.Iterate;
import net.createmod.catnip.data.Pair;
import net.createmod.catnip.lang.Components;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
@ -37,6 +36,7 @@ import net.minecraft.client.gui.screens.inventory.tooltip.TooltipRenderUtil;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.CraftingContainer;
import net.minecraft.world.item.Item;
@ -351,7 +351,7 @@ public class BlueprintOverlayRenderer {
AllGuiTextures.TRADE_OVERLAY.render(graphics, width / 2 - 48, y - 19);
if (shopContext.purchases() > 0) {
graphics.renderItem(AllItems.SHOPPING_LIST.asStack(), width / 2 + 20, y - 20);
graphics.drawString(mc.font, Components.literal("x" + shopContext.purchases()), width / 2 + 20 + 16,
graphics.drawString(mc.font, Component.literal("x" + shopContext.purchases()), width / 2 + 20 + 16,
y - 20 + 4, 0xff_eeeeee, true);
}
}

View file

@ -29,7 +29,6 @@ import com.simibubi.create.foundation.utility.CreateLang;
import it.unimi.dsi.fastutil.ints.IntArrayList;
import it.unimi.dsi.fastutil.ints.IntList;
import net.createmod.catnip.gui.AbstractSimiScreen;
import net.createmod.catnip.lang.Components;
import net.minecraft.SharedConstants;
import net.minecraft.Util;
import net.minecraft.client.Minecraft;
@ -101,7 +100,7 @@ public class ClipboardScreen extends AbstractSimiScreen {
currentEntries = pages.get(currentPage);
boolean startEmpty = currentEntries.isEmpty();
if (startEmpty)
currentEntries.add(new ClipboardEntry(false, Components.empty()));
currentEntries.add(new ClipboardEntry(false, Component.empty()));
editingIndex = 0;
editContext = new TextFieldHelper(this::getCurrentEntryText, this::setCurrentEntryText, this::getClipboard,
this::setClipboard, this::validateTextForEntry);
@ -128,7 +127,7 @@ public class ClipboardScreen extends AbstractSimiScreen {
editingIndex = -1;
currentEntries.removeIf(ce -> ce.checked);
if (currentEntries.isEmpty())
currentEntries.add(new ClipboardEntry(false, Components.empty()));
currentEntries.add(new ClipboardEntry(false, Component.empty()));
sendIfEditingBlock();
});
clearBtn.setToolTip(CreateLang.translateDirect("gui.clipboard.erase_checked"));
@ -187,7 +186,7 @@ public class ClipboardScreen extends AbstractSimiScreen {
ClipboardEntry clipboardEntry = currentEntries.get(i);
String text = clipboardEntry.text.getString();
totalHeight +=
Math.max(12, font.split(Components.literal(text), clipboardEntry.icon.isEmpty() ? 150 : 130)
Math.max(12, font.split(Component.literal(text), clipboardEntry.icon.isEmpty() ? 150 : 130)
.size() * 9 + 3);
if (totalHeight > my) {
@ -204,7 +203,7 @@ public class ClipboardScreen extends AbstractSimiScreen {
}
private void setCurrentEntryText(String text) {
currentEntries.get(editingIndex).text = Components.literal(text);
currentEntries.get(editingIndex).text = Component.literal(text);
sendIfEditingBlock();
}
@ -222,7 +221,7 @@ public class ClipboardScreen extends AbstractSimiScreen {
for (int i = 0; i < currentEntries.size(); i++) {
ClipboardEntry clipboardEntry = currentEntries.get(i);
String text = i == editingIndex ? newText : clipboardEntry.text.getString();
totalHeight += Math.max(12, font.split(Components.literal(text), 150)
totalHeight += Math.max(12, font.split(Component.literal(text), 150)
.size() * 9 + 3);
}
return totalHeight < 185;
@ -255,7 +254,7 @@ public class ClipboardScreen extends AbstractSimiScreen {
}
currentEntries = pages.get(currentPage);
if (currentEntries.isEmpty()) {
currentEntries.add(new ClipboardEntry(false, Components.empty()));
currentEntries.add(new ClipboardEntry(false, Component.empty()));
if (!readonly) {
editingIndex = 0;
editContext.setCursorToEnd();
@ -281,7 +280,7 @@ public class ClipboardScreen extends AbstractSimiScreen {
int y = guiTop - 8;
AllGuiTextures.CLIPBOARD.render(graphics, x, y);
graphics.drawString(font, Components.translatable("book.pageIndicator", currentPage + 1, getNumPages()),
graphics.drawString(font, Component.translatable("book.pageIndicator", currentPage + 1, getNumPages()),
x + 150, y + 9, 0x43ffffff, false);
for (int i = 0; i < currentEntries.size(); i++) {
@ -298,7 +297,7 @@ public class ClipboardScreen extends AbstractSimiScreen {
RenderSystem.enableBlend();
(checked ? AllGuiTextures.CLIPBOARD_ADDRESS_INACTIVE : AllGuiTextures.CLIPBOARD_ADDRESS)
.render(graphics, x + 44, y + 50);
text = Components.literal(string.substring(1)
text = Component.literal(string.substring(1)
.stripLeading());
} else {
graphics.drawString(font, "\u25A1", x + 45, y + 51, checked ? 0x668D7F6B : 0xff8D7F6B, false);
@ -437,7 +436,7 @@ public class ClipboardScreen extends AbstractSimiScreen {
if (currentEntries.size() <= editingIndex + 1
|| !currentEntries.get(editingIndex + 1).text.getString()
.isEmpty())
currentEntries.add(editingIndex + 1, new ClipboardEntry(false, Components.empty()));
currentEntries.add(editingIndex + 1, new ClipboardEntry(false, Component.empty()));
editingIndex += 1;
editContext.setCursorToEnd();
if (validateTextForEntry(" "))
@ -614,7 +613,7 @@ public class ClipboardScreen extends AbstractSimiScreen {
if (hoveredEntry != editingIndex && !readonly) {
editingIndex = hoveredEntry;
if (hoveredEntry >= currentEntries.size()) {
currentEntries.add(new ClipboardEntry(false, Components.empty()));
currentEntries.add(new ClipboardEntry(false, Component.empty()));
if (!validateTextForEntry(" ")) {
currentEntries.remove(hoveredEntry);
editingIndex = -1;
@ -865,7 +864,7 @@ public class ClipboardScreen extends AbstractSimiScreen {
contents = pContents;
x = pX;
y = pY;
asComponent = Components.literal(pContents)
asComponent = Component.literal(pContents)
.setStyle(pStyle);
}
}

View file

@ -13,12 +13,12 @@ import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;
import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour;
import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.lang.Components;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
@ -95,7 +95,7 @@ public class ClipboardValueSettingsHandler {
if (smartBE instanceof ClipboardBlockEntity) {
List<MutableComponent> tip = new ArrayList<>();
tip.add(CreateLang.translateDirect("clipboard.actions"));
tip.add(CreateLang.translateDirect("clipboard.copy_other_clipboard", Components.keybind("key.use")));
tip.add(CreateLang.translateDirect("clipboard.copy_other_clipboard", Component.keybind("key.use")));
CreateClient.VALUE_SETTINGS_HANDLER.showHoverTip(tip);
return;
}
@ -123,9 +123,9 @@ public class ClipboardValueSettingsHandler {
List<MutableComponent> tip = new ArrayList<>();
tip.add(CreateLang.translateDirect("clipboard.actions"));
if (canCopy)
tip.add(CreateLang.translateDirect("clipboard.to_copy", Components.keybind("key.use")));
tip.add(CreateLang.translateDirect("clipboard.to_copy", Component.keybind("key.use")));
if (canPaste)
tip.add(CreateLang.translateDirect("clipboard.to_paste", Components.keybind("key.attack")));
tip.add(CreateLang.translateDirect("clipboard.to_paste", Component.keybind("key.attack")));
CreateClient.VALUE_SETTINGS_HANDLER.showHoverTip(tip);
}

View file

@ -5,7 +5,7 @@ import com.simibubi.create.foundation.utility.CreateLang;
import com.simibubi.create.infrastructure.config.AllConfigs;
import net.createmod.catnip.gui.AbstractSimiScreen;
import net.createmod.catnip.gui.element.GuiGameElement;
import net.createmod.catnip.lang.Components;
import net.createmod.catnip.lang.Lang;
import net.minecraft.ChatFormatting;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.network.chat.Component;
@ -23,26 +23,26 @@ public class GoggleConfigScreen extends AbstractSimiScreen {
private final List<Component> tooltip;
public GoggleConfigScreen() {
Component componentSpacing = Components.literal(" ");
Component componentSpacing = Component.literal(" ");
tooltip = new ArrayList<>();
tooltip.add(componentSpacing.plainCopy()
.append(CreateLang.translateDirect("gui.config.overlay1")));
tooltip.add(componentSpacing.plainCopy()
.append(CreateLang.translateDirect("gui.config.overlay2")
.withStyle(ChatFormatting.GRAY)));
tooltip.add(Components.immutableEmpty());
tooltip.add(Lang.IMMUTABLE_EMPTY);
tooltip.add(componentSpacing.plainCopy()
.append(CreateLang.translateDirect("gui.config.overlay3")));
tooltip.add(componentSpacing.plainCopy()
.append(CreateLang.translateDirect("gui.config.overlay4")));
tooltip.add(Components.immutableEmpty());
tooltip.add(Lang.IMMUTABLE_EMPTY);
tooltip.add(componentSpacing.plainCopy()
.append(CreateLang.translateDirect("gui.config.overlay5")
.withStyle(ChatFormatting.GRAY)));
tooltip.add(componentSpacing.plainCopy()
.append(CreateLang.translateDirect("gui.config.overlay6")
.withStyle(ChatFormatting.GRAY)));
tooltip.add(Components.immutableEmpty());
tooltip.add(Lang.IMMUTABLE_EMPTY);
tooltip.add(componentSpacing.plainCopy()
.append(CreateLang.translateDirect("gui.config.overlay7")));
tooltip.add(componentSpacing.plainCopy()

View file

@ -23,7 +23,7 @@ import com.simibubi.create.infrastructure.config.CClient;
import net.createmod.catnip.gui.element.BoxElement;
import net.createmod.catnip.gui.element.GuiGameElement;
import net.createmod.catnip.data.Iterate;
import net.createmod.catnip.lang.Components;
import net.createmod.catnip.lang.Lang;
import net.createmod.catnip.outliner.Outline;
import net.createmod.catnip.outliner.Outliner;
import net.createmod.catnip.outliner.Outliner.OutlineEntry;
@ -113,7 +113,7 @@ public class GoggleOverlayRenderer {
if (hasHoveringInformation) {
if (!tooltip.isEmpty())
tooltip.add(Components.immutableEmpty());
tooltip.add(Lang.IMMUTABLE_EMPTY);
IHaveHoveringInformation hte = (IHaveHoveringInformation) be;
hoverAddedInformation = hte.addToTooltip(tooltip, isShifting);
@ -160,7 +160,7 @@ public class GoggleOverlayRenderer {
return;
}
if (!tooltip.isEmpty())
tooltip.add(Components.immutableEmpty());
tooltip.add(Lang.IMMUTABLE_EMPTY);
CreateLang.translate("gui.goggles.pole_length")
.text(" " + poles)

View file

@ -5,6 +5,8 @@ import java.util.Optional;
import java.util.function.Consumer;
import java.util.function.Predicate;
import net.createmod.catnip.lang.Lang;
import org.jetbrains.annotations.Nullable;
import com.simibubi.create.AllEnchantments;
@ -20,7 +22,6 @@ import com.simibubi.create.infrastructure.config.AllConfigs;
import net.createmod.catnip.animation.AnimationTickHolder;
import net.createmod.catnip.math.VecHelper;
import net.createmod.catnip.lang.Components;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.HumanoidModel.ArmPose;
@ -225,21 +226,20 @@ public class PotatoCannonItem extends ProjectileWeaponItem implements CustomArmP
String _reload = "potato_cannon.ammo.reload_ticks";
String _knockback = "potato_cannon.ammo.knockback";
tooltip.add(Components.immutableEmpty());
tooltip.add(Components.translatable(ammo.getDescriptionId()).append(Components.literal(":"))
tooltip.add(Lang.IMMUTABLE_EMPTY);
tooltip.add(Component.translatable(ammo.getDescriptionId()).append(Component.literal(":"))
.withStyle(ChatFormatting.GRAY));
PotatoCannonProjectileType type = PotatoProjectileTypeManager.getTypeForStack(ammo)
.get();
MutableComponent spacing = Components.literal(" ");
MutableComponent spacing = Component.literal(" ");
ChatFormatting green = ChatFormatting.GREEN;
ChatFormatting darkGreen = ChatFormatting.DARK_GREEN;
float damageF = type.getDamage() * additionalDamageMult;
MutableComponent damage = Components.literal(
damageF == Mth.floor(damageF) ? "" + Mth.floor(damageF) : "" + damageF);
MutableComponent reloadTicks = Components.literal("" + type.getReloadTicks());
MutableComponent knockback =
Components.literal("" + (type.getKnockback() + additionalKnockback));
MutableComponent damage = Component.literal(damageF == Mth.floor(damageF) ? "" + Mth.floor(damageF) : "" + damageF);
MutableComponent reloadTicks = Component.literal("" + type.getReloadTicks());
MutableComponent knockback =
Component.literal("" + (type.getKnockback() + additionalKnockback));
damage = damage.withStyle(additionalDamageMult > 1 ? green : darkGreen);
knockback = knockback.withStyle(additionalKnockback > 0 ? green : darkGreen);

View file

@ -1,5 +1,7 @@
package com.simibubi.create.content.equipment.symmetryWand;
import net.createmod.catnip.lang.Lang;
import org.joml.Vector3f;
import com.mojang.blaze3d.vertex.PoseStack;
@ -20,7 +22,6 @@ import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.gui.AbstractSimiScreen;
import net.createmod.catnip.gui.element.GuiGameElement;
import net.createmod.catnip.lang.Components;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.network.chat.Component;
import net.minecraft.world.InteractionHand;
@ -64,9 +65,9 @@ public class SymmetryWandScreen extends AbstractSimiScreen {
int x = guiLeft;
int y = guiTop;
labelType = new Label(x + 51, y + 28, Components.immutableEmpty()).colored(0xFFFFFFFF)
labelType = new Label(x + 51, y + 28, Lang.IMMUTABLE_EMPTY).colored(0xFFFFFFFF)
.withShadow();
labelAlign = new Label(x + 51, y + 50, Components.immutableEmpty()).colored(0xFFFFFFFF)
labelAlign = new Label(x + 51, y + 50, Lang.IMMUTABLE_EMPTY).colored(0xFFFFFFFF)
.withShadow();
int state =

View file

@ -12,8 +12,8 @@ import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.gui.AbstractSimiScreen;
import net.createmod.catnip.gui.element.GuiGameElement;
import net.createmod.catnip.lang.Lang;
import net.createmod.catnip.nbt.NBTHelper;
import net.createmod.catnip.lang.Components;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.nbt.CompoundTag;
@ -46,7 +46,7 @@ public abstract class ZapperScreen extends AbstractSimiScreen {
this.background = background;
this.zapper = zapper;
this.hand = hand;
title = Components.immutableEmpty();
title = Lang.IMMUTABLE_EMPTY;
brightColor = 0xFEFEFE;
fontColor = AllGuiTextures.FONT_COLOR;

View file

@ -15,8 +15,8 @@ import com.simibubi.create.foundation.gui.widget.ScrollInput;
import com.simibubi.create.foundation.gui.widget.SelectionScrollInput;
import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.lang.Lang;
import net.createmod.catnip.nbt.NBTHelper;
import net.createmod.catnip.lang.Components;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
@ -82,7 +82,7 @@ public class WorldshaperScreen extends ZapperScreen {
int x = guiLeft;
int y = guiTop;
brushLabel = new Label(x + 61, y + 25, Components.immutableEmpty()).withShadow();
brushLabel = new Label(x + 61, y + 25, Lang.IMMUTABLE_EMPTY).withShadow();
brushInput = new SelectionScrollInput(x + 56, y + 20, 77, 18).forOptions(brushOptions)
.titled(CreateLang.translateDirect("gui.terrainzapper.brush"))
.writingTo(brushLabel)
@ -111,7 +111,7 @@ public class WorldshaperScreen extends ZapperScreen {
brushParams.clear();
for (int index = 0; index < 3; index++) {
Label label = new Label(x + 65 + 20 * index, y + 45, Components.immutableEmpty()).withShadow();
Label label = new Label(x + 65 + 20 * index, y + 45, Lang.IMMUTABLE_EMPTY).withShadow();
final int finalIndex = index;
ScrollInput input = new ScrollInput(x + 56 + 20 * index, y + 40, 18, 18)
@ -155,10 +155,10 @@ public class WorldshaperScreen extends ZapperScreen {
if (currentBrush.hasConnectivityOptions()) {
int x1 = x + 7 + 4 * 18;
int y1 = y + 79;
followDiagonalsIndicator = new Indicator(x1, y1 - 6, Components.immutableEmpty());
followDiagonalsIndicator = new Indicator(x1, y1 - 6, Lang.IMMUTABLE_EMPTY);
followDiagonals = new IconButton(x1, y1, AllIcons.I_FOLLOW_DIAGONAL);
x1 += 18;
acrossMaterialsIndicator = new Indicator(x1, y1 - 6, Components.immutableEmpty());
acrossMaterialsIndicator = new Indicator(x1, y1 - 6, Lang.IMMUTABLE_EMPTY);
acrossMaterials = new IconButton(x1, y1, AllIcons.I_FOLLOW_MATERIAL);
followDiagonals.withCallback(() -> {

View file

@ -9,9 +9,9 @@ import com.simibubi.create.content.fluids.potion.PotionFluid.BottleType;
import com.simibubi.create.foundation.fluid.FluidHelper;
import com.simibubi.create.foundation.fluid.FluidIngredient;
import net.createmod.catnip.lang.Lang;
import net.createmod.catnip.nbt.NBTHelper;
import net.createmod.catnip.data.Pair;
import net.createmod.catnip.lang.Components;
import net.minecraft.ChatFormatting;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
@ -112,10 +112,10 @@ public class PotionFluidHandler {
List<MobEffectInstance> list = PotionUtils.getAllEffects(fs.getOrCreateTag());
List<Tuple<String, AttributeModifier>> list1 = Lists.newArrayList();
if (list.isEmpty()) {
tooltip.add((Components.translatable("effect.none")).withStyle(ChatFormatting.GRAY));
tooltip.add((Component.translatable("effect.none")).withStyle(ChatFormatting.GRAY));
} else {
for (MobEffectInstance effectinstance : list) {
MutableComponent textcomponent = Components.translatable(effectinstance.getDescriptionId());
MutableComponent textcomponent = Component.translatable(effectinstance.getDescriptionId());
MobEffect effect = effectinstance.getEffect();
Map<Attribute, AttributeModifier> map = effect.getAttributeModifiers();
if (!map.isEmpty()) {
@ -131,8 +131,8 @@ public class PotionFluidHandler {
}
if (effectinstance.getAmplifier() > 0) {
textcomponent.append(" ")
.append(Components.translatable("potion.potency." + effectinstance.getAmplifier()).getString());
textcomponent.append(" ")
.append(Component.translatable("potion.potency." + effectinstance.getAmplifier()).getString());
}
if (effectinstance.getDuration() > 20) {
@ -147,8 +147,8 @@ public class PotionFluidHandler {
}
if (!list1.isEmpty()) {
tooltip.add(Components.immutableEmpty());
tooltip.add((Components.translatable("potion.whenDrank")).withStyle(ChatFormatting.DARK_PURPLE));
tooltip.add(Lang.IMMUTABLE_EMPTY);
tooltip.add((Component.translatable("potion.whenDrank")).withStyle(ChatFormatting.DARK_PURPLE));
for (Tuple<String, AttributeModifier> tuple : list1) {
AttributeModifier attributemodifier2 = tuple.getB();
@ -162,19 +162,15 @@ public class PotionFluidHandler {
}
if (d0 > 0.0D) {
tooltip.add((Components.translatable(
"attribute.modifier.plus." + attributemodifier2.getOperation()
.toValue(),
ItemStack.ATTRIBUTE_MODIFIER_FORMAT.format(d1),
Components.translatable(tuple.getA())))
Object[] args = new Object[]{ItemStack.ATTRIBUTE_MODIFIER_FORMAT.format(d1), Component.translatable(tuple.getA())};
tooltip.add((Component.translatable("attribute.modifier.plus." + attributemodifier2.getOperation()
.toValue(), args))
.withStyle(ChatFormatting.BLUE));
} else if (d0 < 0.0D) {
d1 = d1 * -1.0D;
tooltip.add((Components.translatable(
"attribute.modifier.take." + attributemodifier2.getOperation()
.toValue(),
ItemStack.ATTRIBUTE_MODIFIER_FORMAT.format(d1),
Components.translatable(tuple.getA())))
Object[] args = new Object[]{ItemStack.ATTRIBUTE_MODIFIER_FORMAT.format(d1), Component.translatable(tuple.getA())};
tooltip.add((Component.translatable("attribute.modifier.take." + attributemodifier2.getOperation()
.toValue(), args))
.withStyle(ChatFormatting.RED));
}
}

View file

@ -6,6 +6,8 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import net.createmod.catnip.lang.Lang;
import org.jetbrains.annotations.NotNull;
import com.simibubi.create.AllBlocks;
@ -23,7 +25,6 @@ import joptsimple.internal.Strings;
import net.createmod.catnip.data.Iterate;
import net.createmod.catnip.animation.LerpedFloat;
import net.createmod.catnip.animation.LerpedFloat.Chaser;
import net.createmod.catnip.lang.Components;
import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
@ -208,7 +209,7 @@ public class BoilerData {
double totalSU = getEngineEfficiency(boilerSize) * 16 * Math.max(boilerLevel, attachedEngines)
* BlockStressValues.getCapacity(AllBlocks.STEAM_ENGINE.get());
tooltip.add(Components.immutableEmpty());
tooltip.add(Lang.IMMUTABLE_EMPTY);
if (attachedEngines > 0 && maxHeatForSize > 0 && maxHeatForWater == 0 && (passiveHeat ? 1 : activeHeat) > 0) {
CreateLang.translate("boiler.water_input_rate")
@ -289,12 +290,11 @@ public class BoilerData {
}
private MutableComponent blockComponent(int level) {
return Components.literal(
"" + "\u2588".repeat(minValue) + "\u2592".repeat(level - minValue) + "\u2591".repeat(maxValue - level));
return Component.literal("" + "\u2588".repeat(minValue) + "\u2592".repeat(level - minValue) + "\u2591".repeat(maxValue - level));
}
private MutableComponent barComponent(int level) {
return Components.empty()
return Component.empty()
.append(bars(Math.max(0, minValue - 1), ChatFormatting.DARK_GREEN))
.append(bars(minValue > 0 ? 1 : 0, ChatFormatting.GREEN))
.append(bars(Math.max(0, level - minValue), ChatFormatting.DARK_GREEN))
@ -305,7 +305,7 @@ public class BoilerData {
}
private MutableComponent bars(int level, ChatFormatting format) {
return Components.literal(Strings.repeat('|', level))
return Component.literal(Strings.repeat('|', level))
.withStyle(format);
}

View file

@ -13,7 +13,6 @@ import com.simibubi.create.content.processing.sequenced.IAssemblyRecipe;
import com.simibubi.create.foundation.fluid.FluidIngredient;
import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.lang.Components;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.level.ItemLike;
@ -69,8 +68,9 @@ public class FillingRecipe extends ProcessingRecipe<RecipeWrapper> implements IA
public Component getDescriptionForAssembly() {
List<FluidStack> matchingFluidStacks = fluidIngredients.get(0)
.getMatchingFluidStacks();
if (matchingFluidStacks.size() == 0)
return Components.literal("Invalid");
if (matchingFluidStacks.size() == 0) {
return Component.literal("Invalid");
}
return CreateLang.translateDirect("recipe.assembly.spout_filling_fluid",
matchingFluidStacks.get(0).getDisplayName().getString());
}

View file

@ -15,8 +15,8 @@ import com.simibubi.create.content.kinetics.belt.transport.TransportedItemStack;
import com.simibubi.create.foundation.block.ProperWaterloggedBlock;
import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.lang.Lang;
import net.createmod.catnip.math.VecHelper;
import net.createmod.catnip.lang.Components;
import net.createmod.catnip.outliner.Outliner;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
@ -477,7 +477,7 @@ public class BeltSlicer {
mc.player.displayClientMessage(CreateLang.translateDirect(feedback.langKey)
.withStyle(feedback.formatting), true);
else
mc.player.displayClientMessage(Components.immutableEmpty(), true);
mc.player.displayClientMessage(Lang.IMMUTABLE_EMPTY, true);
if (feedback.bb != null)
Outliner.getInstance().chaseAABB("BeltSlicer", feedback.bb)

View file

@ -120,9 +120,9 @@ public class ChainConveyorBlockEntity extends KineticBlockEntity implements ITra
// debug routing info
// tooltip.addAll(routingTable.createSummary());
// if (!loopPorts.isEmpty())
// tooltip.add(Components.literal(loopPorts.size() + " Loop ports"));
// tooltip.add(Component.literal(loopPorts.size() + " Loop ports"));
// if (!travelPorts.isEmpty())
// tooltip.add(Components.literal(travelPorts.size() + " Travel ports"));
// tooltip.add(Component.literal(travelPorts.size() + " Travel ports"));
// return true;
}

View file

@ -8,7 +8,6 @@ import org.apache.commons.lang3.mutable.MutableInt;
import com.simibubi.create.content.logistics.box.PackageItem;
import net.createmod.catnip.lang.Components;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.ItemStack;
@ -89,8 +88,9 @@ public class ChainConveyorRoutingTable {
public Collection<? extends Component> createSummary() {
ArrayList<Component> list = new ArrayList<>();
for (RoutingTableEntry entry : entriesByDistance)
list.add(Components.literal(" [" + entry.distance() + "] " + entry.port()));
for (RoutingTableEntry entry : entriesByDistance) {
list.add(Component.literal(" [" + entry.distance() + "] " + entry.port()));
}
return list;
}

View file

@ -24,7 +24,6 @@ import dev.engine_room.flywheel.lib.model.Models;
import net.createmod.catnip.render.CachedBuffers;
import net.createmod.catnip.render.SuperByteBuffer;
import net.createmod.catnip.math.VecHelper;
import net.createmod.catnip.lang.Components;
import net.createmod.ponder.render.VirtualRenderHelper;
import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos;
@ -168,9 +167,9 @@ public class ValveHandleBlockEntity extends HandCrankBlockEntity {
@Override
public ValueSettingsBoard createBoard(Player player, BlockHitResult hitResult) {
ImmutableList<Component> rows = ImmutableList.of(Components.literal("\u27f3")
ImmutableList<Component> rows = ImmutableList.of(Component.literal("\u27f3")
.withStyle(ChatFormatting.BOLD),
Components.literal("\u27f2")
Component.literal("\u27f2")
.withStyle(ChatFormatting.BOLD));
return new ValueSettingsBoard(label, 180, 45, rows, new ValueSettingsFormatter(this::formatValue));
}

View file

@ -13,7 +13,6 @@ import com.simibubi.create.content.processing.recipe.ProcessingRecipeBuilder.Pro
import com.simibubi.create.content.processing.sequenced.IAssemblyRecipe;
import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.lang.Components;
import net.minecraft.client.Minecraft;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
@ -57,10 +56,11 @@ public class DeployerApplicationRecipe extends ItemApplicationRecipe implements
public Component getDescriptionForAssembly() {
ItemStack[] matchingStacks = ingredients.get(1)
.getItems();
if (matchingStacks.length == 0)
return Components.literal("Invalid");
if (matchingStacks.length == 0) {
return Component.literal("Invalid");
}
return CreateLang.translateDirect("recipe.assembly.deploying_item",
Components.translatable(matchingStacks[0].getDescriptionId()).getString());
Component.translatable(matchingStacks[0].getDescriptionId()).getString());
}
@Override

View file

@ -27,10 +27,10 @@ import com.simibubi.create.foundation.item.TooltipHelper;
import com.simibubi.create.foundation.utility.CreateLang;
import dev.engine_room.flywheel.lib.model.baked.PartialModel;
import net.createmod.catnip.lang.Lang;
import net.createmod.catnip.nbt.NBTHelper;
import net.createmod.catnip.math.VecHelper;
import net.createmod.catnip.animation.LerpedFloat;
import net.createmod.catnip.lang.Components;
import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
@ -503,14 +503,14 @@ public class DeployerBlockEntity extends KineticBlockEntity {
.forGoggles(tooltip);
if (!heldItem.isEmpty())
CreateLang.translate("tooltip.deployer.contains", Components.translatable(heldItem.getDescriptionId())
.getString(), heldItem.getCount())
.style(ChatFormatting.GREEN)
.forGoggles(tooltip);
CreateLang.translate("tooltip.deployer.contains", Component.translatable(heldItem.getDescriptionId())
.getString(), heldItem.getCount())
.style(ChatFormatting.GREEN)
.forGoggles(tooltip);
float stressAtBase = calculateStressApplied();
if (StressImpact.isEnabled() && !Mth.equal(stressAtBase, 0)) {
tooltip.add(Components.immutableEmpty());
tooltip.add(Lang.IMMUTABLE_EMPTY);
addStressImpactStats(tooltip, stressAtBase);
}

View file

@ -8,7 +8,6 @@ import com.simibubi.create.foundation.blockEntity.behaviour.ValueSettingsFormatt
import com.simibubi.create.foundation.blockEntity.behaviour.scrollValue.ScrollValueBehaviour;
import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.lang.Components;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
@ -24,9 +23,9 @@ public class KineticScrollValueBehaviour extends ScrollValueBehaviour {
@Override
public ValueSettingsBoard createBoard(Player player, BlockHitResult hitResult) {
ImmutableList<Component> rows = ImmutableList.of(Components.literal("\u27f3")
ImmutableList<Component> rows = ImmutableList.of(Component.literal("\u27f3")
.withStyle(ChatFormatting.BOLD),
Components.literal("\u27f2")
Component.literal("\u27f2")
.withStyle(ChatFormatting.BOLD));
ValueSettingsFormatter formatter = new ValueSettingsFormatter(this::formatSettings);
return new ValueSettingsBoard(label, 256, 32, rows, formatter);

View file

@ -6,7 +6,6 @@ import java.util.List;
import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.lang.Components;
import net.createmod.catnip.lang.Lang;
import net.minecraft.network.chat.Component;
@ -26,7 +25,7 @@ public enum InstructionSpeedModifiers {
value = modifier;
}
private InstructionSpeedModifiers(int modifier, String label) {
this.label = Components.literal(label);
this.label = Component.literal(label);
translationKey = "gui.sequenced_gearshift.speed." + Lang.asId(name());
value = modifier;
}

View file

@ -14,10 +14,10 @@ import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.gui.AbstractSimiScreen;
import net.createmod.catnip.gui.element.GuiGameElement;
import net.createmod.catnip.lang.Components;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.nbt.ListTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.world.item.ItemStack;
public class SequencedGearshiftScreen extends AbstractSimiScreen {
@ -169,7 +169,7 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen {
if (def.hasValueParameter) {
String text = def.formatValue(instruction.value);
int stringWidth = font.width(text);
label(graphics, 90 + (12 - stringWidth / 2), yOffset - 1, Components.literal(text));
label(graphics, 90 + (12 - stringWidth / 2), yOffset - 1, Component.literal(text));
}
if (def.hasSpeedParameter)
label(graphics, 127, yOffset - 1, instruction.speedModifier.label);

View file

@ -11,7 +11,6 @@ import com.simibubi.create.content.trains.schedule.DestinationSuggestions;
import com.simibubi.create.foundation.gui.widget.ScrollInput;
import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.lang.Components;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font;
@ -27,7 +26,7 @@ public class AddressEditBox extends EditBox {
private Consumer<String> mainResponder;
public AddressEditBox(Screen screen, Font pFont, int pX, int pY, int pWidth, int pHeight, boolean anchorToBottom) {
super(pFont, pX, pY, pWidth, pHeight, Components.empty());
super(pFont, pX, pY, pWidth, pHeight, Component.empty());
destinationSuggestions = AddressEditBoxHelper.createSuggestions(screen, this, anchorToBottom);
destinationSuggestions.setAllowSuggestions(true);
destinationSuggestions.updateCommandInfo();
@ -73,12 +72,12 @@ public class AddressEditBox extends EditBox {
return true;
return false;
}
@Override
public void setValue(String text) {
super.setValue(text);
}
@Override
public void setFocused(boolean focused) {
super.setFocused(focused);

View file

@ -13,7 +13,6 @@ import com.simibubi.create.content.logistics.stockTicker.PackageOrder;
import net.createmod.catnip.data.Glob;
import net.createmod.catnip.math.VecHelper;
import net.createmod.catnip.lang.Components;
import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
@ -201,20 +200,21 @@ public class PackageItem extends Item {
CompoundTag compoundnbt = pStack.getOrCreateTag();
if (compoundnbt.contains("Address", Tag.TAG_STRING) && !compoundnbt.getString("Address")
.isBlank())
pTooltipComponents.add(Components.literal("\u2192 " + compoundnbt.getString("Address"))
.withStyle(ChatFormatting.GOLD));
.isBlank()) {
pTooltipComponents.add(Component.literal("\u2192 " + compoundnbt.getString("Address"))
.withStyle(ChatFormatting.GOLD));
}
/*
* Debug Fragmentation Data if (compoundnbt.contains("Fragment")) { CompoundTag
* fragTag = compoundnbt.getCompound("Fragment");
* pTooltipComponents.add(Components.literal("Order Information (Temporary)")
* pTooltipComponents.add(Component.literal("Order Information (Temporary)")
* .withStyle(ChatFormatting.GREEN)); pTooltipComponents.add(Components
* .literal(" Link " + fragTag.getInt("LinkIndex") +
* (fragTag.getBoolean("IsFinalLink") ? " Final" : "") + " | Fragment " +
* fragTag.getInt("Index") + (fragTag.getBoolean("IsFinal") ? " Final" : ""))
* .withStyle(ChatFormatting.DARK_GREEN)); if (fragTag.contains("OrderContext"))
* pTooltipComponents.add(Components.literal("Has Context!")
* pTooltipComponents.add(Component.literal("Has Context!")
* .withStyle(ChatFormatting.DARK_GREEN)); }
*/
@ -242,7 +242,7 @@ public class PackageItem extends Item {
}
if (skippedNames > 0)
pTooltipComponents.add(Components.translatable("container.shulkerBox.more", skippedNames)
pTooltipComponents.add(Component.translatable("container.shulkerBox.more", skippedNames)
.withStyle(ChatFormatting.ITALIC));
}

View file

@ -31,7 +31,6 @@ import com.simibubi.create.infrastructure.config.AllConfigs;
import net.createmod.catnip.data.Iterate;
import net.createmod.catnip.math.VecHelper;
import net.createmod.catnip.animation.LerpedFloat;
import net.createmod.catnip.lang.Components;
import net.minecraft.ChatFormatting;
import net.minecraft.MethodsReturnNonnullByDefault;
import net.minecraft.core.BlockPos;
@ -740,10 +739,10 @@ public class ChuteBlockEntity extends SmartBlockEntity implements IHaveGoggleInf
.style(ChatFormatting.YELLOW)
.forGoggles(tooltip);
if (!item.isEmpty())
CreateLang.translate("tooltip.chute.contains", Components.translatable(item.getDescriptionId())
.getString(), item.getCount())
.style(ChatFormatting.GREEN)
.forGoggles(tooltip);
CreateLang.translate("tooltip.chute.contains", Component.translatable(item.getDescriptionId())
.getString(), item.getCount())
.style(ChatFormatting.GREEN)
.forGoggles(tooltip);
return true;
}

View file

@ -13,6 +13,7 @@ import java.util.UUID;
import javax.annotation.Nullable;
import net.minecraft.network.chat.Component;
import org.joml.Math;
import com.google.common.collect.HashMultimap;
@ -47,7 +48,6 @@ import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.animation.LerpedFloat;
import net.createmod.catnip.animation.LerpedFloat.Chaser;
import net.createmod.catnip.gui.ScreenOpener;
import net.createmod.catnip.lang.Components;
import net.createmod.catnip.nbt.NBTHelper;
import net.minecraft.ChatFormatting;
import net.minecraft.client.player.LocalPlayer;
@ -156,7 +156,7 @@ public class FactoryPanelBehaviour extends FilteringBehaviour {
return null;
return behaviour;
}
@Nullable
public static FactoryPanelSupportBehaviour linkAt(BlockAndTintGetter world, FactoryPanelConnection connection) {
Object cached = connection.cachedSource.get();
@ -177,7 +177,7 @@ public class FactoryPanelBehaviour extends FilteringBehaviour {
public void moveTo(FactoryPanelPosition newPos, ServerPlayer player) {
Level level = getWorld();
BlockState existingState = level.getBlockState(newPos.pos());
// Check if target pos is valid
if (FactoryPanelBehaviour.at(level, newPos) != null)
return;
@ -188,7 +188,7 @@ public class FactoryPanelBehaviour extends FilteringBehaviour {
return;
if (!isAddedToOtherGauge)
level.setBlock(newPos.pos(), blockEntity.getBlockState(), 3);
for (BlockPos blockPos : targetedByLinks.keySet())
if (!blockPos.closerThan(newPos.pos(), 24))
return;
@ -198,18 +198,18 @@ public class FactoryPanelBehaviour extends FilteringBehaviour {
for (FactoryPanelPosition blockPos : targeting)
if (!blockPos.pos().closerThan(newPos.pos(), 24))
return;
// Disconnect links
for (BlockPos pos : targetedByLinks.keySet()) {
FactoryPanelSupportBehaviour at = linkAt(level, new FactoryPanelPosition(pos, slot));
if (at != null)
at.disconnect(this);
}
SmartBlockEntity oldBE = blockEntity;
FactoryPanelPosition oldPos = getPanelPosition();
slot = newPos.slot();
// Add to new BE
if (level.getBlockEntity(newPos.pos()) instanceof FactoryPanelBlockEntity fpbe) {
fpbe.attachBehaviourLate(this);
@ -218,7 +218,7 @@ public class FactoryPanelBehaviour extends FilteringBehaviour {
fpbe.lastShape = null;
fpbe.notifyUpdate();
}
// Remove from old BE
if (oldBE instanceof FactoryPanelBlockEntity fpbe) {
FactoryPanelBehaviour newBehaviour = new FactoryPanelBehaviour(fpbe, oldPos.slot());
@ -228,7 +228,7 @@ public class FactoryPanelBehaviour extends FilteringBehaviour {
fpbe.lastShape = null;
fpbe.notifyUpdate();
}
// Rewire connections
for (FactoryPanelPosition position : targeting) {
FactoryPanelBehaviour at = at(level, position);
@ -239,7 +239,7 @@ public class FactoryPanelBehaviour extends FilteringBehaviour {
at.blockEntity.sendData();
}
}
for (FactoryPanelPosition position : targetedBy.keySet()) {
FactoryPanelBehaviour at = at(level, position);
if (at != null) {
@ -247,14 +247,14 @@ public class FactoryPanelBehaviour extends FilteringBehaviour {
at.targeting.add(newPos);
}
}
// Reconnect links
for (BlockPos pos : targetedByLinks.keySet()) {
FactoryPanelSupportBehaviour at = linkAt(level, new FactoryPanelPosition(pos, slot));
if (at != null)
at.connect(this);
}
// Tell player
player.displayClientMessage(CreateLang.translate("factory_panel.relocated")
.style(ChatFormatting.GREEN)
@ -262,7 +262,7 @@ public class FactoryPanelBehaviour extends FilteringBehaviour {
player.level()
.playSound(null, newPos.pos(), SoundEvents.COPPER_BREAK, SoundSource.BLOCKS, 1.0f, 1.0f);
}
@Override
public void initialize() {
super.initialize();
@ -810,8 +810,11 @@ public class FactoryPanelBehaviour extends FilteringBehaviour {
@Override
public MutableComponent formatValue(ValueSettings value) {
return value.value() == 0 ? CreateLang.translateDirect("gui.factory_panel.inactive")
: Components.literal(Math.max(0, value.value()) + ((value.row() == 0) ? "" : "\u25A4"));
if (value.value() == 0) {
return CreateLang.translateDirect("gui.factory_panel.inactive");
} else {
return Component.literal(Math.max(0, value.value()) + ((value.row() == 0) ? "" : "\u25A4"));
}
}
@Override
@ -905,9 +908,10 @@ public class FactoryPanelBehaviour extends FilteringBehaviour {
@Override
public MutableComponent getCountLabelForValueBox() {
if (filter.isEmpty())
return Components.empty();
if (waitingForNetwork)
return Components.literal("?");
return Component.empty();
if (waitingForNetwork) {
return Component.literal("?");
}
int levelInStorage = getLevelInStorage();
boolean inf = levelInStorage >= BigItemStack.INF;
@ -971,17 +975,17 @@ public class FactoryPanelBehaviour extends FilteringBehaviour {
return isActive() ? new ItemRequirement(ItemRequirement.ItemUseType.CONSUME, AllBlocks.FACTORY_GAUGE.asItem())
: ItemRequirement.NONE;
}
@Override
public boolean canShortInteract(ItemStack toApply) {
return true;
}
@Override
public boolean readFromClipboard(CompoundTag tag, Player player, Direction side, boolean simulate) {
return false;
}
@Override
public boolean writeToClipboard(CompoundTag tag, Direction side) {
return false;

View file

@ -8,12 +8,12 @@ import com.simibubi.create.AllMenuTypes;
import com.simibubi.create.content.logistics.item.filter.attribute.ItemAttribute;
import net.createmod.catnip.data.Pair;
import net.createmod.catnip.lang.Components;
import net.minecraft.ChatFormatting;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.Tag;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.ClickType;
@ -54,7 +54,7 @@ public class AttributeFilterMenu extends AbstractFilterMenu {
super.init(inv, contentHolder);
ItemStack stack = new ItemStack(Items.NAME_TAG);
stack.setHoverName(
Components.literal("Selected Tags").withStyle(ChatFormatting.RESET, ChatFormatting.BLUE));
Component.literal("Selected Tags").withStyle(ChatFormatting.RESET, ChatFormatting.BLUE));
ghostInventory.setStackInSlot(1, stack);
}

View file

@ -21,7 +21,7 @@ import com.simibubi.create.foundation.gui.widget.SelectionScrollInput;
import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.data.Pair;
import net.createmod.catnip.lang.Components;
import net.createmod.catnip.lang.Lang;
import net.minecraft.ChatFormatting;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.nbt.CompoundTag;
@ -90,9 +90,9 @@ public class AttributeFilterScreen extends AbstractFilterScreen<AttributeFilterM
});
blacklist.setToolTip(denyN);
whitelistDisIndicator = new Indicator(x + 47, y + 55, Components.immutableEmpty());
whitelistConIndicator = new Indicator(x + 65, y + 55, Components.immutableEmpty());
blacklistIndicator = new Indicator(x + 83, y + 55, Components.immutableEmpty());
whitelistDisIndicator = new Indicator(x + 47, y + 55, Lang.IMMUTABLE_EMPTY);
whitelistConIndicator = new Indicator(x + 65, y + 55, Lang.IMMUTABLE_EMPTY);
blacklistIndicator = new Indicator(x + 83, y + 55, Lang.IMMUTABLE_EMPTY);
addRenderableWidgets(blacklist, whitelistCon, whitelistDis, blacklistIndicator, whitelistConIndicator,
whitelistDisIndicator);
@ -110,10 +110,10 @@ public class AttributeFilterScreen extends AbstractFilterScreen<AttributeFilterM
handleIndicators();
attributeSelectorLabel = new Label(x + 43, y + 28, Components.immutableEmpty()).colored(0xF3EBDE)
attributeSelectorLabel = new Label(x + 43, y + 28, Lang.IMMUTABLE_EMPTY).colored(0xF3EBDE)
.withShadow();
attributeSelector = new SelectionScrollInput(x + 39, y + 23, 137, 18);
attributeSelector.forOptions(Arrays.asList(Components.immutableEmpty()));
attributeSelector.forOptions(Arrays.asList(Lang.IMMUTABLE_EMPTY));
attributeSelector.removeCallback();
referenceItemChanged(menu.ghostInventory.getStackInSlot(0));
@ -123,10 +123,12 @@ public class AttributeFilterScreen extends AbstractFilterScreen<AttributeFilterM
selectedAttributes.clear();
selectedAttributes.add((menu.selectedAttributes.isEmpty() ? noSelectedT : selectedT).plainCopy()
.withStyle(ChatFormatting.YELLOW));
menu.selectedAttributes.forEach(at -> selectedAttributes.add(Components.literal("- ")
.append(at.getFirst()
.format(at.getSecond()))
.withStyle(ChatFormatting.GRAY)));
menu.selectedAttributes.forEach(at -> {
selectedAttributes.add(Component.literal("- ")
.append(at.getFirst()
.format(at.getSecond()))
.withStyle(ChatFormatting.GRAY));
});
}
private void referenceItemChanged(ItemStack stack) {
@ -240,7 +242,7 @@ public class AttributeFilterScreen extends AbstractFilterScreen<AttributeFilterM
if (menu.selectedAttributes.size() == 1)
selectedAttributes.set(0, selectedT.plainCopy()
.withStyle(ChatFormatting.YELLOW));
selectedAttributes.add(Components.literal("- ").append(itemAttribute.format(inverted))
selectedAttributes.add(Component.literal("- ").append(itemAttribute.format(inverted))
.withStyle(ChatFormatting.GRAY));
return true;
}

View file

@ -7,6 +7,7 @@ import java.util.Objects;
import javax.annotation.Nonnull;
import net.minecraft.network.chat.MutableComponent;
import org.jetbrains.annotations.NotNull;
import com.simibubi.create.AllItems;
@ -17,7 +18,6 @@ import com.simibubi.create.content.logistics.item.filter.attribute.ItemAttribute
import com.simibubi.create.foundation.item.ItemHelper;
import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.lang.Components;
import net.minecraft.ChatFormatting;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
@ -83,7 +83,7 @@ public class FilterItem extends Item implements MenuProvider {
List<Component> makeSummary = makeSummary(stack);
if (makeSummary.isEmpty())
return;
tooltip.add(Components.literal(" "));
tooltip.add(Component.literal(" "));
tooltip.addAll(makeSummary);
}
@ -102,7 +102,7 @@ public class FilterItem extends Item implements MenuProvider {
int count = 0;
for (int i = 0; i < filterItems.getSlots(); i++) {
if (count > 3) {
list.add(Components.literal("- ...")
list.add(Component.literal("- ...")
.withStyle(ChatFormatting.DARK_GRAY));
break;
}
@ -110,7 +110,7 @@ public class FilterItem extends Item implements MenuProvider {
ItemStack filterStack = filterItems.getStackInSlot(i);
if (filterStack.isEmpty())
continue;
list.add(Components.literal("- ")
list.add(Component.literal("- ")
.append(filterStack.getHoverName())
.withStyle(ChatFormatting.GRAY));
count++;
@ -139,11 +139,11 @@ public class FilterItem extends Item implements MenuProvider {
continue;
boolean inverted = compound.getBoolean("Inverted");
if (count > 3) {
list.add(Components.literal("- ...")
list.add(Component.literal("- ...")
.withStyle(ChatFormatting.DARK_GRAY));
break;
}
list.add(Components.literal("- ")
list.add(Component.literal("- ")
.append(attribute.format(inverted)));
count++;
}

View file

@ -10,7 +10,7 @@ import com.simibubi.create.foundation.gui.widget.IconButton;
import com.simibubi.create.foundation.gui.widget.Indicator;
import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.lang.Components;
import net.createmod.catnip.lang.Lang;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.world.entity.player.Inventory;
@ -58,8 +58,8 @@ public class FilterScreen extends AbstractFilterScreen<FilterMenu> {
sendOptionUpdate(Option.WHITELIST);
});
whitelist.setToolTip(allowN);
blacklistIndicator = new Indicator(x + 18, y + 69, Components.immutableEmpty());
whitelistIndicator = new Indicator(x + 36, y + 69, Components.immutableEmpty());
blacklistIndicator = new Indicator(x + 18, y + 69, Lang.IMMUTABLE_EMPTY);
whitelistIndicator = new Indicator(x + 36, y + 69, Lang.IMMUTABLE_EMPTY);
addRenderableWidgets(blacklist, whitelist, blacklistIndicator, whitelistIndicator);
respectNBT = new IconButton(x + 60, y + 75, AllIcons.I_RESPECT_NBT);
@ -74,8 +74,8 @@ public class FilterScreen extends AbstractFilterScreen<FilterMenu> {
sendOptionUpdate(Option.IGNORE_DATA);
});
ignoreNBT.setToolTip(ignoreDataN);
respectNBTIndicator = new Indicator(x + 60, y + 69, Components.immutableEmpty());
ignoreNBTIndicator = new Indicator(x + 78, y + 69, Components.immutableEmpty());
respectNBTIndicator = new Indicator(x + 60, y + 69, Lang.IMMUTABLE_EMPTY);
ignoreNBTIndicator = new Indicator(x + 78, y + 69, Lang.IMMUTABLE_EMPTY);
addRenderableWidgets(respectNBT, ignoreNBT, respectNBTIndicator, ignoreNBTIndicator);
handleIndicators();

View file

@ -4,7 +4,8 @@ import java.util.ArrayList;
import java.util.List;
import net.createmod.catnip.nbt.NBTHelper;
import net.createmod.catnip.lang.Components;
import net.minecraft.network.chat.Component;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -42,7 +43,7 @@ public class EnchantAttribute implements ItemAttribute {
public Object[] getTranslationParameters() {
String parameter = "";
if (enchantment != null)
parameter = Components.translatable(enchantment.getDescriptionId()).getString();
parameter = Component.translatable(enchantment.getDescriptionId()).getString();
return new Object[]{parameter};
}

View file

@ -5,7 +5,7 @@ import java.util.List;
import com.simibubi.create.content.logistics.item.filter.attribute.AllItemAttributeTypes;
import net.createmod.catnip.lang.Components;
import net.minecraft.network.chat.Component;
import org.jetbrains.annotations.NotNull;
@ -55,7 +55,7 @@ public class AstralSorceryAmuletAttribute implements ItemAttribute {
Enchantment enchant = ForgeRegistries.ENCHANTMENTS.getValue(ResourceLocation.tryParse(enchName));
if (enchant != null) {
something = Components.translatable(enchant.getDescriptionId()).getString();
something = Component.translatable(enchant.getDescriptionId()).getString();
}
if (enchType == 1) something = "existing " + something;

View file

@ -3,7 +3,7 @@ package com.simibubi.create.content.logistics.item.filter.attribute.attributes.a
import java.util.ArrayList;
import java.util.List;
import net.createmod.catnip.lang.Components;
import net.minecraft.network.chat.Component;
import org.jetbrains.annotations.NotNull;
@ -50,7 +50,7 @@ public class AstralSorceryAttunementAttribute implements ItemAttribute {
@Override
public Object[] getTranslationParameters() {
ResourceLocation constResource = new ResourceLocation(constellationName);
String something = Components.translatable(String.format("%s.constellation.%s", constResource.getNamespace(), constResource.getPath())).getString();
String something = Component.translatable(String.format("%s.constellation.%s", constResource.getNamespace(), constResource.getPath())).getString();
return new Object[]{something};
}

View file

@ -3,7 +3,7 @@ package com.simibubi.create.content.logistics.item.filter.attribute.attributes.a
import java.util.ArrayList;
import java.util.List;
import net.createmod.catnip.lang.Components;
import net.minecraft.network.chat.Component;
import org.jetbrains.annotations.NotNull;
@ -46,7 +46,7 @@ public class AstralSorceryCrystalAttribute implements ItemAttribute {
@Override
public Object[] getTranslationParameters() {
ResourceLocation traitResource = new ResourceLocation(traitName);
String something = Components.translatable(String.format("crystal.property.%s.%s.name", traitResource.getNamespace(), traitResource.getPath())).getString();
String something = Component.translatable(String.format("crystal.property.%s.%s.name", traitResource.getNamespace(), traitResource.getPath())).getString();
return new Object[]{something};
}

View file

@ -3,7 +3,7 @@ package com.simibubi.create.content.logistics.item.filter.attribute.attributes.a
import java.util.ArrayList;
import java.util.List;
import net.createmod.catnip.lang.Components;
import net.minecraft.network.chat.Component;
import org.jetbrains.annotations.NotNull;
@ -46,7 +46,7 @@ public class AstralSorceryPerkGemAttribute implements ItemAttribute {
@Override
public Object[] getTranslationParameters() {
ResourceLocation traitResource = new ResourceLocation(traitName);
String something = Components.translatable(String.format("perk.attribute.%s.%s.name", traitResource.getNamespace(), traitResource.getPath())).getString();
String something = Component.translatable(String.format("perk.attribute.%s.%s.name", traitResource.getNamespace(), traitResource.getPath())).getString();
return new Object[]{something};
}

View file

@ -3,6 +3,8 @@ package com.simibubi.create.content.logistics.packagePort;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.network.chat.MutableComponent;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -15,7 +17,6 @@ import com.simibubi.create.foundation.blockEntity.behaviour.animatedContainer.An
import com.simibubi.create.foundation.item.SmartInventory;
import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.lang.Components;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
@ -193,7 +194,7 @@ public abstract class PackagePortBlockEntity extends SmartBlockEntity implements
list.add(page);
}
page.add(new ClipboardEntry(false, Components.literal("#" + addressFilter)));
page.add(new ClipboardEntry(false, Component.literal("#" + addressFilter)));
player.displayClientMessage(CreateLang.translate("clipboard.address_added", addressFilter)
.component(), true);
@ -204,8 +205,8 @@ public abstract class PackagePortBlockEntity extends SmartBlockEntity implements
@Override
public Component getDisplayName() {
return Components.empty();
}
return Component.empty();
}
@Override
public AbstractContainerMenu createMenu(int pContainerId, Inventory pPlayerInventory, Player pPlayer) {

View file

@ -17,7 +17,6 @@ import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.gui.element.GuiGameElement;
import net.createmod.catnip.gui.widget.AbstractSimiWidget;
import net.createmod.catnip.lang.Components;
import net.minecraft.ChatFormatting;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.EditBox;
@ -60,8 +59,8 @@ public class PackagePortScreen extends AbstractSimiContainerScreen<PackagePortMe
Consumer<String> onTextChanged;
onTextChanged = s -> addressBox.setX(nameBoxX(s, addressBox));
addressBox = new EditBox(new NoShadowFontWrapper(font), x + 23, y - 11, background.getWidth() - 20, 10,
Components.empty());
addressBox = new EditBox(new NoShadowFontWrapper(font), x + 23, y - 11, background.getWidth() - 20, 10,
Component.empty());
addressBox.setBordered(false);
addressBox.setMaxLength(25);
addressBox.setTextColor(0x3D3C48);

View file

@ -7,10 +7,10 @@ import com.simibubi.create.foundation.blockEntity.renderer.SmartBlockEntityRende
import dev.engine_room.flywheel.api.visualization.VisualizationManager;
import net.createmod.catnip.render.CachedBuffers;
import net.createmod.catnip.render.SuperByteBuffer;
import net.createmod.catnip.lang.Components;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider.Context;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
import net.minecraft.world.phys.Vec3;
@ -40,8 +40,9 @@ public class FrogportRenderer extends SmartBlockEntityRenderer<FrogportBlockEnti
Vec3 diff = Vec3.ZERO;
if (blockEntity.addressFilter != null && !blockEntity.addressFilter.isBlank())
renderNameplateOnHover(blockEntity, Components.literal(blockEntity.addressFilter), 1, ms, buffer, light);
if (blockEntity.addressFilter != null && !blockEntity.addressFilter.isBlank()) {
renderNameplateOnHover(blockEntity, Component.literal(blockEntity.addressFilter), 1, ms, buffer, light);
}
if (VisualizationManager.supportsVisualization(blockEntity.getLevel())) {
return;

View file

@ -8,10 +8,10 @@ import com.simibubi.create.foundation.blockEntity.renderer.SmartBlockEntityRende
import dev.engine_room.flywheel.lib.transform.Transform;
import net.createmod.catnip.render.CachedBuffers;
import net.createmod.catnip.render.SuperByteBuffer;
import net.createmod.catnip.lang.Components;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider.Context;
import net.minecraft.network.chat.Component;
import net.minecraft.util.Mth;
public class PostboxRenderer extends SmartBlockEntityRenderer<PostboxBlockEntity> {
@ -24,8 +24,9 @@ public class PostboxRenderer extends SmartBlockEntityRenderer<PostboxBlockEntity
protected void renderSafe(PostboxBlockEntity blockEntity, float partialTicks, PoseStack ms,
MultiBufferSource buffer, int light, int overlay) {
if (blockEntity.addressFilter != null && !blockEntity.addressFilter.isBlank())
renderNameplateOnHover(blockEntity, Components.literal(blockEntity.addressFilter), 1, ms, buffer, light);
if (blockEntity.addressFilter != null && !blockEntity.addressFilter.isBlank()) {
renderNameplateOnHover(blockEntity, Component.literal(blockEntity.addressFilter), 1, ms, buffer, light);
}
SuperByteBuffer sbb = CachedBuffers.partial(AllPartialModels.POSTBOX_FLAG, blockEntity.getBlockState());

View file

@ -9,7 +9,6 @@ import com.simibubi.create.content.logistics.packagerLink.WiFiParticle;
import com.simibubi.create.content.logistics.stockTicker.PackageOrder;
import com.simibubi.create.content.logistics.stockTicker.StockCheckingBlockEntity;
import net.createmod.catnip.lang.Components;
import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.nbt.CompoundTag;
@ -126,8 +125,8 @@ public class RedstoneRequesterBlockEntity extends StockCheckingBlockEntity imple
@Override
public Component getDisplayName() {
return Components.empty();
}
return Component.empty();
}
@Override
public AbstractContainerMenu createMenu(int pContainerId, Inventory pPlayerInventory, Player pPlayer) {

View file

@ -7,6 +7,8 @@ import java.util.Optional;
import javax.annotation.Nullable;
import net.minecraft.network.chat.MutableComponent;
import org.lwjgl.glfw.GLFW;
import com.google.common.collect.ImmutableList;
@ -27,7 +29,6 @@ import net.createmod.catnip.gui.UIRenderHelper;
import net.createmod.catnip.gui.element.GuiGameElement;
import net.createmod.catnip.animation.LerpedFloat;
import net.createmod.catnip.animation.LerpedFloat.Chaser;
import net.createmod.catnip.lang.Components;
import net.minecraft.ChatFormatting;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.GuiGraphics;
@ -91,7 +92,7 @@ public class StockKeeperCategoryScreen extends AbstractSimiContainerScreen<Stock
editorConfirm = new IconButton(leftPos + 36 + 131, topPos + 59, AllIcons.I_CONFIRM);
menu.slotsActive = true;
editorEditBox = new EditBox(font, leftPos + 47, topPos + 28, 124, 10, Components.empty());
editorEditBox = new EditBox(font, leftPos + 47, topPos + 28, 124, 10, Component.empty());
editorEditBox.setTextColor(0xffeeeeee);
editorEditBox.setBordered(false);
editorEditBox.setFocused(false);
@ -126,8 +127,9 @@ public class StockKeeperCategoryScreen extends AbstractSimiContainerScreen<Stock
ItemStack stackInSlot = menu.proxyInventory.getStackInSlot(0)
.copy();
if (!stackInSlot.isEmpty())
stackInSlot.setHoverName(Components.literal(editorEditBox.getValue()));
if (!stackInSlot.isEmpty()) {
stackInSlot.setHoverName(Component.literal(editorEditBox.getValue()));
}
if (editingIndex == -1)
schedule.add(stackInSlot);

View file

@ -48,7 +48,6 @@ import net.createmod.catnip.data.Iterate;
import net.createmod.catnip.data.Pair;
import net.createmod.catnip.gui.UIRenderHelper;
import net.createmod.catnip.gui.element.GuiGameElement;
import net.createmod.catnip.lang.Components;
import net.createmod.catnip.math.AngleHelper;
import net.createmod.catnip.render.CachedBuffers;
import net.createmod.catnip.theme.Color;
@ -559,9 +558,10 @@ public class StockKeeperRequestScreen extends AbstractSimiContainerScreen<StockK
ms.popPose();
}
if (itemsToOrder.size() > 8)
graphics.drawString(font, Components.literal("[+" + (itemsToOrder.size() - 8) + "]"), x + windowWidth - 40,
if (itemsToOrder.size() > 8) {
graphics.drawString(font, Component.literal("[+" + (itemsToOrder.size() - 8) + "]"), x + windowWidth - 40,
orderY + 21, 0xF8F8EC);
}
boolean justSent = itemsToOrder.isEmpty() && successTicks > 0;
if (isConfirmHovered(mouseX, mouseY) && !justSent)

View file

@ -28,7 +28,6 @@ import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.data.Iterate;
import net.createmod.catnip.nbt.NBTHelper;
import net.createmod.catnip.lang.Components;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.core.BlockPos;
@ -226,7 +225,7 @@ public class StockTickerBlockEntity extends StockCheckingBlockEntity implements
summary.add(receivedPayments.getStackInSlot(i));
for (BigItemStack entry : summary.getStacksByCount())
CreateLang.builder()
.text(Components.translatable(entry.stack.getDescriptionId())
.text(Component.translatable(entry.stack.getDescriptionId())
.getString() + " x" + entry.count)
.style(ChatFormatting.GREEN)
.forGoggles(tooltip);
@ -259,7 +258,7 @@ public class StockTickerBlockEntity extends StockCheckingBlockEntity implements
capability.invalidate();
super.invalidate();
}
public void playEffect() {
AllSoundEvents.STOCK_LINK.playAt(level, worldPosition, 1.0f, 1.0f, false);
Vec3 vec3 = Vec3.atCenterOf(worldPosition);
@ -275,8 +274,8 @@ public class StockTickerBlockEntity extends StockCheckingBlockEntity implements
@Override
public Component getDisplayName() {
return Components.empty();
}
return Component.empty();
}
}
@ -289,8 +288,8 @@ public class StockTickerBlockEntity extends StockCheckingBlockEntity implements
@Override
public Component getDisplayName() {
return Components.empty();
}
return Component.empty();
}
}

View file

@ -12,7 +12,6 @@ import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.data.Couple;
import net.createmod.catnip.data.IntAttached;
import net.createmod.catnip.nbt.NBTHelper;
import net.createmod.catnip.lang.Components;
import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
@ -127,7 +126,7 @@ public class ShoppingListItem extends Item {
boolean cost = items == lists.getSecond();
if (cost)
pTooltipComponents.add(Components.empty());
pTooltipComponents.add(Component.empty());
if (entries.size() == 1) {
BigItemStack entry = entries.get(0);

View file

@ -6,8 +6,8 @@ import com.simibubi.create.foundation.blockEntity.behaviour.ValueSettingsFormatt
import com.simibubi.create.foundation.blockEntity.behaviour.filtering.FilteringBehaviour;
import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.lang.Components;
import net.minecraft.core.Direction;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.player.Player;
@ -81,12 +81,12 @@ public class TableClothFilteringBehaviour extends FilteringBehaviour {
}
public MutableComponent formatValue(ValueSettings value) {
return Components.literal(String.valueOf(Math.max(1, value.value())));
return Component.literal(String.valueOf(Math.max(1, value.value())));
}
@Override
public MutableComponent getCountLabelForValueBox() {
return Components.literal(isCountVisible() ? String.valueOf(count) : "");
return Component.literal(isCountVisible() ? String.valueOf(count) : "");
}
@Override

View file

@ -34,7 +34,6 @@ import com.simibubi.create.infrastructure.config.AllConfigs;
import net.createmod.catnip.data.Couple;
import net.createmod.catnip.data.Iterate;
import net.createmod.catnip.nbt.NBTHelper;
import net.createmod.catnip.lang.Components;
import net.createmod.catnip.lang.Lang;
import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos;
@ -795,8 +794,8 @@ public class BrassTunnelBlockEntity extends BeltTunnelBlockEntity implements IHa
CreateLang.translate("tooltip.brass_tunnel.contains").style(ChatFormatting.WHITE).forGoggles(tooltip);
for (ItemStack item : allStacks) {
CreateLang.translate("tooltip.brass_tunnel.contains_entry",
Components.translatable(item.getDescriptionId()).getString(), item.getCount())
CreateLang.translate("tooltip.brass_tunnel.contains_entry",
Component.translatable(item.getDescriptionId()).getString(), item.getCount())
.style(ChatFormatting.GRAY).forGoggles(tooltip);
}
CreateLang.translate("tooltip.brass_tunnel.retrieve").style(ChatFormatting.DARK_GRAY).forGoggles(tooltip);

View file

@ -39,7 +39,6 @@ import net.createmod.catnip.nbt.NBTHelper;
import net.createmod.catnip.math.VecHelper;
import net.createmod.catnip.animation.LerpedFloat;
import net.createmod.catnip.animation.LerpedFloat.Chaser;
import net.createmod.catnip.lang.Components;
import net.createmod.catnip.lang.LangBuilder;
import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos;
@ -753,8 +752,8 @@ public class BasinBlockEntity extends SmartBlockEntity implements IHaveGoggleInf
ItemStack stackInSlot = items.getStackInSlot(i);
if (stackInSlot.isEmpty())
continue;
CreateLang.text("")
.add(Components.translatable(stackInSlot.getDescriptionId())
CreateLang.text("")
.add(Component.translatable(stackInSlot.getDescriptionId())
.withStyle(ChatFormatting.GRAY))
.add(CreateLang.text(" x" + stackInSlot.getCount())
.style(ChatFormatting.GREEN))

View file

@ -16,12 +16,13 @@ import com.simibubi.create.foundation.fluid.FluidIngredient;
import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.data.Pair;
import net.createmod.catnip.lang.Components;
import net.createmod.catnip.lang.Lang;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.core.RegistryAccess;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.Container;
import net.minecraft.world.item.ItemStack;
@ -249,7 +250,7 @@ public class SequencedAssemblyRecipe implements Recipe<RecipeWrapper> {
int step = sequencedAssemblyRecipe.getStep(stack);
int total = length * sequencedAssemblyRecipe.loops;
List<Component> tooltip = event.getToolTip();
tooltip.add(Components.immutableEmpty());
tooltip.add(Lang.IMMUTABLE_EMPTY);
tooltip.add(CreateLang.translateDirect("recipe.sequenced_assembly")
.withStyle(ChatFormatting.GRAY));
tooltip.add(CreateLang.translateDirect("recipe.assembly.progress", step, total)
@ -265,9 +266,10 @@ public class SequencedAssemblyRecipe implements Recipe<RecipeWrapper> {
if (i == 0)
tooltip.add(CreateLang.translateDirect("recipe.assembly.next", textComponent)
.withStyle(ChatFormatting.AQUA));
else
tooltip.add(Components.literal("-> ").append(textComponent)
.withStyle(ChatFormatting.DARK_AQUA));
else {
tooltip.add(Component.literal("-> ").append(textComponent)
.withStyle(ChatFormatting.DARK_AQUA));
}
}
}

View file

@ -7,7 +7,6 @@ import com.simibubi.create.foundation.blockEntity.behaviour.ValueSettingsFormatt
import com.simibubi.create.foundation.blockEntity.behaviour.scrollValue.ScrollValueBehaviour;
import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.lang.Components;
import net.minecraft.core.Direction;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
@ -69,7 +68,7 @@ public class BrassDiodeScrollValueBehaviour extends ScrollValueBehaviour {
public MutableComponent formatSettings(ValueSettings settings) {
int value = Math.max(1, settings.value());
return Components.literal(switch (settings.row()) {
return Component.literal(switch (settings.row()) {
case 0 -> Math.max(2, value) + "t";
case 1 -> "0:" + (value < 10 ? "0" : "") + value;
default -> value + ":00";

View file

@ -27,7 +27,7 @@ import net.createmod.catnip.gui.element.GuiGameElement;
import net.createmod.catnip.gui.widget.AbstractSimiWidget;
import net.createmod.catnip.gui.widget.ElementWidget;
import net.createmod.catnip.data.Couple;
import net.createmod.catnip.lang.Components;
import net.createmod.catnip.lang.Lang;
import net.createmod.ponder.foundation.ui.PonderTagScreen;
import net.minecraft.ChatFormatting;
import net.minecraft.client.gui.GuiGraphics;
@ -138,7 +138,7 @@ public class DisplayLinkScreen extends AbstractSimiScreen {
int rows = stats.maxRows();
int startIndex = Math.min(blockEntity.targetLine, rows);
targetLineLabel = new Label(x + 65, y + 109, Components.immutableEmpty()).withShadow();
targetLineLabel = new Label(x + 65, y + 109, Lang.IMMUTABLE_EMPTY).withShadow();
targetLineLabel.text = target.getLineOptionText(startIndex);
if (rows > 1) {
@ -190,7 +190,7 @@ public class DisplayLinkScreen extends AbstractSimiScreen {
if (!sources.isEmpty()) {
int startIndex = Math.max(sources.indexOf(blockEntity.activeSource), 0);
sourceTypeLabel = new Label(x + 65, y + 30, Components.immutableEmpty()).withShadow();
sourceTypeLabel = new Label(x + 65, y + 30, Lang.IMMUTABLE_EMPTY).withShadow();
sourceTypeLabel.text = sources.get(startIndex)
.getName();

View file

@ -5,14 +5,14 @@ import com.simibubi.create.content.redstone.displayLink.DisplayLinkBlockEntity;
import com.simibubi.create.content.redstone.displayLink.DisplayLinkContext;
import com.simibubi.create.content.redstone.displayLink.target.DisplayTargetStats;
import net.createmod.catnip.lang.Components;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
public class AccumulatedItemCountDisplaySource extends NumericSingleLineDisplaySource {
@Override
protected MutableComponent provideLine(DisplayLinkContext context, DisplayTargetStats stats) {
return Components.literal(String.valueOf(context.sourceConfig()
return Component.literal(String.valueOf(context.sourceConfig()
.getInt("Collected")));
}

View file

@ -14,8 +14,8 @@ import com.simibubi.create.content.trains.display.FlapDisplaySection;
import com.simibubi.create.foundation.utility.CreateLang;
import joptsimple.internal.Strings;
import net.createmod.catnip.lang.Components;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.LecternBlockEntity;
@ -50,8 +50,10 @@ public class BoilerDisplaySource extends DisplaySource {
return reduce.orElse(EMPTY_LINE);
});
return List.of(componentList.reduce((comp1, comp2) -> comp1.append(Components.literal("\n"))
.append(comp2))
return List.of(componentList.reduce((comp1, comp2) -> {
return comp1.append(Component.literal("\n"))
.append(comp2);
})
.orElse(EMPTY_LINE));
}
@ -128,9 +130,9 @@ public class BoilerDisplaySource extends DisplaySource {
int lw = labelWidth();
if (forFlapDisplay) {
size = Components.literal(Strings.repeat(' ', lw - labelWidthOf("size"))).append(size);
water = Components.literal(Strings.repeat(' ', lw - labelWidthOf("water"))).append(water);
heat = Components.literal(Strings.repeat(' ', lw - labelWidthOf("heat"))).append(heat);
size = Component.literal(Strings.repeat(' ', lw - labelWidthOf("size"))).append(size);
water = Component.literal(Strings.repeat(' ', lw - labelWidthOf("water"))).append(water);
heat = Component.literal(Strings.repeat(' ', lw - labelWidthOf("heat"))).append(heat);
}
return Stream.of(List.of(CreateLang.translateDirect(label, boiler.getHeatLevelTextComponent())),
@ -150,7 +152,7 @@ public class BoilerDisplaySource extends DisplaySource {
private MutableComponent labelOf(String label) {
if (label.isBlank())
return Components.empty();
return Component.empty();
return CreateLang.translateDirect("boiler." + label);
}

View file

@ -6,9 +6,9 @@ import java.util.List;
import com.simibubi.create.content.redstone.displayLink.DisplayLinkContext;
import com.simibubi.create.content.redstone.displayLink.target.DisplayTargetStats;
import net.createmod.catnip.lang.Components;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.Tag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
public class ComputerDisplaySource extends DisplaySource {
@ -19,7 +19,7 @@ public class ComputerDisplaySource extends DisplaySource {
ListTag tag = context.sourceConfig().getList("ComputerSourceList", Tag.TAG_STRING);
for (int i = 0; i < tag.size(); i++) {
components.add(Components.literal(tag.getString(i)));
components.add(Component.literal(tag.getString(i)));
}
return components;

View file

@ -4,7 +4,7 @@ import com.simibubi.create.content.contraptions.elevator.ElevatorContactBlockEnt
import com.simibubi.create.content.redstone.displayLink.DisplayLinkContext;
import com.simibubi.create.content.redstone.displayLink.target.DisplayTargetStats;
import net.createmod.catnip.lang.Components;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
public class CurrentFloorDisplaySource extends SingleLineDisplaySource {
@ -13,7 +13,7 @@ public class CurrentFloorDisplaySource extends SingleLineDisplaySource {
protected MutableComponent provideLine(DisplayLinkContext context, DisplayTargetStats stats) {
if (!(context.getSourceBlockEntity() instanceof ElevatorContactBlockEntity ecbe))
return EMPTY_LINE;
return Components.literal(ecbe.lastReportedCurrentFloor);
return Component.literal(ecbe.lastReportedCurrentFloor);
}
@Override

View file

@ -14,7 +14,6 @@ import com.simibubi.create.content.trains.display.FlapDisplayLayout;
import com.simibubi.create.foundation.gui.ModularGuiLineBuilder;
import net.createmod.catnip.nbt.NBTProcessors;
import net.createmod.catnip.lang.Components;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraftforge.api.distmarker.Dist;
@ -22,9 +21,13 @@ import net.minecraftforge.api.distmarker.OnlyIn;
public abstract class DisplaySource extends DisplayBehaviour {
public static final List<MutableComponent> EMPTY = ImmutableList.of(Components.empty());
public static final MutableComponent EMPTY_LINE = Components.empty();
public static final MutableComponent WHITESPACE = Components.literal(" ");
public static final List<MutableComponent> EMPTY = ImmutableList.of(Component.empty());
public static final MutableComponent EMPTY_LINE = Component.empty();
public static final MutableComponent WHITESPACE;
static {
WHITESPACE = Component.literal(" ");
}
public abstract List<MutableComponent> provideText(DisplayLinkContext context, DisplayTargetStats stats);
@ -65,7 +68,7 @@ public abstract class DisplaySource extends DisplayBehaviour {
}
public Component getName() {
return Components.translatable(id.getNamespace() + ".display_source." + getTranslationKey());
return Component.translatable(id.getNamespace() + ".display_source." + getTranslationKey());
}
public void loadFlapDisplayLayout(DisplayLinkContext context, FlapDisplayBlockEntity flapDisplay, FlapDisplayLayout layout, int lineIndex) {

View file

@ -3,8 +3,8 @@ package com.simibubi.create.content.redstone.displayLink.source;
import com.simibubi.create.content.redstone.displayLink.DisplayLinkContext;
import com.simibubi.create.content.redstone.displayLink.target.DisplayTargetStats;
import net.createmod.catnip.lang.Components;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.util.RandomSource;
import net.minecraft.world.item.ItemStack;
@ -38,7 +38,7 @@ public class EnchantPowerDisplaySource extends NumericSingleLineDisplaySource {
int cost = EnchantmentHelper.getEnchantmentCost(random, 2, (int) enchantPower, stack);
return Components.literal(String.valueOf(cost));
return Component.literal(String.valueOf(cost));
}
@Override

View file

@ -11,8 +11,8 @@ import com.simibubi.create.content.logistics.factoryBoard.FactoryPanelPosition;
import com.simibubi.create.content.redstone.displayLink.DisplayLinkContext;
import net.createmod.catnip.data.IntAttached;
import net.createmod.catnip.lang.Components;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
@ -51,7 +51,7 @@ public class FactoryGaugeDisplaySource extends ValueListDisplaySource {
s = "\u25aa";
}
return IntAttached.with(panel.getLevelInStorage(), Components.literal(s + " ")
return IntAttached.with(panel.getLevelInStorage(), Component.literal(s + " ")
.withStyle(style -> style.withColor(panel.getIngredientStatusColor()))
.append(filter.getHoverName()
.plainCopy()

View file

@ -7,7 +7,7 @@ import com.simibubi.create.foundation.blockEntity.behaviour.filtering.FilteringB
import com.simibubi.create.foundation.blockEntity.behaviour.inventory.TankManipulationBehaviour;
import com.simibubi.create.foundation.utility.FluidFormatter;
import net.createmod.catnip.lang.Components;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraftforge.fluids.FluidStack;
@ -38,7 +38,7 @@ public class FluidAmountDisplaySource extends SingleLineDisplaySource {
collected += stack.getAmount();
}
return Components.literal(FluidFormatter.asString(collected, false));
return Component.literal(FluidFormatter.asString(collected, false));
}
@Override

View file

@ -6,6 +6,7 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Stream;
import net.minecraft.network.chat.Component;
import org.apache.commons.lang3.mutable.MutableInt;
import com.simibubi.create.content.redstone.displayLink.DisplayLinkContext;
@ -19,7 +20,6 @@ import com.simibubi.create.foundation.utility.FluidFormatter;
import net.createmod.catnip.data.Couple;
import net.createmod.catnip.data.IntAttached;
import net.createmod.catnip.lang.Components;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.material.Fluid;
@ -63,7 +63,7 @@ public class FluidListDisplaySource extends ValueListDisplaySource {
.limit(maxRows)
.map(entry -> IntAttached.with(
entry.getValue(),
Components.translatable(fluidNames.get(entry.getKey()).getTranslationKey()))
Component.translatable(fluidNames.get(entry.getKey()).getTranslationKey()))
);
}

View file

@ -6,7 +6,7 @@ import com.simibubi.create.content.redstone.smartObserver.SmartObserverBlockEnti
import com.simibubi.create.foundation.blockEntity.behaviour.filtering.FilteringBehaviour;
import com.simibubi.create.foundation.blockEntity.behaviour.inventory.InvManipulationBehaviour;
import net.createmod.catnip.lang.Components;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.entity.BlockEntity;
@ -37,7 +37,7 @@ public class ItemCountDisplaySource extends NumericSingleLineDisplaySource {
collected += stack.getCount();
}
return Components.literal(String.valueOf(collected));
return Component.literal(String.valueOf(collected));
}
@Override

View file

@ -3,14 +3,17 @@ package com.simibubi.create.content.redstone.displayLink.source;
import com.simibubi.create.content.redstone.displayLink.DisplayLinkContext;
import com.simibubi.create.content.trains.display.FlapDisplaySection;
import net.createmod.catnip.lang.Components;
import net.minecraft.network.chat.Component;
public abstract class NumericSingleLineDisplaySource extends SingleLineDisplaySource {
protected static final Component ZERO = Components.literal("0");
protected static final Component ZERO;
@Override
static {
ZERO = Component.literal("0");
}
@Override
protected String getFlapDisplayLayoutName(DisplayLinkContext context) {
return "Number";
}

View file

@ -9,7 +9,7 @@ import com.simibubi.create.content.redstone.displayLink.target.DisplayTargetStat
import com.simibubi.create.content.trains.display.FlapDisplayBlockEntity;
import com.simibubi.create.content.trains.display.FlapDisplaySection;
import net.createmod.catnip.lang.Components;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.util.Mth;
import net.minecraft.world.level.block.entity.SignBlockEntity;
@ -47,11 +47,11 @@ public abstract class PercentOrProgressBarDisplaySource extends NumericSingleLin
for (int i = 0; i < emptySpaces; i++)
s.append("\u2592");
return Components.literal(s.toString());
return Component.literal(s.toString());
}
protected MutableComponent formatNumeric(DisplayLinkContext context, Float currentLevel) {
return Components.literal(Mth.clamp((int) (currentLevel * 100), 0, 100) + "%");
return Component.literal(Mth.clamp((int) (currentLevel * 100), 0, 100) + "%");
}
@Nullable

View file

@ -4,7 +4,7 @@ import com.simibubi.create.content.redstone.displayLink.DisplayLinkContext;
import com.simibubi.create.foundation.gui.ModularGuiLineBuilder;
import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.lang.Components;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
@ -20,7 +20,7 @@ public class RedstonePowerDisplaySource extends PercentOrProgressBarDisplaySourc
@Override
protected MutableComponent formatNumeric(DisplayLinkContext context, Float currentLevel) {
return Components.literal(String.valueOf((int) (currentLevel * 15)));
return Component.literal(String.valueOf((int) (currentLevel * 15)));
}
@Override

View file

@ -8,8 +8,8 @@ import com.simibubi.create.foundation.gui.ModularGuiLineBuilder;
import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.data.IntAttached;
import net.createmod.catnip.lang.Components;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.Level;
@ -40,8 +40,10 @@ public class ScoreboardDisplaySource extends ValueListDisplaySource {
return sLevel.getScoreboard()
.getPlayerScores(objective)
.stream()
.map(score -> IntAttached.with(score.getScore(), Components.literal(score.getOwner())
.copy()))
.map(score -> {
return IntAttached.with(score.getScore(), Component.literal(score.getOwner())
.copy());
})
.sorted(IntAttached.comparator())
.limit(maxRows);
}

View file

@ -11,8 +11,8 @@ import com.simibubi.create.content.trains.display.FlapDisplaySection;
import com.simibubi.create.foundation.gui.ModularGuiLineBuilder;
import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.lang.Components;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@ -50,8 +50,9 @@ public abstract class SingleLineDisplaySource extends DisplaySource {
if (allowsLabeling(context)) {
String label = context.sourceConfig()
.getString("Label");
if (!label.isEmpty())
line = Components.literal(label + " ").append(line);
if (!label.isEmpty()) {
line = Component.literal(label + " ").append(line);
}
}
return ImmutableList.of(line);
@ -63,8 +64,9 @@ public abstract class SingleLineDisplaySource extends DisplaySource {
if (allowsLabeling(context)) {
String label = context.sourceConfig()
.getString("Label");
if (!label.isEmpty())
return ImmutableList.of(ImmutableList.of(Components.literal(label + " "), provideLine(context, stats)));
if (!label.isEmpty()) {
return ImmutableList.of(ImmutableList.of(Component.literal(label + " "), provideLine(context, stats)));
}
}
return super.provideFlapDisplayText(context, stats);

View file

@ -18,9 +18,9 @@ import com.simibubi.create.foundation.advancement.AllAdvancements;
import com.simibubi.create.foundation.gui.ModularGuiLineBuilder;
import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.lang.Components;
import net.minecraft.ChatFormatting;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.util.Mth;
import net.minecraftforge.api.distmarker.Dist;
@ -28,14 +28,25 @@ import net.minecraftforge.api.distmarker.OnlyIn;
public class StationSummaryDisplaySource extends DisplaySource {
protected static final MutableComponent UNPREDICTABLE = Components.literal(" ~ ");
protected static final MutableComponent UNPREDICTABLE;
protected static final List<MutableComponent> EMPTY_ENTRY_4 =
ImmutableList.of(WHITESPACE, Components.literal(" . "), WHITESPACE, WHITESPACE);
protected static final List<MutableComponent> EMPTY_ENTRY_5 =
ImmutableList.of(WHITESPACE, Components.literal(" . "), WHITESPACE, WHITESPACE, WHITESPACE);
static {
UNPREDICTABLE = Component.literal(" ~ ");
}
@Override
protected static final List<MutableComponent> EMPTY_ENTRY_4;
static {
EMPTY_ENTRY_4 = ImmutableList.of(WHITESPACE, Component.literal(" . "), WHITESPACE, WHITESPACE);
}
protected static final List<MutableComponent> EMPTY_ENTRY_5;
static {
EMPTY_ENTRY_5 = ImmutableList.of(WHITESPACE, Component.literal(" . "), WHITESPACE, WHITESPACE, WHITESPACE);
}
@Override
public List<MutableComponent> provideText(DisplayLinkContext context, DisplayTargetStats stats) {
return EMPTY;
}
@ -67,7 +78,7 @@ public class StationSummaryDisplaySource extends DisplaySource {
min++;
sec = 0;
}
lines.add(min > 0 ? Components.literal(String.valueOf(min)) : WHITESPACE);
lines.add(min > 0 ? Component.literal(String.valueOf(min)) : WHITESPACE);
lines.add(min > 0 ? CreateLang.translateDirect("display_source.station_summary.minutes")
: CreateLang.translateDirect("display_source.station_summary.seconds", sec));
}
@ -86,7 +97,7 @@ public class StationSummaryDisplaySource extends DisplaySource {
platform = platform.replace(string, "");
platform = platform.replace("*", "?");
lines.add(Components.literal(platform.trim()));
lines.add(Component.literal(platform.trim()));
list.add(lines);
});

View file

@ -5,7 +5,7 @@ import com.simibubi.create.content.redstone.displayLink.DisplayLinkContext;
import com.simibubi.create.content.redstone.displayLink.target.DisplayTargetStats;
import com.simibubi.create.content.trains.display.FlapDisplaySection;
import net.createmod.catnip.lang.Components;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
public class StopWatchDisplaySource extends SingleLineDisplaySource {
@ -32,7 +32,7 @@ public class StopWatchDisplaySource extends SingleLineDisplaySource {
int minutes = (diff / 60 / 20) % 60;
int seconds = (diff / 20) % 60;
MutableComponent component = Components.literal((hours == 0 ? "" : (hours < 10 ? " " : "") + hours + ":")
MutableComponent component = Component.literal((hours == 0 ? "" : (hours < 10 ? " " : "") + hours + ":")
+ (minutes < 10 ? hours == 0 ? " " : "0" : "") + minutes + ":" + (seconds < 10 ? "0" : "") + seconds);
return component;

View file

@ -7,7 +7,7 @@ import com.simibubi.create.content.trains.display.FlapDisplaySection;
import com.simibubi.create.foundation.gui.ModularGuiLineBuilder;
import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.lang.Components;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.server.level.ServerLevel;
import net.minecraftforge.api.distmarker.Dist;
@ -15,9 +15,13 @@ import net.minecraftforge.api.distmarker.OnlyIn;
public class TimeOfDayDisplaySource extends SingleLineDisplaySource {
public static final MutableComponent EMPTY_TIME = Components.literal("--:--");
public static final MutableComponent EMPTY_TIME;
@Override
static {
EMPTY_TIME = Component.literal("--:--");
}
@Override
protected MutableComponent provideLine(DisplayLinkContext context, DisplayTargetStats stats) {
if (!(context.level()instanceof ServerLevel sLevel))
return EMPTY_TIME;
@ -48,7 +52,7 @@ public class TimeOfDayDisplaySource extends SingleLineDisplaySource {
minutes = sLevel.random.nextInt(40) + 60;
}
MutableComponent component = Components.literal(
MutableComponent component = Component.literal(
(hours < 10 ? " " : "") + hours + ":" + (minutes < 10 ? "0" : "") + minutes + (c12 ? " " : ""));
return c12 ? component.append(suffix) : component;

View file

@ -7,6 +7,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;
import net.minecraft.network.chat.Component;
import org.apache.commons.lang3.mutable.MutableInt;
import com.simibubi.create.content.redstone.displayLink.DisplayLinkContext;
@ -19,7 +20,6 @@ import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.data.Couple;
import net.createmod.catnip.data.IntAttached;
import net.createmod.catnip.lang.Components;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.world.level.block.entity.LecternBlockEntity;
import net.minecraftforge.api.distmarker.Dist;
@ -63,7 +63,7 @@ public abstract class ValueListDisplaySource extends DisplaySource {
current = atIndex;
continue;
}
current.append(Components.literal("\n"))
current.append(Component.literal("\n"))
.append(atIndex);
if ((i + 1) % ENTRIES_PER_PAGE == 0) {
condensed.add(current);
@ -99,7 +99,7 @@ public abstract class ValueListDisplaySource extends DisplaySource {
: Arrays.asList(name, shortened.getFirst(), shortened.getSecond());
}
MutableComponent formattedNumber = Components.literal(String.valueOf(number)).append(WHITESPACE);
MutableComponent formattedNumber = Component.literal(String.valueOf(number)).append(WHITESPACE);
return valueFirst() ? Arrays.asList(formattedNumber, name) : Arrays.asList(name, formattedNumber);
}
@ -136,15 +136,17 @@ public abstract class ValueListDisplaySource extends DisplaySource {
}
private Couple<MutableComponent> shorten(int number) {
if (number >= 1000000)
return Couple.create(Components.literal(String.valueOf(number / 1000000)),
CreateLang.translateDirect("display_source.value_list.million")
.append(WHITESPACE));
if (number >= 1000)
return Couple.create(Components.literal(String.valueOf(number / 1000)),
CreateLang.translateDirect("display_source.value_list.thousand")
.append(WHITESPACE));
return Couple.create(Components.literal(String.valueOf(number)), WHITESPACE);
if (number >= 1000000) {
return Couple.create(Component.literal(String.valueOf(number / 1000000)),
CreateLang.translateDirect("display_source.value_list.million")
.append(WHITESPACE));
}
if (number >= 1000) {
return Couple.create(Component.literal(String.valueOf(number / 1000)),
CreateLang.translateDirect("display_source.value_list.thousand")
.append(WHITESPACE));
}
return Couple.create(Component.literal(String.valueOf(number)), WHITESPACE);
}
protected boolean shortenNumbers(DisplayLinkContext context) {

View file

@ -6,6 +6,8 @@ import java.util.HashSet;
import java.util.List;
import java.util.Vector;
import net.createmod.catnip.lang.Lang;
import org.lwjgl.glfw.GLFW;
import com.mojang.blaze3d.platform.InputConstants;
@ -21,7 +23,6 @@ import com.simibubi.create.foundation.utility.ControlsUtil;
import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.lang.FontHelper.Palette;
import net.createmod.catnip.lang.Components;
import net.createmod.catnip.outliner.Outliner;
import net.minecraft.ChatFormatting;
import net.minecraft.client.KeyMapping;
@ -224,7 +225,7 @@ public class LinkedControllerClientHandler {
PoseStack poseStack = graphics.pose();
poseStack.pushPose();
Screen tooltipScreen = new Screen(Components.immutableEmpty()) {
Screen tooltipScreen = new Screen(Lang.IMMUTABLE_EMPTY) {
};
tooltipScreen.init(mc, width1, height1);

View file

@ -12,10 +12,10 @@ import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour
import com.simibubi.create.foundation.utility.DynamicComponent;
import net.createmod.catnip.data.Couple;
import net.createmod.catnip.lang.Components;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;
@ -82,7 +82,7 @@ public class NixieTubeBlockEntity extends SmartBlockEntity {
public MutableComponent getFullText() {
return customText.map(DynamicComponent::get)
.orElse(Components.literal("" + redstoneStrength));
.orElse(Component.literal("" + redstoneStrength));
}
public void updateRedstoneStrength(int signalStrength) {

View file

@ -21,11 +21,11 @@ import net.createmod.catnip.gui.ScreenOpener;
import net.createmod.catnip.gui.element.GuiGameElement;
import net.createmod.catnip.gui.widget.AbstractSimiWidget;
import net.createmod.catnip.data.Iterate;
import net.createmod.catnip.lang.Components;
import net.createmod.ponder.foundation.ui.PonderTagScreen;
import net.minecraft.ChatFormatting;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.util.Mth;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
@ -160,17 +160,17 @@ public class ThresholdSwitchScreen extends AbstractSimiScreen {
}
graphics.drawString(font,
Components.literal("\u2265 " + (typeOfCurrentTarget == ThresholdType.UNSUPPORTED ? ""
: forItems ? onAbove.getState() / valueStep
: blockEntity.format(onAbove.getState() / valueStep, stacks)
.getString())),
graphics.drawString(font,
Component.literal("\u2265 " + (typeOfCurrentTarget == ThresholdType.UNSUPPORTED ? ""
: forItems ? onAbove.getState() / valueStep
: blockEntity.format(onAbove.getState() / valueStep, stacks)
.getString())),
x + 53, y + 28, 0xFFFFFFFF, true);
graphics.drawString(font,
Components.literal("\u2264 " + (typeOfCurrentTarget == ThresholdType.UNSUPPORTED ? ""
: forItems ? offBelow.getState() / valueStep
: blockEntity.format(offBelow.getState() / valueStep, stacks)
.getString())),
graphics.drawString(font,
Component.literal("\u2264 " + (typeOfCurrentTarget == ThresholdType.UNSUPPORTED ? ""
: forItems ? offBelow.getState() / valueStep
: blockEntity.format(offBelow.getState() / valueStep, stacks)
.getString())),
x + 53, y + 28 + 24, 0xFFFFFFFF, true);
GuiGameElement.of(renderedItem).<GuiGameElement

View file

@ -23,7 +23,6 @@ import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.gui.ScreenOpener;
import net.createmod.catnip.nbt.NBTHelper;
import net.createmod.catnip.lang.Components;
import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
@ -77,9 +76,10 @@ public class SchematicItem extends Item {
public void appendHoverText(ItemStack stack, Level worldIn, List<Component> tooltip, TooltipFlag flagIn) {
if (stack.hasTag()) {
if (stack.getTag()
.contains("File"))
tooltip.add(Components.literal(ChatFormatting.GOLD + stack.getTag()
.getString("File")));
.contains("File")) {
tooltip.add(Component.literal(ChatFormatting.GOLD + stack.getTag()
.getString("File")));
}
} else {
tooltip.add(CreateLang.translateDirect("schematic.invalid").withStyle(ChatFormatting.RED));
}

View file

@ -24,9 +24,10 @@ import com.simibubi.create.infrastructure.config.AllConfigs;
import com.simibubi.create.infrastructure.config.CSchematics;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import net.createmod.catnip.lang.Components;
import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.level.Level;
@ -163,10 +164,10 @@ public class ServerSchematicLoader {
protected boolean validateSchematicSizeOnServer(ServerPlayer player, long size) {
Integer maxFileSize = getConfig().maxTotalSchematicSize.get();
if (size > maxFileSize * 1000) {
player.sendSystemMessage(CreateLang.translateDirect("schematics.uploadTooLarge")
.append(Components.literal(" (" + size / 1000 + " KB).")));
player.sendSystemMessage(CreateLang.translateDirect("schematics.maxAllowedSize")
.append(Components.literal(" " + maxFileSize + " KB")));
player.sendSystemMessage(CreateLang.translateDirect("schematics.uploadTooLarge")
.append(Component.literal(" (" + size / 1000 + " KB).")));
player.sendSystemMessage(CreateLang.translateDirect("schematics.maxAllowedSize")
.append(Component.literal(" " + maxFileSize + " KB")));
return false;
}
return true;

View file

@ -16,7 +16,6 @@ import com.simibubi.create.foundation.utility.CreateLang;
import it.unimi.dsi.fastutil.objects.Object2IntArrayMap;
import it.unimi.dsi.fastutil.objects.Object2IntMap;
import net.createmod.catnip.lang.Components;
import net.minecraft.ChatFormatting;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
@ -86,7 +85,7 @@ public class MaterialChecklist {
MutableComponent textComponent;
if (blocksNotLoaded) {
textComponent = Components.literal("\n" + ChatFormatting.RED);
textComponent = Component.literal("\n" + ChatFormatting.RED);
textComponent = textComponent.append(CreateLang.translateDirect("materialChecklist.blocksNotLoaded"));
pages.add(StringTag.valueOf(Component.Serializer.toJson(textComponent)));
}
@ -103,7 +102,7 @@ public class MaterialChecklist {
return name1.compareTo(name2);
});
textComponent = Components.empty();
textComponent = Component.empty();
List<Item> completed = new ArrayList<>();
for (Item item : keys) {
int amount = getRequiredAmount(item);
@ -117,10 +116,10 @@ public class MaterialChecklist {
if (itemsWritten == MAX_ENTRIES_PER_PAGE) {
itemsWritten = 0;
textComponent.append(Components.literal("\n >>>")
textComponent.append(Component.literal("\n >>>")
.withStyle(ChatFormatting.BLUE));
pages.add(StringTag.valueOf(Component.Serializer.toJson(textComponent)));
textComponent = Components.empty();
textComponent = Component.empty();
}
itemsWritten++;
@ -130,10 +129,10 @@ public class MaterialChecklist {
for (Item item : completed) {
if (itemsWritten == MAX_ENTRIES_PER_PAGE) {
itemsWritten = 0;
textComponent.append(Components.literal("\n >>>")
textComponent.append(Component.literal("\n >>>")
.withStyle(ChatFormatting.DARK_GREEN));
pages.add(StringTag.valueOf(Component.Serializer.toJson(textComponent)));
textComponent = Components.empty();
textComponent = Component.empty();
}
itemsWritten++;
@ -194,7 +193,7 @@ public class MaterialChecklist {
if (itemsWritten == MAX_ENTRIES_PER_CLIPBOARD_PAGE) {
itemsWritten = 0;
currentPage.add(new ClipboardEntry(false, Components.literal(">>>")
currentPage.add(new ClipboardEntry(false, Component.literal(">>>")
.withStyle(ChatFormatting.DARK_GRAY)));
pages.add(currentPage);
currentPage = new ArrayList<>();
@ -208,7 +207,7 @@ public class MaterialChecklist {
for (Item item : completed) {
if (itemsWritten == MAX_ENTRIES_PER_CLIPBOARD_PAGE) {
itemsWritten = 0;
currentPage.add(new ClipboardEntry(true, Components.literal(">>>")
currentPage.add(new ClipboardEntry(true, Component.literal(">>>")
.withStyle(ChatFormatting.DARK_GREEN)));
pages.add(currentPage);
currentPage = new ArrayList<>();
@ -240,8 +239,8 @@ public class MaterialChecklist {
private MutableComponent entry(ItemStack item, int amount, boolean unfinished, boolean forBook) {
int stacks = amount / 64;
int remainder = amount % 64;
MutableComponent tc = Components.empty();
tc.append(Components.translatable(item.getDescriptionId())
MutableComponent tc = Component.empty();
tc.append(Component.translatable(item.getDescriptionId())
.setStyle(Style.EMPTY
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_ITEM, new HoverEvent.ItemStackInfo(item)))));
@ -249,9 +248,9 @@ public class MaterialChecklist {
tc.append(" \u2714");
if (!unfinished || forBook)
tc.withStyle(unfinished ? ChatFormatting.BLUE : ChatFormatting.DARK_GREEN);
return tc.append(Components.literal("\n" + " x" + amount)
return tc.append(Component.literal("\n" + " x" + amount)
.withStyle(ChatFormatting.BLACK))
.append(Components.literal(" | " + stacks + "\u25A4 +" + remainder + (forBook ? "\n" : ""))
.append(Component.literal(" | " + stacks + "\u25A4 +" + remainder + (forBook ? "\n" : ""))
.withStyle(ChatFormatting.GRAY));
}

View file

@ -24,12 +24,13 @@ import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.gui.element.GuiGameElement;
import net.createmod.catnip.lang.FontHelper.Palette;
import net.createmod.catnip.lang.Components;
import net.createmod.catnip.lang.Lang;
import net.minecraft.ChatFormatting;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.AbstractWidget;
import net.minecraft.client.renderer.Rect2i;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.item.ItemStack;
@ -95,17 +96,17 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
playButton.withCallback(() -> {
sendOptionUpdate(Option.PLAY, true);
});
playIndicator = new Indicator(x + 75, y + 79, Components.immutableEmpty());
playIndicator = new Indicator(x + 75, y + 79, Lang.IMMUTABLE_EMPTY);
pauseButton = new IconButton(x + 93, y + 85, AllIcons.I_PAUSE);
pauseButton.withCallback(() -> {
sendOptionUpdate(Option.PAUSE, true);
});
pauseIndicator = new Indicator(x + 93, y + 79, Components.immutableEmpty());
pauseIndicator = new Indicator(x + 93, y + 79, Lang.IMMUTABLE_EMPTY);
resetButton = new IconButton(x + 111, y + 85, AllIcons.I_STOP);
resetButton.withCallback(() -> {
sendOptionUpdate(Option.STOP, true);
});
resetIndicator = new Indicator(x + 111, y + 79, Components.immutableEmpty());
resetIndicator = new Indicator(x + 111, y + 79, Lang.IMMUTABLE_EMPTY);
resetIndicator.state = State.RED;
addRenderableWidgets(playButton, playIndicator, pauseButton, pauseIndicator, resetButton,
resetIndicator);
@ -122,7 +123,7 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
});
showSettingsButton.setToolTip(CreateLang.translateDirect(_showSettings));
addRenderableWidget(showSettingsButton);
showSettingsIndicator = new Indicator(x + 9, y + 111, Components.immutableEmpty());
showSettingsIndicator = new Indicator(x + 9, y + 111, Lang.IMMUTABLE_EMPTY);
// addRenderableWidget(showSettingsIndicator);
extraAreas = ImmutableList.of(new Rect2i(x + BG_TOP.getWidth(), y + BG_TOP.getHeight() + BG_BOTTOM.getHeight() - 62, 84, 92));
@ -151,7 +152,7 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
CreateLang.translateDirect("gui.schematicannon.option.replaceWithEmpty"));
for (int i = 0; i < 4; i++) {
replaceLevelIndicators.add(new Indicator(x + 33 + i * 18, y + 111, Components.immutableEmpty()));
replaceLevelIndicators.add(new Indicator(x + 33 + i * 18, y + 111, Lang.IMMUTABLE_EMPTY));
IconButton replaceLevelButton = new IconButton(x + 33 + i * 18, y + 111, icons.get(i));
int replaceMode = i;
replaceLevelButton.withCallback(() -> {
@ -170,7 +171,7 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
sendOptionUpdate(Option.SKIP_MISSING, !menu.contentHolder.skipMissing);
});
skipMissingButton.setToolTip(CreateLang.translateDirect("gui.schematicannon.option.skipMissing"));
skipMissingIndicator = new Indicator(x + 111, y + 111, Components.immutableEmpty());
skipMissingIndicator = new Indicator(x + 111, y + 111, Lang.IMMUTABLE_EMPTY);
Collections.addAll(placementSettingWidgets, skipMissingButton);
skipBlockEntitiesButton = new IconButton(x + 135, y + 111, AllIcons.I_SKIP_BLOCK_ENTITIES);
@ -178,7 +179,7 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
sendOptionUpdate(Option.SKIP_BLOCK_ENTITIES, !menu.contentHolder.replaceBlockEntities);
});
skipBlockEntitiesButton.setToolTip(CreateLang.translateDirect("gui.schematicannon.option.skipBlockEntities"));
skipBlockEntitiesIndicator = new Indicator(x + 129, y + 111, Components.immutableEmpty());
skipBlockEntitiesIndicator = new Indicator(x + 129, y + 111, Lang.IMMUTABLE_EMPTY);
Collections.addAll(placementSettingWidgets, skipBlockEntitiesButton);
addRenderableWidgets(placementSettingWidgets);
@ -395,7 +396,7 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
if (be.hasCreativeCrate) {
tooltip.add(CreateLang.translateDirect(_gunpowderLevel, "" + 100));
tooltip.add(Components.literal("(").append(AllBlocks.CREATIVE_CRATE.get()
tooltip.add(Component.literal("(").append(AllBlocks.CREATIVE_CRATE.get()
.getName())
.append(")")
.withStyle(DARK_PURPLE));
@ -404,13 +405,14 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
int fillPercent = (int) ((be.remainingFuel / (float) be.getShotsPerGunpowder()) * 100);
tooltip.add(CreateLang.translateDirect(_gunpowderLevel, fillPercent));
tooltip.add(CreateLang.translateDirect(_shotsRemaining, Components.literal(Integer.toString(shotsLeft)).withStyle(BLUE))
tooltip.add(CreateLang.translateDirect(_shotsRemaining, Component.literal(Integer.toString(shotsLeft)).withStyle(BLUE))
.withStyle(GRAY));
if (shotsLeftWithItems != shotsLeft)
tooltip.add(CreateLang
.translateDirect(_shotsRemainingWithBackup,
Components.literal(Integer.toString(shotsLeftWithItems)).withStyle(BLUE))
.withStyle(GRAY));
if (shotsLeftWithItems != shotsLeft) {
tooltip.add(CreateLang
.translateDirect(_shotsRemainingWithBackup,
Component.literal(Integer.toString(shotsLeftWithItems)).withStyle(BLUE))
.withStyle(GRAY));
}
return tooltip;
}

View file

@ -23,10 +23,10 @@ import com.simibubi.create.foundation.utility.CreateLang;
import com.simibubi.create.foundation.utility.FilesHelper;
import com.simibubi.create.infrastructure.config.AllConfigs;
import net.createmod.catnip.lang.Components;
import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@ -166,7 +166,7 @@ public class ClientSchematicLoader {
if (Files.isDirectory(path))
return;
availableSchematics.add(Components.literal(path.getFileName().toString()));
availableSchematics.add(Component.literal(path.getFileName().toString()));
});
} catch (NoSuchFileException e) {
// No Schematics created yet

View file

@ -14,7 +14,7 @@ import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.gui.AbstractSimiScreen;
import net.createmod.catnip.gui.element.GuiGameElement;
import net.createmod.catnip.lang.Components;
import net.createmod.catnip.lang.Lang;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.EditBox;
import net.minecraft.core.BlockPos;
@ -59,9 +59,9 @@ public class SchematicEditScreen extends AbstractSimiScreen {
int x = guiLeft;
int y = guiTop + 2;
xInput = new EditBox(font, x + 50, y + 26, 34, 10, Components.immutableEmpty());
yInput = new EditBox(font, x + 90, y + 26, 34, 10, Components.immutableEmpty());
zInput = new EditBox(font, x + 130, y + 26, 34, 10, Components.immutableEmpty());
xInput = new EditBox(font, x + 50, y + 26, 34, 10, Lang.IMMUTABLE_EMPTY);
yInput = new EditBox(font, x + 90, y + 26, 34, 10, Lang.IMMUTABLE_EMPTY);
zInput = new EditBox(font, x + 130, y + 26, 34, 10, Lang.IMMUTABLE_EMPTY);
BlockPos anchor = handler.getTransformation()
.getAnchor();
@ -96,14 +96,14 @@ public class SchematicEditScreen extends AbstractSimiScreen {
StructurePlaceSettings settings = handler.getTransformation()
.toSettings();
Label labelR = new Label(x + 50, y + 48, Components.immutableEmpty()).withShadow();
Label labelR = new Label(x + 50, y + 48, Lang.IMMUTABLE_EMPTY).withShadow();
rotationArea = new SelectionScrollInput(x + 45, y + 43, 118, 18).forOptions(rotationOptions)
.titled(rotationLabel.plainCopy())
.setState(settings.getRotation()
.ordinal())
.writingTo(labelR);
Label labelM = new Label(x + 50, y + 70, Components.immutableEmpty()).withShadow();
Label labelM = new Label(x + 50, y + 70, Lang.IMMUTABLE_EMPTY).withShadow();
mirrorArea = new SelectionScrollInput(x + 45, y + 65, 118, 18).forOptions(mirrorOptions)
.titled(mirrorLabel.plainCopy())
.setState(settings.getMirror()

View file

@ -1,5 +1,7 @@
package com.simibubi.create.content.schematics.client;
import net.createmod.catnip.lang.Lang;
import org.lwjgl.glfw.GLFW;
import com.simibubi.create.AllItems;
@ -11,7 +13,6 @@ import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.gui.AbstractSimiScreen;
import net.createmod.catnip.gui.element.GuiGameElement;
import net.createmod.catnip.lang.Components;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.EditBox;
import net.minecraft.network.chat.Component;
@ -42,7 +43,7 @@ public class SchematicPromptScreen extends AbstractSimiScreen {
int x = guiLeft;
int y = guiTop + 2;
nameField = new EditBox(font, x + 49, y + 26, 131, 10, Components.immutableEmpty());
nameField = new EditBox(font, x + 49, y + 26, 131, 10, Lang.IMMUTABLE_EMPTY);
nameField.setTextColor(-1);
nameField.setTextColorUneditable(-1);
nameField.setBordered(false);

View file

@ -11,7 +11,6 @@ import com.simibubi.create.content.schematics.client.tools.ToolType;
import com.simibubi.create.foundation.gui.AllGuiTextures;
import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.lang.Components;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.screens.Screen;
@ -34,7 +33,7 @@ public class ToolSelectionScreen extends Screen {
protected int h;
public ToolSelectionScreen(List<ToolType> tools, Consumer<ToolType> callback) {
super(Components.literal("Tool Selection"));
super(Component.literal("Tool Selection"));
this.minecraft = Minecraft.getInstance();
this.tools = tools;
this.callback = callback;

View file

@ -21,11 +21,12 @@ import com.simibubi.create.foundation.gui.widget.SelectionScrollInput;
import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.gui.element.GuiGameElement;
import net.createmod.catnip.lang.Components;
import net.createmod.catnip.lang.Lang;
import net.minecraft.Util;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.renderer.Rect2i;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.item.ItemStack;
@ -73,8 +74,8 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
int x = leftPos;
int y = topPos + 2;
schematicsLabel = new Label(x + 51, y + 26, Components.immutableEmpty()).withShadow();
schematicsLabel.text = Components.immutableEmpty();
schematicsLabel = new Label(x + 51, y + 26, Lang.IMMUTABLE_EMPTY).withShadow();
schematicsLabel.text = Lang.IMMUTABLE_EMPTY;
if (!availableSchematics.isEmpty()) {
schematicsArea =
new SelectionScrollInput(x + 45, y + 21, 139, 18).forOptions(availableSchematics)
@ -118,7 +119,7 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
addRenderableWidget(schematicsArea);
} else {
schematicsArea = null;
schematicsLabel.text = Components.immutableEmpty();
schematicsLabel.text = Lang.IMMUTABLE_EMPTY;
}
});
refreshButton.setToolTip(refresh);
@ -152,7 +153,7 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
titleText = finished;
else
titleText = title;
graphics.drawString(font, titleText, x + (background.getWidth() - 8 - font.width(titleText)) / 2, y + 4, 0x505050, false);
if (schematicsArea == null)
@ -190,7 +191,11 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
if (schematicsLabel != null) {
schematicsLabel.colored(0xCCDDFF);
String uploadingSchematic = menu.contentHolder.uploadingSchematic;
schematicsLabel.text = uploadingSchematic == null ? null : Components.literal(uploadingSchematic);
if (uploadingSchematic == null) {
schematicsLabel.text = null;
} else {
schematicsLabel.text = Component.literal(uploadingSchematic);
}
}
if (schematicsArea != null)
schematicsArea.visible = false;

View file

@ -16,7 +16,6 @@ import com.simibubi.create.content.kinetics.simpleRelays.ICogWheel;
import com.simibubi.create.foundation.block.IBE;
import net.createmod.catnip.data.Iterate;
import net.createmod.catnip.lang.Components;
import net.createmod.catnip.placement.IPlacementHelper;
import net.createmod.catnip.placement.PlacementHelpers;
import net.createmod.catnip.placement.PlacementOffset;
@ -29,6 +28,7 @@ import net.minecraft.core.Direction.AxisDirection;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.Tag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
@ -181,8 +181,9 @@ public class FlapDisplayBlock extends HorizontalKineticBlock
int line = lineIndex;
for (int i = 0; i < entries.size(); i++) {
for (String string : entries.get(i).text.getString()
.split("\n"))
flapBE.applyTextManually(line++, Component.Serializer.toJson(Components.literal(string)));
.split("\n")) {
flapBE.applyTextManually(line++, Component.Serializer.toJson(Component.literal(string)));
}
}
return InteractionResult.SUCCESS;
}

View file

@ -11,8 +11,8 @@ import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour
import com.simibubi.create.foundation.utility.DyeHelper;
import com.simibubi.create.foundation.utility.DynamicComponent;
import net.createmod.catnip.lang.Lang;
import net.createmod.catnip.nbt.NBTHelper;
import net.createmod.catnip.lang.Components;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction;
@ -150,7 +150,7 @@ public class FlapDisplayBlockEntity extends KineticBlockEntity {
FlapDisplaySection flapDisplaySection = sections.get(0);
if (rawComponentText == null) {
manualLines[lineIndex] = false;
flapDisplaySection.setText(Components.immutableEmpty());
flapDisplaySection.setText(Lang.IMMUTABLE_EMPTY);
notifyUpdate();
return;
}

View file

@ -29,8 +29,8 @@ import com.simibubi.create.foundation.utility.CreateLang;
import com.simibubi.create.infrastructure.config.AllConfigs;
import net.createmod.catnip.data.Couple;
import net.createmod.catnip.lang.Lang;
import net.createmod.catnip.math.VecHelper;
import net.createmod.catnip.lang.Components;
import net.createmod.catnip.theme.Color;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
@ -591,8 +591,8 @@ public class CarriageContraptionEntity extends OrientedContraptionEntity {
boolean spaceDown = heldControls.contains(4);
GlobalStation currentStation = carriage.train.getCurrentStation();
if (currentStation != null && spaceDown) {
sendPrompt(player, CreateLang.translateDirect("train.arrived_at",
Components.literal(currentStation.name).withStyle(s -> s.withColor(0x704630))), false);
sendPrompt(player, CreateLang.translateDirect("train.arrived_at",
Component.literal(currentStation.name).withStyle(s -> s.withColor(0x704630))), false);
return true;
}
@ -603,8 +603,8 @@ public class CarriageContraptionEntity extends OrientedContraptionEntity {
if (currentStation != null && targetSpeed != 0) {
stationMessage = false;
sendPrompt(player, CreateLang.translateDirect("train.departing_from",
Components.literal(currentStation.name).withStyle(s -> s.withColor(0x704630))), false);
sendPrompt(player, CreateLang.translateDirect("train.departing_from",
Component.literal(currentStation.name).withStyle(s -> s.withColor(0x704630))), false);
}
if (currentStation == null) {
@ -617,8 +617,8 @@ public class CarriageContraptionEntity extends OrientedContraptionEntity {
double f = (nav.distanceToDestination / navDistanceTotal);
int progress = (int) (Mth.clamp(1 - ((1 - f) * (1 - f)), 0, 1) * 30);
boolean arrived = progress == 0;
MutableComponent whiteComponent = Components.literal(Strings.repeat("|", progress));
MutableComponent greenComponent = Components.literal(Strings.repeat("|", 30 - progress));
MutableComponent whiteComponent = Component.literal(Strings.repeat("|", progress));
MutableComponent greenComponent = Component.literal(Strings.repeat("|", 30 - progress));
int fromColor = 0x00_FFC244;
int toColor = 0x00_529915;
@ -684,14 +684,14 @@ public class CarriageContraptionEntity extends OrientedContraptionEntity {
private void displayApproachStationMessage(Player player, GlobalStation station) {
sendPrompt(player, CreateLang.translateDirect("contraption.controls.approach_station",
Components.keybind("key.jump"), station.name), false);
Component.keybind("key.jump"), station.name), false);
stationMessage = true;
}
private void cleanUpApproachStationMessage(Player player) {
if (!stationMessage)
return;
player.displayClientMessage(Components.immutableEmpty(), true);
player.displayClientMessage(Lang.IMMUTABLE_EMPTY, true);
stationMessage = false;
}

View file

@ -8,7 +8,6 @@ import java.util.stream.Stream;
import com.google.common.collect.Streams;
import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.lang.Components;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
@ -114,20 +113,22 @@ public class TrainStatus {
public void crash() {
Component component =
Components.literal(" - ").withStyle(ChatFormatting.GRAY)
Component.literal(" - ").withStyle(ChatFormatting.GRAY)
.append(
CreateLang.translateDirect("train.status.collision").withStyle(st -> st.withColor(0xFFD3B4))
);
List<ResourceKey<Level>> presentDimensions = train.getPresentDimensions();
Stream<Component> locationComponents = presentDimensions.stream().map(key ->
Components.literal(" - ").withStyle(ChatFormatting.GRAY)
.append(
CreateLang.translateDirect(
"train.status.collision.where",
key.location(),
train.getPositionInDimension(key).get().toShortString()
).withStyle(style -> style.withColor(0xFFD3B4))
)
{
return Component.literal(" - ").withStyle(ChatFormatting.GRAY)
.append(
CreateLang.translateDirect(
"train.status.collision.where",
key.location(),
train.getPositionInDimension(key).get().toShortString()
).withStyle(style -> style.withColor(0xFFD3B4))
);
}
);
addMessage(new StatusMessage(Streams.concat(Stream.of(component), locationComponents).toArray(Component[]::new)));
@ -159,7 +160,7 @@ public class TrainStatus {
}
public void displayInformation(String key, boolean itsAGoodThing, Object... args) {
MutableComponent component = Components.literal(" - ").withStyle(ChatFormatting.GRAY)
MutableComponent component = Component.literal(" - ").withStyle(ChatFormatting.GRAY)
.append(CreateLang.translateDirect("train.status." + key, args)
.withStyle(st -> st.withColor(itsAGoodThing ? 0xD5ECC2 : 0xFFD3B4)));
addMessage(new StatusMessage(component));

View file

@ -8,7 +8,6 @@ import com.google.common.collect.ImmutableList;
import com.simibubi.create.foundation.gui.ModularGuiLineBuilder;
import net.createmod.catnip.data.Pair;
import net.createmod.catnip.lang.Components;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
@ -33,8 +32,8 @@ public interface IScheduleInput {
public default List<Component> getTitleAs(String type) {
ResourceLocation id = getId();
return ImmutableList
.of(Components.translatable(id.getNamespace() + ".schedule." + type + "." + id.getPath()));
return ImmutableList
.of(Component.translatable(id.getNamespace() + ".schedule." + type + "." + id.getPath()));
}
public default ItemStack getSecondLineIcon() {

Some files were not shown because too many files have changed in this diff Show more