aboutsummaryrefslogtreecommitdiff
path: root/default-plugin/src/main/java
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2021-05-16 17:45:22 +0800
committershedaniel <daniel@shedaniel.me>2021-05-16 17:45:22 +0800
commitb657842bcddcb65fb658d4cd9835e7fa15e1c236 (patch)
treef42511d9bb3ac413c03245391f26cfa6b0496c72 /default-plugin/src/main/java
parent4b55e2af04551f7b01047c9b47822e3a184e6362 (diff)
downloadRoughlyEnoughItems-b657842bcddcb65fb658d4cd9835e7fa15e1c236.tar.gz
RoughlyEnoughItems-b657842bcddcb65fb658d4cd9835e7fa15e1c236.tar.bz2
RoughlyEnoughItems-b657842bcddcb65fb658d4cd9835e7fa15e1c236.zip
Update JEI API to 7.6.4 & Fix #520
Diffstat (limited to 'default-plugin/src/main/java')
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/client/DefaultClientPlugin.java15
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/common/DefaultPlugin.java4
2 files changed, 15 insertions, 4 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 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<Potion> 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.<ItemStack>cast().getValue().getItem() == Items.LINGERING_POTION).forEach(entry -> {
ItemStack itemStack = (ItemStack) entry.getValue();
Potion potion = PotionUtils.getPotion(itemStack);
if (registeredPotions.add(potion)) {
List<EntryIngredient> 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<Tag> nbtHasher = ItemComparator.nbtHasher();
+ ToLongFunction<Tag> nbtHasher = EntryComparator.nbtHasher();
Function<ItemStack, ListTag> enchantmentTag = stack -> {
CompoundTag tag = stack.getTag();
if (tag == null) return null;