From b657842bcddcb65fb658d4cd9835e7fa15e1c236 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Sun, 16 May 2021 17:45:22 +0800 Subject: Update JEI API to 7.6.4 & Fix #520 --- .../shedaniel/rei/plugin/client/DefaultClientPlugin.java | 15 +++++++++++++-- .../me/shedaniel/rei/plugin/common/DefaultPlugin.java | 4 ++-- 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'default-plugin') 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 c531d422f..819c4be51 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 @@ -29,6 +29,8 @@ import com.google.common.collect.Sets; import it.unimi.dsi.fastutil.objects.Object2FloatMap; import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet; import it.unimi.dsi.fastutil.objects.ReferenceSet; +import me.shedaniel.architectury.annotations.ExpectPlatform; +import me.shedaniel.architectury.annotations.PlatformOnly; import me.shedaniel.architectury.platform.Platform; import me.shedaniel.math.Rectangle; import me.shedaniel.rei.api.client.favorites.FavoriteEntry; @@ -42,6 +44,7 @@ import me.shedaniel.rei.api.client.registry.screen.ExclusionZones; import me.shedaniel.rei.api.client.registry.screen.ScreenRegistry; import me.shedaniel.rei.api.client.registry.transfer.TransferHandlerRegistry; import me.shedaniel.rei.api.common.entry.EntryIngredient; +import me.shedaniel.rei.api.common.entry.type.VanillaEntryTypes; import me.shedaniel.rei.api.common.util.CollectionUtils; import me.shedaniel.rei.api.common.util.EntryIngredients; import me.shedaniel.rei.api.common.util.EntryStacks; @@ -226,14 +229,14 @@ public class DefaultClientPlugin implements REIClientPlugin, BuiltinClientPlugin } EntryIngredient arrowStack = EntryIngredient.of(EntryStacks.of(Items.ARROW)); ReferenceSet registeredPotions = new ReferenceOpenHashSet<>(); - EntryRegistry.getInstance().getEntryStacks().filter(entry -> entry.getValue() == Items.LINGERING_POTION).forEach(entry -> { + EntryRegistry.getInstance().getEntryStacks().filter(entry -> entry.getType() == VanillaEntryTypes.ITEM && entry.cast().getValue().getItem() == Items.LINGERING_POTION).forEach(entry -> { ItemStack itemStack = (ItemStack) entry.getValue(); Potion potion = PotionUtils.getPotion(itemStack); if (registeredPotions.add(potion)) { List input = new ArrayList<>(); for (int i = 0; i < 4; i++) input.add(arrowStack); - input.add(EntryIngredient.of(EntryStacks.of(itemStack))); + input.add(EntryIngredients.of(itemStack)); for (int i = 0; i < 4; i++) input.add(arrowStack); ItemStack outputStack = new ItemStack(Items.TIPPED_ARROW, 8); @@ -292,9 +295,17 @@ public class DefaultClientPlugin implements REIClientPlugin, BuiltinClientPlugin registerBrewingRecipe(base, ingredient, output); } } + } else { + registerForgePotions(registry, this); } } + @ExpectPlatform + @PlatformOnly(PlatformOnly.FORGE) + private static void registerForgePotions(DisplayRegistry registry, BuiltinClientPlugin clientPlugin) { + + } + @Override public void registerExclusionZones(ExclusionZones zones) { zones.register(EffectRenderingInventoryScreen.class, new DefaultPotionEffectExclusionZones()); diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/common/DefaultPlugin.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/common/DefaultPlugin.java index c3b59ba3f..a4cf1fd7c 100644 --- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/common/DefaultPlugin.java +++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/common/DefaultPlugin.java @@ -29,7 +29,7 @@ import me.shedaniel.architectury.hooks.FluidStackHooks; import me.shedaniel.architectury.platform.Platform; import me.shedaniel.architectury.utils.NbtType; import me.shedaniel.rei.api.common.display.DisplaySerializerRegistry; -import me.shedaniel.rei.api.common.entry.comparison.ItemComparator; +import me.shedaniel.rei.api.common.entry.comparison.EntryComparator; import me.shedaniel.rei.api.common.entry.comparison.ItemComparatorRegistry; import me.shedaniel.rei.api.common.fluid.FluidSupportProvider; import me.shedaniel.rei.api.common.plugins.REIServerPlugin; @@ -65,7 +65,7 @@ import java.util.stream.Stream; public class DefaultPlugin implements BuiltinPlugin, REIServerPlugin { @Override public void registerItemComparators(ItemComparatorRegistry registry) { - ToLongFunction nbtHasher = ItemComparator.nbtHasher(); + ToLongFunction nbtHasher = EntryComparator.nbtHasher(); Function enchantmentTag = stack -> { CompoundTag tag = stack.getTag(); if (tag == null) return null; -- cgit