diff --git a/src/main/java/com/sweetrpg/crafttracker/common/event/EventHandler.java b/src/main/java/com/sweetrpg/crafttracker/common/event/EventHandler.java index e31e4f4..0459a34 100644 --- a/src/main/java/com/sweetrpg/crafttracker/common/event/EventHandler.java +++ b/src/main/java/com/sweetrpg/crafttracker/common/event/EventHandler.java @@ -49,9 +49,8 @@ public void onItemCrafted(final ItemCraftedEvent event) { else { // send packet PacketHandler.sendToPlayer((ServerPlayer) event.getPlayer(), new QueueCommandData(RECALCULATE)); + AdvancementUtil.trigger(ModAdvancements.Key.CRAFT_ITEM, (ServerPlayer) event.getPlayer()); } - - AdvancementUtil.trigger(ModAdvancements.Key.CRAFT_ITEM, (ServerPlayer) event.getPlayer()); } @SubscribeEvent @@ -68,9 +67,8 @@ public void onItemSmelted(final ItemSmeltedEvent event) { else { // send packet PacketHandler.sendToPlayer((ServerPlayer) event.getPlayer(), new QueueCommandData(RECALCULATE)); + AdvancementUtil.trigger(ModAdvancements.Key.CRAFT_ITEM, (ServerPlayer) event.getPlayer()); } - - AdvancementUtil.trigger(ModAdvancements.Key.CRAFT_ITEM, (ServerPlayer) event.getPlayer()); } @SubscribeEvent @@ -87,9 +85,8 @@ public void onItemPickedUp(final ItemPickupEvent event) { else { // send packet PacketHandler.sendToPlayer((ServerPlayer) event.getPlayer(), new QueueCommandData(RECALCULATE)); + AdvancementUtil.trigger(ModAdvancements.Key.ACQUIRE_ITEM, (ServerPlayer) event.getPlayer()); } - - AdvancementUtil.trigger(ModAdvancements.Key.ACQUIRE_ITEM, (ServerPlayer) event.getPlayer()); } } diff --git a/src/main/java/com/sweetrpg/crafttracker/common/lib/Constants.java b/src/main/java/com/sweetrpg/crafttracker/common/lib/Constants.java index 5fe3269..841589b 100644 --- a/src/main/java/com/sweetrpg/crafttracker/common/lib/Constants.java +++ b/src/main/java/com/sweetrpg/crafttracker/common/lib/Constants.java @@ -76,8 +76,8 @@ public class Constants { public static final String TRANSLATION_KEY_ADVANCEMENT_CRAFT_ITEM_DESCRIPTION = "advancements.crafttracker.main.craft_item.description"; public static final String TRANSLATION_KEY_ADVANCEMENT_POPULATE_SHOPPING_LIST_TITLE = "advancements.crafttracker.main.populate_list.title"; public static final String TRANSLATION_KEY_ADVANCEMENT_POPULATE_SHOPPING_LIST_DESCRIPTION = "advancements.crafttracker.main.populate_list.description"; - public static final String TRANSLATION_KEY_ADVANCEMENT_ACQUIRE_LIST_ITEM_TITLE = "advancements.crafttracker.main.acquire_list_item.title"; - public static final String TRANSLATION_KEY_ADVANCEMENT_ACQUIRE_LIST_ITEM_DESCRIPTION = "advancements.crafttracker.main.acquire_list_item.description"; + public static final String TRANSLATION_KEY_ADVANCEMENT_ACQUIRE_LIST_ITEM_TITLE = "advancements.crafttracker.main.acquire_item.title"; + public static final String TRANSLATION_KEY_ADVANCEMENT_ACQUIRE_LIST_ITEM_DESCRIPTION = "advancements.crafttracker.main.acquire_item.description"; public static final String TRANSLATION_KEY_ADVANCEMENT_CLEAR_QUEUE_ITEM_TITLE = "advancements.crafttracker.main.clear_queue.title"; public static final String TRANSLATION_KEY_ADVANCEMENT_CLEAR_QUEUE_ITEM_DESCRIPTION = "advancements.crafttracker.main.clear_queue.description"; diff --git a/src/main/java/com/sweetrpg/crafttracker/common/registry/ModAdvancements.java b/src/main/java/com/sweetrpg/crafttracker/common/registry/ModAdvancements.java index b43e8e0..8d0c6cb 100644 --- a/src/main/java/com/sweetrpg/crafttracker/common/registry/ModAdvancements.java +++ b/src/main/java/com/sweetrpg/crafttracker/common/registry/ModAdvancements.java @@ -44,7 +44,6 @@ public class ModAdvancements { .background("stone.png") .build()) .addCriterion(MAIN_CRITERION, ModTriggers.addSimple("craft_item").instance()) -// .parent(QUEUE_ITEM) .requirements(RequirementsStrategy.OR)); public static final Advancement POPULATE_LIST = create("populate_list", Key.POPULATE_LIST, () -> Advancement.Builder.advancement() .display(DisplayInfoBuilder.create() @@ -63,7 +62,6 @@ public class ModAdvancements { .background("stone.png") .build()) .addCriterion(MAIN_CRITERION, ModTriggers.addSimple("acquire_item").instance()) -// .parent(POPULATE_LIST) .requirements(RequirementsStrategy.OR)); public static final Advancement CLEAR_QUEUE = create("clear_queue", Key.CLEAR_QUEUE, () -> Advancement.Builder.advancement() .display(DisplayInfoBuilder.create() @@ -73,7 +71,6 @@ public class ModAdvancements { .background("stone.png") .build()) .addCriterion(MAIN_CRITERION, ModTriggers.addSimple("clear_queue").instance()) -// .parent(QUEUE_ITEM) .requirements(RequirementsStrategy.OR)); diff --git a/src/main/java/com/sweetrpg/crafttracker/data/CTAdvancementProvider.java b/src/main/java/com/sweetrpg/crafttracker/data/CTAdvancementProvider.java index b6e10c5..3b04f1f 100644 --- a/src/main/java/com/sweetrpg/crafttracker/data/CTAdvancementProvider.java +++ b/src/main/java/com/sweetrpg/crafttracker/data/CTAdvancementProvider.java @@ -60,10 +60,10 @@ public void run(HashCache cache) { }; var root = ModAdvancements.ROOT.deconstruct().save(consumer, Util.getResourcePath("main/root")); - var queueItem = ModAdvancements.QUEUE_ITEM.deconstruct().save(consumer, Util.getResourcePath("main/queue_item")); - var craftItem = ModAdvancements.CRAFT_ITEM.deconstruct().save(consumer, Util.getResourcePath("main/craft_item")); - var populateList = ModAdvancements.POPULATE_LIST.deconstruct().save(consumer, Util.getResourcePath("main/populate_list")); - var acquireItem = ModAdvancements.ACQUIRE_ITEM.deconstruct().save(consumer, Util.getResourcePath("main/acquire_item")); - var clearQueue = ModAdvancements.CLEAR_QUEUE.deconstruct().save(consumer, Util.getResourcePath("main/clear_queue")); + var queueItem = ModAdvancements.QUEUE_ITEM.deconstruct().parent(root).save(consumer, Util.getResourcePath("main/queue_item")); + var craftItem = ModAdvancements.CRAFT_ITEM.deconstruct().parent(queueItem).save(consumer, Util.getResourcePath("main/craft_item")); + var populateList = ModAdvancements.POPULATE_LIST.deconstruct().parent(root).save(consumer, Util.getResourcePath("main/populate_list")); + var acquireItem = ModAdvancements.ACQUIRE_ITEM.deconstruct().parent(populateList).save(consumer, Util.getResourcePath("main/acquire_item")); + var clearQueue = ModAdvancements.CLEAR_QUEUE.deconstruct().parent(queueItem).save(consumer, Util.getResourcePath("main/clear_queue")); } }