Skip to content

Commit

Permalink
Parenting and bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
paulyhedral committed Dec 6, 2024
1 parent 0105e7b commit 651b8fb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -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));


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}
}

0 comments on commit 651b8fb

Please sign in to comment.