diff options
| author | shedaniel <daniel@shedaniel.me> | 2022-07-27 03:16:48 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2022-07-27 03:16:48 +0800 |
| commit | 0c0887317955828e8872007f95f59b87cd46969e (patch) | |
| tree | ddb1320297c92ca71abc7c9249ed668a4c19ae55 /api | |
| parent | a0e9b80cc95f27c812a1c16cb075289438546438 (diff) | |
| download | RoughlyEnoughItems-0c0887317955828e8872007f95f59b87cd46969e.tar.gz RoughlyEnoughItems-0c0887317955828e8872007f95f59b87cd46969e.tar.bz2 RoughlyEnoughItems-0c0887317955828e8872007f95f59b87cd46969e.zip | |
Fix compile errors
Diffstat (limited to 'api')
6 files changed, 23 insertions, 15 deletions
diff --git a/api/src/main/java/me/shedaniel/rei/api/client/gui/Renderer.java b/api/src/main/java/me/shedaniel/rei/api/client/gui/Renderer.java index 0d1f14184..c0a40c0ec 100644 --- a/api/src/main/java/me/shedaniel/rei/api/client/gui/Renderer.java +++ b/api/src/main/java/me/shedaniel/rei/api/client/gui/Renderer.java @@ -24,6 +24,7 @@ package me.shedaniel.rei.api.client.gui; import com.mojang.blaze3d.vertex.PoseStack; +import me.shedaniel.math.Point; import me.shedaniel.math.Rectangle; import me.shedaniel.rei.api.client.gui.widgets.Tooltip; import me.shedaniel.rei.api.client.gui.widgets.TooltipContext; diff --git a/api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/Label.java b/api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/Label.java index 9b5432c82..856e696de 100644 --- a/api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/Label.java +++ b/api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/Label.java @@ -28,11 +28,14 @@ import me.shedaniel.math.Point; import me.shedaniel.rei.api.client.REIRuntime; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.FormattedText; +import net.minecraft.network.chat.TextComponent; +import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; import java.util.function.BiConsumer; import java.util.function.Consumer; import java.util.function.Function; +import java.util.stream.Stream; public abstract class Label extends WidgetWithBounds { public static final int LEFT_ALIGNED = -1; @@ -152,22 +155,22 @@ public abstract class Label extends WidgetWithBounds { public String getTooltip() { Component[] lines = getTooltipLines(); String tooltip = null; - if(lines != null) { + if (lines != null) { StringBuilder tooltipBuilder = new StringBuilder(); - for (Component line:lines) { + for (Component line : lines) { tooltipBuilder.append(line.getContents()).append("\n"); } tooltip = tooltipBuilder.toString(); } return tooltip; } - + /** * @return the tooltip from the current tooltip function, null if no tooltip. */ @Nullable public abstract Component[] getTooltipLines(); - + /** * Sets the tooltip function used to get the tooltip. * @@ -177,20 +180,20 @@ public abstract class Label extends WidgetWithBounds { @Deprecated @ApiStatus.ScheduledForRemoval public void setTooltip(@Nullable Function<Label, @Nullable String> tooltip) { - if(tooltip != null) setTooltipFunction((label) -> { + if (tooltip != null) setTooltipFunction((label) -> { String text = tooltip.apply(label); - if(text != null) return Stream.of(text.split("\n")).map(TextComponent::new).toArray(Component[]::new); + if (text != null) return Stream.of(text.split("\n")).map(TextComponent::new).toArray(Component[]::new); return null; }); } - + /** * Sets the tooltip function used to get the tooltip. * * @param tooltip the tooltip function used to get the tooltip. */ public abstract void setTooltipFunction(@Nullable Function<Label, @Nullable Component[]> tooltip); - + /** * Sets the tooltip. * @@ -199,7 +202,7 @@ public abstract class Label extends WidgetWithBounds { public void setTooltip(Component... tooltip) { setTooltipFunction((label) -> tooltip); } - + /** * Sets the tooltip. * @@ -221,7 +224,7 @@ public abstract class Label extends WidgetWithBounds { public final Label tooltipLines(String... tooltip) { return tooltip(tooltip); } - + /** * Sets the tooltip. * @@ -234,7 +237,7 @@ public abstract class Label extends WidgetWithBounds { public final Label tooltipLine(String tooltip) { return tooltip(tooltip); } - + /** * Sets the tooltip. * @@ -244,7 +247,7 @@ public abstract class Label extends WidgetWithBounds { public final Label tooltip(String... tooltip) { return tooltipFunction(label -> Stream.of(tooltip).map(TextComponent::new).toArray(Component[]::new)); } - + /** * Sets the tooltip. * @@ -254,7 +257,7 @@ public abstract class Label extends WidgetWithBounds { public final Label tooltip(Component... tooltip) { return tooltipFunction(label -> tooltip); } - + /** * Sets the tooltip function. * @@ -268,7 +271,7 @@ public abstract class Label extends WidgetWithBounds { setTooltip(tooltip); return this; } - + /** * Sets the tooltip function. * diff --git a/api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/Tooltip.java b/api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/Tooltip.java index b5f09e6f5..dad0e9d59 100644 --- a/api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/Tooltip.java +++ b/api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/Tooltip.java @@ -32,6 +32,7 @@ import me.shedaniel.rei.api.common.util.CollectionUtils; import me.shedaniel.rei.impl.ClientInternals; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent; import net.minecraft.network.chat.Component; import net.minecraft.world.inventory.tooltip.TooltipComponent; import org.jetbrains.annotations.ApiStatus; diff --git a/api/src/main/java/me/shedaniel/rei/api/client/registry/transfer/TransferHandler.java b/api/src/main/java/me/shedaniel/rei/api/client/registry/transfer/TransferHandler.java index d363e9411..ec32d75aa 100644 --- a/api/src/main/java/me/shedaniel/rei/api/client/registry/transfer/TransferHandler.java +++ b/api/src/main/java/me/shedaniel/rei/api/client/registry/transfer/TransferHandler.java @@ -31,6 +31,7 @@ import me.shedaniel.rei.impl.ClientInternals; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.network.chat.Component; import net.minecraft.world.inventory.AbstractContainerMenu; diff --git a/api/src/main/java/me/shedaniel/rei/api/client/search/method/InputMethod.java b/api/src/main/java/me/shedaniel/rei/api/client/search/method/InputMethod.java index 90e6ba092..880c2d0df 100644 --- a/api/src/main/java/me/shedaniel/rei/api/client/search/method/InputMethod.java +++ b/api/src/main/java/me/shedaniel/rei/api/client/search/method/InputMethod.java @@ -27,6 +27,7 @@ import me.shedaniel.rei.api.client.config.ConfigObject; import me.shedaniel.rei.api.common.util.CollectionUtils; import net.minecraft.client.Minecraft; import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; @@ -42,7 +43,7 @@ public interface InputMethod<T> { static List<Locale> getAllLocales() { return CollectionUtils.map(Minecraft.getInstance().getLanguageManager().getLanguages(), info -> - new Locale(info.getCode(), Component.literal(info.getName()))); + new Locale(info.getCode(), new TextComponent(info.getName()))); } List<Locale> getMatchingLocales(); diff --git a/api/src/main/java/me/shedaniel/rei/api/common/entry/EntryStack.java b/api/src/main/java/me/shedaniel/rei/api/common/entry/EntryStack.java index 580f8bc10..0dcb10eda 100644 --- a/api/src/main/java/me/shedaniel/rei/api/common/entry/EntryStack.java +++ b/api/src/main/java/me/shedaniel/rei/api/common/entry/EntryStack.java @@ -25,6 +25,7 @@ package me.shedaniel.rei.api.common.entry; import dev.architectury.utils.Env; import dev.architectury.utils.EnvExecutor; +import me.shedaniel.math.Point; import me.shedaniel.rei.api.client.config.ConfigObject; import me.shedaniel.rei.api.client.entry.renderer.EntryRenderer; import me.shedaniel.rei.api.client.entry.renderer.EntryRendererRegistry; |
