From a6079ff9af471e18bc935a9bfc5869a0dccbda94 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Sun, 19 Nov 2023 14:44:35 -0500 Subject: [PATCH] feat: Make "A New Gauge" Advancement check for AllItemTags#TRACKS --- src/generated/resources/.cache/cache | 3 ++- .../data/create/advancements/track_0.json | 4 +--- .../data/create/tags/items/tracks.json | 6 ++++++ .../java/com/simibubi/create/AllBlocks.java | 1 + .../java/com/simibubi/create/AllTags.java | 21 ++++++++++--------- .../advancement/AllAdvancements.java | 5 +++-- .../advancement/CreateAdvancement.java | 4 ++++ 7 files changed, 28 insertions(+), 16 deletions(-) create mode 100644 src/generated/resources/data/create/tags/items/tracks.json diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index e18493cbf..d9f92123b 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -3237,7 +3237,7 @@ c02335d1e84dffdc0c50e8ba2a27ce84366a5f6d data/create/advancements/steam_whistle. 0cb2a6357d3bcabb9dc2c87863a77cf53e8dcef1 data/create/advancements/stressometer_maxed.json 566d3804e962be45c80c8debb2eb2761b2ded905 data/create/advancements/sturdy_sheet.json 1c431334d71f7e25b9bedc525c642c8cb5271b9f data/create/advancements/super_glue.json -58fd8b7440508a8128d2860eb70a2c5b7a2531f9 data/create/advancements/track_0.json +7c274fba06fb2bf357f817cf47d92ca63f3f8837 data/create/advancements/track_0.json 7388901df65f05074c2a2ad8156cbd76a069cdc6 data/create/advancements/track_crafting_factory.json c6c3a803ff7738a36ac0956eda593f9774e567b5 data/create/advancements/track_signal.json 7f4cb81f3ddf26f47055b369b3f3af82f1894fcb data/create/advancements/train.json @@ -5376,6 +5376,7 @@ ba2e448d208997c8327df19fac39748184d49465 data/create/tags/items/stone_types/ochr 14710201b8b392a414feddff420594fb7194b194 data/create/tags/items/stone_types/tuff.json 634faefc734062b869002bd38aa4e5a2b06d8b9a data/create/tags/items/stone_types/veridium.json d063e12c9ef75f39518c6d129ea35d833464d547 data/create/tags/items/toolboxes.json +ad8fa04f7bbbafd70d0ce158af78a35e899301e2 data/create/tags/items/tracks.json 2f4044c2989b9a8aa394c88617d67a6a310e6b1b data/create/tags/items/upright_on_belt.json 50936b211d94167a35ec78c89954082a336b6269 data/create/tags/items/valve_handles.json f8d83f446d0a2071dca4481251339c4249b2fd3f data/create/tags/items/vanilla_stripped_logs.json diff --git a/src/generated/resources/data/create/advancements/track_0.json b/src/generated/resources/data/create/advancements/track_0.json index da39724f5..dea88be45 100644 --- a/src/generated/resources/data/create/advancements/track_0.json +++ b/src/generated/resources/data/create/advancements/track_0.json @@ -22,9 +22,7 @@ "conditions": { "items": [ { - "items": [ - "create:track" - ] + "tag": "create:tracks" } ] } diff --git a/src/generated/resources/data/create/tags/items/tracks.json b/src/generated/resources/data/create/tags/items/tracks.json new file mode 100644 index 000000000..ef33e72ef --- /dev/null +++ b/src/generated/resources/data/create/tags/items/tracks.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "create:track" + ] +} \ No newline at end of file diff --git a/src/main/java/com/simibubi/create/AllBlocks.java b/src/main/java/com/simibubi/create/AllBlocks.java index 443e4ce0c..9507c3f87 100644 --- a/src/main/java/com/simibubi/create/AllBlocks.java +++ b/src/main/java/com/simibubi/create/AllBlocks.java @@ -1534,6 +1534,7 @@ public class AllBlocks { .tag(AllBlockTags.GIRDABLE_TRACKS.tag) .lang("Train Track") .item(TrackBlockItem::new) + .tag(AllItemTags.TRACKS.tag) .model((c, p) -> p.generated(c, Create.asResource("item/" + c.getName()))) .build() .register(); diff --git a/src/main/java/com/simibubi/create/AllTags.java b/src/main/java/com/simibubi/create/AllTags.java index 34b19c19e..2ac66e197 100644 --- a/src/main/java/com/simibubi/create/AllTags.java +++ b/src/main/java/com/simibubi/create/AllTags.java @@ -53,7 +53,7 @@ public class AllTags { } public enum NameSpace { - + MOD(Create.ID, false, true), FORGE("forge"), TIC("tconstruct"), @@ -77,7 +77,7 @@ public class AllTags { } public enum AllBlockTags { - + BRITTLE, CASING, CONTRAPTION_INVENTORY_DENY, @@ -154,11 +154,11 @@ public class AllTags { } private static void init() {} - + } public enum AllItemTags { - + BLAZE_BURNER_FUEL_REGULAR(MOD, "blaze_burner_fuel/regular"), BLAZE_BURNER_FUEL_SPECIAL(MOD, "blaze_burner_fuel/special"), CASING, @@ -173,6 +173,7 @@ public class AllTags { SEATS, SLEEPERS, TOOLBOXES, + TRACKS, UPRIGHT_ON_BELT, VALVE_HANDLES, VANILLA_STRIPPED_LOGS, @@ -225,11 +226,11 @@ public class AllTags { } private static void init() {} - + } public enum AllFluidTags { - + BOTTOMLESS_ALLOW(MOD, "bottomless/allow"), BOTTOMLESS_DENY(MOD, "bottomless/deny"), FAN_PROCESSING_CATALYSTS_BLASTING(MOD, "fan_processing_catalysts/blasting"), @@ -280,9 +281,9 @@ public class AllTags { } private static void init() {} - + } - + public enum AllEntityTags { BLAZE_BURNER_CAPTURABLE, @@ -328,9 +329,9 @@ public class AllTags { } private static void init() {} - + } - + public enum AllRecipeSerializerTags { AUTOMATION_IGNORE, diff --git a/src/main/java/com/simibubi/create/foundation/advancement/AllAdvancements.java b/src/main/java/com/simibubi/create/foundation/advancement/AllAdvancements.java index bef957bf2..ad1fbf5e1 100644 --- a/src/main/java/com/simibubi/create/foundation/advancement/AllAdvancements.java +++ b/src/main/java/com/simibubi/create/foundation/advancement/AllAdvancements.java @@ -23,6 +23,7 @@ import com.mojang.logging.LogUtils; import com.simibubi.create.AllBlocks; import com.simibubi.create.AllFluids; import com.simibubi.create.AllItems; +import com.simibubi.create.AllTags.AllItemTags; import com.simibubi.create.foundation.advancement.CreateAdvancement.Builder; import net.minecraft.advancements.Advancement; @@ -328,7 +329,7 @@ public class AllAdvancements implements DataProvider { .description("Create Chocolate Glazed Berries, a Honeyed Apple, and a Sweet Roll all from the same Spout") .after(STEAM_ENGINE_MAXED) .special(EXPERT)), - + DIVING_SUIT_LAVA = create("diving_suit_lava", b -> b.icon(AllItems.NETHERITE_DIVING_HELMET) .title("Swimming with the Striders") .description("Attempt to take a dive in lava with your netherite diving gear") @@ -543,7 +544,7 @@ public class AllAdvancements implements DataProvider { TRAIN_TRACK = create("track_0", b -> b.icon(AllBlocks.TRACK) .title("A New Gauge") .description("Obtain some Train Tracks") - .whenIconCollected() + .whenItemCollected(AllItemTags.TRACKS.tag) .after(STURDY_SHEET)), TRAIN_WHISTLE = create("train_whistle", b -> b.icon(AllBlocks.STEAM_WHISTLE) diff --git a/src/main/java/com/simibubi/create/foundation/advancement/CreateAdvancement.java b/src/main/java/com/simibubi/create/foundation/advancement/CreateAdvancement.java index b6e409715..8c87050a0 100644 --- a/src/main/java/com/simibubi/create/foundation/advancement/CreateAdvancement.java +++ b/src/main/java/com/simibubi/create/foundation/advancement/CreateAdvancement.java @@ -11,14 +11,18 @@ import com.tterrag.registrate.util.entry.ItemProviderEntry; import net.minecraft.advancements.Advancement; import net.minecraft.advancements.CriterionTriggerInstance; import net.minecraft.advancements.FrameType; +import net.minecraft.advancements.critereon.BlockPredicate; import net.minecraft.advancements.critereon.EnchantmentPredicate; import net.minecraft.advancements.critereon.InventoryChangeTrigger; import net.minecraft.advancements.critereon.ItemPredicate; import net.minecraft.advancements.critereon.MinMaxBounds; import net.minecraft.advancements.critereon.NbtPredicate; import net.minecraft.advancements.critereon.PlacedBlockTrigger; +import net.minecraft.advancements.critereon.StatePropertiesPredicate; +import net.minecraft.core.Registry; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerPlayer; +import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item;