aboutsummaryrefslogtreecommitdiff
path: root/default-plugin/src/main/java/me/shedaniel/rei/plugin
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2023-11-05 21:59:21 +0800
committershedaniel <daniel@shedaniel.me>2024-04-16 00:38:18 +0900
commit73dd8da0bdda912c7482b34fb0dc4f2d680005bc (patch)
treec9b1a8f7cbc390570a5ff570d26b9901e843ca4f /default-plugin/src/main/java/me/shedaniel/rei/plugin
parentcc008ae5a925226f1bf913f8493e40c2600350aa (diff)
downloadRoughlyEnoughItems-73dd8da0bdda912c7482b34fb0dc4f2d680005bc.tar.gz
RoughlyEnoughItems-73dd8da0bdda912c7482b34fb0dc4f2d680005bc.tar.bz2
RoughlyEnoughItems-73dd8da0bdda912c7482b34fb0dc4f2d680005bc.zip
Fix cherrypick
Diffstat (limited to 'default-plugin/src/main/java/me/shedaniel/rei/plugin')
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/client/DefaultClientPlugin.java14
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/FireworkRocketRecipeFiller.java4
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/MapExtendingRecipeFiller.java8
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/ShieldDecorationRecipeFiller.java5
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/SuspiciousStewRecipeFiller.java4
5 files changed, 18 insertions, 17 deletions
diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/DefaultClientPlugin.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/DefaultClientPlugin.java
index 98fc53f73..239b95e2e 100644
--- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/DefaultClientPlugin.java
+++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/DefaultClientPlugin.java
@@ -160,19 +160,19 @@ public class DefaultClientPlugin implements REIClientPlugin, BuiltinClientPlugin
@Override
public void registerCollapsibleEntries(CollapsibleEntryRegistry registry) {
- registry.group(new ResourceLocation("roughlyenoughitems", "enchanted_book"), new TranslatableComponent("item.minecraft.enchanted_book"),
+ registry.group(new ResourceLocation("roughlyenoughitems", "enchanted_book"), Component.translatable("item.minecraft.enchanted_book"),
stack -> stack.getType() == VanillaEntryTypes.ITEM && stack.<ItemStack>castValue().is(Items.ENCHANTED_BOOK));
- registry.group(new ResourceLocation("roughlyenoughitems", "potion"), new TranslatableComponent("item.minecraft.potion"),
+ registry.group(new ResourceLocation("roughlyenoughitems", "potion"), Component.translatable("item.minecraft.potion"),
stack -> stack.getType() == VanillaEntryTypes.ITEM && stack.<ItemStack>castValue().is(Items.POTION));
- registry.group(new ResourceLocation("roughlyenoughitems", "splash_potion"), new TranslatableComponent("item.minecraft.splash_potion"),
+ registry.group(new ResourceLocation("roughlyenoughitems", "splash_potion"), Component.translatable("item.minecraft.splash_potion"),
stack -> stack.getType() == VanillaEntryTypes.ITEM && stack.<ItemStack>castValue().is(Items.SPLASH_POTION));
- registry.group(new ResourceLocation("roughlyenoughitems", "lingering_potion"), new TranslatableComponent("item.minecraft.lingering_potion"),
+ registry.group(new ResourceLocation("roughlyenoughitems", "lingering_potion"), Component.translatable("item.minecraft.lingering_potion"),
stack -> stack.getType() == VanillaEntryTypes.ITEM && stack.<ItemStack>castValue().is(Items.LINGERING_POTION));
- registry.group(new ResourceLocation("roughlyenoughitems", "spawn_egg"), new TranslatableComponent("text.rei.spawn_egg"),
+ registry.group(new ResourceLocation("roughlyenoughitems", "spawn_egg"), Component.translatable("text.rei.spawn_egg"),
stack -> stack.getType() == VanillaEntryTypes.ITEM && stack.<ItemStack>castValue().getItem() instanceof SpawnEggItem);
- registry.group(new ResourceLocation("roughlyenoughitems", "tipped_arrow"), new TranslatableComponent("item.minecraft.tipped_arrow"),
+ registry.group(new ResourceLocation("roughlyenoughitems", "tipped_arrow"), Component.translatable("item.minecraft.tipped_arrow"),
stack -> stack.getType() == VanillaEntryTypes.ITEM && stack.<ItemStack>castValue().is(Items.TIPPED_ARROW));
- registry.group(new ResourceLocation("roughlyenoughitems", "music_disc"), new TranslatableComponent("text.rei.music_disc"),
+ registry.group(new ResourceLocation("roughlyenoughitems", "music_disc"), Component.translatable("text.rei.music_disc"),
stack -> stack.getType() == VanillaEntryTypes.ITEM && stack.<ItemStack>castValue().getItem() instanceof RecordItem);
}
diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/FireworkRocketRecipeFiller.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/FireworkRocketRecipeFiller.java
index 90357ca88..d4a689df1 100644
--- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/FireworkRocketRecipeFiller.java
+++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/FireworkRocketRecipeFiller.java
@@ -31,7 +31,7 @@ import me.shedaniel.rei.api.common.util.EntryIngredients;
import me.shedaniel.rei.api.common.util.EntryStacks;
import me.shedaniel.rei.plugin.common.displays.crafting.DefaultCustomShapelessDisplay;
import net.minecraft.nbt.CompoundTag;
-import net.minecraft.network.chat.TranslatableComponent;
+import net.minecraft.network.chat.Component;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.crafting.FireworkRocketRecipe;
@@ -72,7 +72,7 @@ public class FireworkRocketRecipeFiller implements CraftingRecipeFiller<Firework
@Override
public void registerCategories(CategoryRegistry registry) {
registerExtension(registry, (bounds, widgets, display) -> {
- widgets.add(createInfoWidget(bounds, display, new TranslatableComponent("text.rei.crafting.firework.gunpowder.amount")));
+ widgets.add(createInfoWidget(bounds, display, Component.translatable("text.rei.crafting.firework.gunpowder.amount")));
});
}
}
diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/MapExtendingRecipeFiller.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/MapExtendingRecipeFiller.java
index 34a892e69..f5771ce5b 100644
--- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/MapExtendingRecipeFiller.java
+++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/MapExtendingRecipeFiller.java
@@ -30,7 +30,7 @@ import me.shedaniel.rei.api.common.util.EntryIngredients;
import me.shedaniel.rei.plugin.common.displays.crafting.DefaultCustomDisplay;
import net.minecraft.ChatFormatting;
import net.minecraft.client.resources.language.I18n;
-import net.minecraft.network.chat.TranslatableComponent;
+import net.minecraft.network.chat.Component;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.crafting.MapExtendingRecipe;
@@ -75,9 +75,9 @@ public class MapExtendingRecipeFiller implements CraftingRecipeFiller<MapExtendi
return tooltip;
});
stack.tooltip(
- new TranslatableComponent("filled_map.id", mapId).withStyle(ChatFormatting.GRAY),
- new TranslatableComponent("filled_map.scale", (1 << scale)).withStyle(ChatFormatting.GRAY),
- new TranslatableComponent("filled_map.level", scale, 4).withStyle(ChatFormatting.GRAY)
+ Component.translatable("filled_map.id", mapId).withStyle(ChatFormatting.GRAY),
+ Component.translatable("filled_map.scale", (1 << scale)).withStyle(ChatFormatting.GRAY),
+ Component.translatable("filled_map.level", scale, 4).withStyle(ChatFormatting.GRAY)
);
}
return stacks;
diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/ShieldDecorationRecipeFiller.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/ShieldDecorationRecipeFiller.java
index a26c3f14a..24cd5644b 100644
--- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/ShieldDecorationRecipeFiller.java
+++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/ShieldDecorationRecipeFiller.java
@@ -31,6 +31,7 @@ import me.shedaniel.rei.api.common.entry.EntryStack;
import me.shedaniel.rei.api.common.util.EntryIngredients;
import me.shedaniel.rei.api.common.util.EntryStacks;
import me.shedaniel.rei.plugin.common.displays.crafting.DefaultCustomShapelessDisplay;
+import net.minecraft.core.Holder;
import net.minecraft.core.Registry;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation;
@@ -54,9 +55,9 @@ public class ShieldDecorationRecipeFiller implements CraftingRecipeFiller<Shield
for (int i = 0; i < 2; i++) {
BannerPattern.Builder patternBuilder = new BannerPattern.Builder();
- BannerPattern[] allPatterns = BannerPattern.values();
+ Holder<BannerPattern>[] allPatterns = Registry.BANNER_PATTERN.holders().toArray(Holder[]::new);
for (int j = 0; j < 2; j++) {
- BannerPattern pattern = allPatterns[random.nextInt(allPatterns.length - 1) + 1];
+ Holder<BannerPattern> pattern = allPatterns[random.nextInt(allPatterns.length - 1) + 1];
patternBuilder.addPattern(pattern, colors[random.nextInt(colors.length)]);
}
ItemStack banner = new ItemStack(bannerOptional.get());
diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/SuspiciousStewRecipeFiller.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/SuspiciousStewRecipeFiller.java
index bfd82e763..fab4e4e70 100644
--- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/SuspiciousStewRecipeFiller.java
+++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/SuspiciousStewRecipeFiller.java
@@ -27,7 +27,7 @@ import me.shedaniel.rei.api.client.registry.category.CategoryRegistry;
import me.shedaniel.rei.api.common.display.Display;
import me.shedaniel.rei.api.common.util.EntryIngredients;
import me.shedaniel.rei.plugin.common.displays.crafting.DefaultCustomShapelessDisplay;
-import net.minecraft.network.chat.TranslatableComponent;
+import net.minecraft.network.chat.Component;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.crafting.SuspiciousStewRecipe;
@@ -57,7 +57,7 @@ public class SuspiciousStewRecipeFiller implements CraftingRecipeFiller<Suspicio
@Override
public void registerCategories(CategoryRegistry registry) {
registerExtension(registry, (bounds, widgets, display) -> {
- widgets.add(createInfoWidget(bounds, display, new TranslatableComponent("text.rei.crafting.suspicious_stew")));
+ widgets.add(createInfoWidget(bounds, display, Component.translatable("text.rei.crafting.suspicious_stew")));
});
}
}