From 16aeaec3bad9bd0c0ba430b061ff9a75e0a3a39f Mon Sep 17 00:00:00 2001 From: 90 Date: Sun, 28 Apr 2024 11:02:57 +0100 Subject: [PATCH] Recalculate transmutation patterns on player knowledge changes --- .../_90/appliede/module/CompositeKnowledgeProvider.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/gripe/_90/appliede/module/CompositeKnowledgeProvider.java b/src/main/java/gripe/_90/appliede/module/CompositeKnowledgeProvider.java index b52ab96..cc58e31 100644 --- a/src/main/java/gripe/_90/appliede/module/CompositeKnowledgeProvider.java +++ b/src/main/java/gripe/_90/appliede/module/CompositeKnowledgeProvider.java @@ -32,6 +32,7 @@ import moze_intel.projecte.api.ItemInfo; import moze_intel.projecte.api.capabilities.IKnowledgeProvider; +import moze_intel.projecte.api.event.PlayerKnowledgeChangeEvent; import moze_intel.projecte.api.proxy.ITransmutationProxy; public class CompositeKnowledgeProvider implements IKnowledgeProvider { @@ -42,7 +43,7 @@ public class CompositeKnowledgeProvider implements IKnowledgeProvider { private final Set moduleNodes = new ObjectLinkedOpenHashSet<>(); private final List patterns = new ObjectArrayList<>(); - public CompositeKnowledgeProvider() { + CompositeKnowledgeProvider() { MinecraftForge.EVENT_BUS.addListener((PlayerEvent event) -> { if (event instanceof PlayerEvent.PlayerLoggedInEvent || event instanceof PlayerEvent.PlayerLoggedOutEvent) { cachedProviders.clear(); @@ -56,6 +57,12 @@ public CompositeKnowledgeProvider() { } } }); + + MinecraftForge.EVENT_BUS.addListener((PlayerKnowledgeChangeEvent event) -> { + if (cachedProviders.get(event.getPlayerUUID()) != null) { + recalculatePatterns(); + } + }); } Set getProviders() {