aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/anthonyhilyard/iceberg/events/CriterionCallback.java
diff options
context:
space:
mode:
authorAnthony Hilyard <anthony.hilyard@gmail.com>2021-10-24 11:46:40 -0700
committerAnthony Hilyard <anthony.hilyard@gmail.com>2021-10-24 11:46:40 -0700
commitec4c5aebf3b5b5af872c6b168c02bedd2bd5a9e3 (patch)
tree7f46aca691a09d9df9140505403a647827011df6 /src/main/java/com/anthonyhilyard/iceberg/events/CriterionCallback.java
parent2b38fda32d059303bed929b7ae634efa4dffc706 (diff)
downloadIceberg-ec4c5aebf3b5b5af872c6b168c02bedd2bd5a9e3.tar.gz
Iceberg-ec4c5aebf3b5b5af872c6b168c02bedd2bd5a9e3.tar.bz2
Iceberg-ec4c5aebf3b5b5af872c6b168c02bedd2bd5a9e3.zip
Initial Fabric port.
Diffstat (limited to 'src/main/java/com/anthonyhilyard/iceberg/events/CriterionCallback.java')
-rw-r--r--src/main/java/com/anthonyhilyard/iceberg/events/CriterionCallback.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/main/java/com/anthonyhilyard/iceberg/events/CriterionCallback.java b/src/main/java/com/anthonyhilyard/iceberg/events/CriterionCallback.java
new file mode 100644
index 0000000..f46f082
--- /dev/null
+++ b/src/main/java/com/anthonyhilyard/iceberg/events/CriterionCallback.java
@@ -0,0 +1,23 @@
+package com.anthonyhilyard.iceberg.events;
+
+import net.fabricmc.fabric.api.event.Event;
+import net.fabricmc.fabric.api.event.EventFactory;
+import net.minecraft.advancements.Advancement;
+import net.minecraft.world.entity.player.Player;
+
+/**
+ * This event is fired when a player is granted an advancement criterion.
+ */
+public interface CriterionCallback
+{
+ Event<CriterionCallback> EVENT = EventFactory.createArrayBacked(CriterionCallback.class,
+ (listeners) -> (player, advancement, criterionKey) -> {
+ for (CriterionCallback listener : listeners)
+ {
+ listener.awardCriterion(player, advancement, criterionKey);
+ }
+ }
+ );
+
+ public void awardCriterion(Player player, Advancement advancement, String criterionKey);
+}