From e9b0229f7140cb28501ff1af7f538834efd23551 Mon Sep 17 00:00:00 2001 From: zelophed Date: Sat, 9 Sep 2023 15:57:41 +0200 Subject: [PATCH] refactor part of the ponder registration API --- gradle.properties | 4 +- .../foundation/data/AllLangPartials.java | 4 +- .../foundation/ponder/CreatePonderPlugin.java | 33 +- .../infrastructure/ponder/AllPonderTags.java | 506 +++++++++--------- .../ponder/CreatePonderIndex.java | 12 +- 5 files changed, 291 insertions(+), 268 deletions(-) diff --git a/gradle.properties b/gradle.properties index 3ded1fc61..98a7172e9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -28,8 +28,8 @@ jei_minecraft_version = 1.19.2 jei_version = 11.2.0.254 curios_minecraft_version = 1.19.2 curios_version = 5.1.1.0 -catnip_version = 0.6.5 -ponder_version = 0.6.5 +catnip_version = 0.7.11 +ponder_version = 0.7.12 cc_tweaked_enable = true cc_tweaked_minecraft_version = 1.19.2 diff --git a/src/main/java/com/simibubi/create/foundation/data/AllLangPartials.java b/src/main/java/com/simibubi/create/foundation/data/AllLangPartials.java index e41c9ef90..cabef9498 100644 --- a/src/main/java/com/simibubi/create/foundation/data/AllLangPartials.java +++ b/src/main/java/com/simibubi/create/foundation/data/AllLangPartials.java @@ -7,7 +7,7 @@ import com.simibubi.create.Create; import com.simibubi.create.foundation.advancement.AllAdvancements; import net.createmod.catnip.utility.lang.Lang; -import net.createmod.ponder.foundation.PonderLocalization; +import net.createmod.ponder.foundation.PonderIndex; public enum AllLangPartials implements LangPartial { @@ -15,7 +15,7 @@ public enum AllLangPartials implements LangPartial { INTERFACE("UI & Messages"), SUBTITLES("Subtitles", AllSoundEvents::provideLangEntries), TOOLTIPS("Item Descriptions"), - PONDER("Ponder Content", () -> PonderLocalization.provideLangEntries(Create.ID)), + PONDER("Ponder Content", () -> PonderIndex.getLangAccess().provideLangEntries(Create.ID)), ; diff --git a/src/main/java/com/simibubi/create/foundation/ponder/CreatePonderPlugin.java b/src/main/java/com/simibubi/create/foundation/ponder/CreatePonderPlugin.java index 5e918c70b..feb70b332 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/CreatePonderPlugin.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/CreatePonderPlugin.java @@ -1,6 +1,5 @@ package com.simibubi.create.foundation.ponder; -import java.util.function.BiConsumer; import java.util.function.Predicate; import java.util.stream.Stream; @@ -9,36 +8,40 @@ import com.simibubi.create.infrastructure.ponder.AllPonderTags; import com.simibubi.create.infrastructure.ponder.CreatePonderIndex; import net.createmod.ponder.foundation.PonderLevel; -import net.createmod.ponder.foundation.PonderPlugin; +import net.createmod.ponder.foundation.api.registration.PonderPlugin; +import net.createmod.ponder.foundation.api.registration.PonderSceneRegistrationHelper; +import net.createmod.ponder.foundation.api.registration.PonderTagRegistrationHelper; +import net.createmod.ponder.foundation.api.registration.SharedTextRegistrationHelper; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.ItemLike; public class CreatePonderPlugin implements PonderPlugin { @Override - public String getModID() { + public String getModId() { return Create.ID; } @Override - public void registerScenes() { - CreatePonderIndex.register(); + public void registerScenes(PonderSceneRegistrationHelper helper) { + CreatePonderIndex.register(helper); } @Override - public void registerTags() { - AllPonderTags.register(); + public void registerTags(PonderTagRegistrationHelper helper) { + AllPonderTags.register(helper); } @Override - public void registerSharedText(BiConsumer adder) { - adder.accept("rpm8", "8 RPM"); - adder.accept("rpm16", "16 RPM"); - adder.accept("rpm16_source", "Source: 16 RPM"); - adder.accept("rpm32", "32 RPM"); + public void registerSharedText(SharedTextRegistrationHelper helper) { + helper.registerSharedText("rpm8", "8 RPM"); + helper.registerSharedText("rpm16", "16 RPM"); + helper.registerSharedText("rpm16_source", "Source: 16 RPM"); + helper.registerSharedText("rpm32", "32 RPM"); - adder.accept("movement_anchors", "With the help of Super Glue, larger structures can be moved."); - adder.accept("behaviour_modify_wrench", "This behaviour can be modified using a Wrench"); - adder.accept("storage_on_contraption", "Inventories attached to the Contraption will pick up their drops automatically"); + helper.registerSharedText("movement_anchors", "With the help of Super Glue, larger structures can be moved."); + helper.registerSharedText("behaviour_modify_wrench", "This behaviour can be modified using a Wrench"); + helper.registerSharedText("storage_on_contraption", "Inventories attached to the Contraption will pick up their drops automatically"); } @Override diff --git a/src/main/java/com/simibubi/create/infrastructure/ponder/AllPonderTags.java b/src/main/java/com/simibubi/create/infrastructure/ponder/AllPonderTags.java index d03a8a0ec..51e73e676 100644 --- a/src/main/java/com/simibubi/create/infrastructure/ponder/AllPonderTags.java +++ b/src/main/java/com/simibubi/create/infrastructure/ponder/AllPonderTags.java @@ -4,330 +4,354 @@ import com.simibubi.create.AllBlocks; import com.simibubi.create.AllItems; import com.simibubi.create.Create; import com.simibubi.create.compat.Mods; -import com.tterrag.registrate.util.entry.ItemProviderEntry; import com.tterrag.registrate.util.entry.RegistryEntry; -import net.createmod.ponder.foundation.CustomPonderRegistrationHelper; +import net.createmod.catnip.platform.CatnipServices; import net.createmod.ponder.foundation.PonderTag; +import net.createmod.ponder.foundation.api.registration.PonderTagRegistrationHelper; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.Items; +import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraftforge.registries.ForgeRegistries; public class AllPonderTags { - private static final CustomPonderRegistrationHelper> HELPER = new CustomPonderRegistrationHelper<>(Create.ID, RegistryEntry::getId); - public static final PonderTag KINETIC_RELAYS = create("kinetic_relays").item(AllBlocks.COGWHEEL.get()) - .defaultLang("Kinetic Blocks", "Components which help relaying Rotational Force elsewhere") - .addToIndex(), + .defaultLang("Kinetic Blocks", "Components which help relaying Rotational Force elsewhere"), - KINETIC_SOURCES = create("kinetic_sources").item(AllBlocks.WATER_WHEEL.get()) - .defaultLang("Kinetic Sources", "Components which generate Rotational Force") - .addToIndex(), + KINETIC_SOURCES = create("kinetic_sources").item(AllBlocks.WATER_WHEEL.get()) + .defaultLang("Kinetic Sources", "Components which generate Rotational Force"), - KINETIC_APPLIANCES = create("kinetic_appliances").item(AllBlocks.MECHANICAL_PRESS.get()) - .defaultLang("Kinetic Appliances", "Components which make use of Rotational Force") - .addToIndex(), + KINETIC_APPLIANCES = create("kinetic_appliances").item(AllBlocks.MECHANICAL_PRESS.get()) + .defaultLang("Kinetic Appliances", "Components which make use of Rotational Force"), - FLUIDS = create("fluids").item(AllBlocks.FLUID_PIPE.get()) - .defaultLang("Fluid Manipulators", "Components which help relaying and making use of Fluids") - .addToIndex(), + FLUIDS = create("fluids").item(AllBlocks.FLUID_PIPE.get()) + .defaultLang("Fluid Manipulators", "Components which help relaying and making use of Fluids"), - LOGISTICS = create("logistics").item(Blocks.CHEST) - .defaultLang("Item Transportation", "Components which help moving items around") - .addToIndex(), + LOGISTICS = create("logistics").item(Blocks.CHEST) + .defaultLang("Item Transportation", "Components which help moving items around"), - REDSTONE = create("redstone").item(Items.REDSTONE) - .defaultLang("Logic Components", "Components which help with redstone engineering") - .addToIndex(), + REDSTONE = create("redstone").item(Items.REDSTONE) + .defaultLang("Logic Components", "Components which help with redstone engineering"), - DECORATION = create("decoration").item(Items.ROSE_BUSH) + DECORATION = create("decoration").item(Items.ROSE_BUSH) .defaultLang("Aesthetics", "Components used mostly for decorative purposes"), - CREATIVE = create("creative").item(AllBlocks.CREATIVE_CRATE.get()) - .defaultLang("Creative Mode", "Components not usually available for Survival Mode") - .addToIndex(), + CREATIVE = create("creative").item(AllBlocks.CREATIVE_CRATE.get()) + .defaultLang("Creative Mode", "Components not usually available for Survival Mode"), - MOVEMENT_ANCHOR = create("movement_anchor").item(AllBlocks.MECHANICAL_PISTON.get()) + MOVEMENT_ANCHOR = create("movement_anchor").item(AllBlocks.MECHANICAL_PISTON.get()) .defaultLang("Movement Anchors", - "Components which allow the creation of moving contraptions, animating an attached structure in a variety of ways") - .addToIndex(), + "Components which allow the creation of moving contraptions, animating an attached structure in a variety of ways"), - CONTRAPTION_ACTOR = create("contraption_actor").item(AllBlocks.MECHANICAL_HARVESTER.get()) + CONTRAPTION_ACTOR = create("contraption_actor").item(AllBlocks.MECHANICAL_HARVESTER.get()) .defaultLang("Contraption Actors", - "Components which expose special behaviour when attached to a moving contraption") - .addToIndex(), + "Components which expose special behaviour when attached to a moving contraption"), - CONTRAPTION_ASSEMBLY = create("contraption_assembly").item(AllItems.SUPER_GLUE.get()) + CONTRAPTION_ASSEMBLY = create("contraption_assembly").item(AllItems.SUPER_GLUE.get()) .defaultLang("Block Attachment Utility", - "Tools and Components used to assemble structures moved as an animated Contraption") - .addToIndex(), + "Tools and Components used to assemble structures moved as an animated Contraption"), - SAILS = create("windmill_sails").item(AllBlocks.WINDMILL_BEARING.get(), true, true) + SAILS = create("windmill_sails").item(AllBlocks.WINDMILL_BEARING.get(), true, true) .defaultLang("Sails for Windmill Bearings", - "Blocks that count towards the strength of a Windmill Contraption when assembled. Each of these have equal efficiency in doing so."), + "Blocks that count towards the strength of a Windmill Contraption when assembled. Each of these have equal efficiency in doing so."), - ARM_TARGETS = create("arm_targets").item(AllBlocks.MECHANICAL_ARM.get(), true, true) + ARM_TARGETS = create("arm_targets").item(AllBlocks.MECHANICAL_ARM.get(), true, true) .defaultLang("Targets for Mechanical Arms", - "Components which can be selected as inputs or outputs to the Mechanical Arm"), + "Components which can be selected as inputs or outputs to the Mechanical Arm"), - TRAIN_RELATED = create("train_related").item(AllBlocks.TRACK.get()) - .defaultLang("Railway Equipment", "Components used in the construction or management of Train Contraptions") - .addToIndex(), + TRAIN_RELATED = create("train_related").item(AllBlocks.TRACK.get()) + .defaultLang("Railway Equipment", + "Components used in the construction or management of Train Contraptions"), - RECENTLY_UPDATED = create("recently_updated").item(AllBlocks.CLIPBOARD.get()) + RECENTLY_UPDATED = create("recently_updated").item(AllBlocks.CLIPBOARD.get()) .defaultLang("Recent Changes", - "Components that have been added or changed significantly in the latest versions of Create") - .addToIndex(), + "Components that have been added or changed significantly in the latest versions of Create"), - DISPLAY_SOURCES = create("display_sources").item(AllBlocks.DISPLAY_LINK.get(), true, true) + DISPLAY_SOURCES = create("display_sources").item(AllBlocks.DISPLAY_LINK.get(), true, true) .defaultLang("Sources for Display Links", - "Components or Blocks which offer some data that can be read with a Display Link"), + "Components or Blocks which offer some data that can be read with a Display Link"), - DISPLAY_TARGETS = create("display_targets").item(AllBlocks.DISPLAY_LINK.get(), true, true) + DISPLAY_TARGETS = create("display_targets").item(AllBlocks.DISPLAY_LINK.get(), true, true) .defaultLang("Targets for Display Links", - "Components or Blocks which can process and display the data received from a Display Link"); + "Components or Blocks which can process and display the data received from a Display Link"); private static PonderTag create(String id) { return new PonderTag(Create.asResource(id)); } - public static void register() { - // Add items to tags here + public static void register(PonderTagRegistrationHelper helper) { + + PonderTagRegistrationHelper> HELPER = helper.withKeyFunction(RegistryEntry::getId); + + PonderTagRegistrationHelper itemHelper = helper.withKeyFunction( + CatnipServices.REGISTRIES::getKeyOrThrow); + + helper + .registerTag(KINETIC_RELAYS, true) + .registerTag(KINETIC_SOURCES, true) + .registerTag(KINETIC_APPLIANCES, true) + .registerTag(FLUIDS, true) + .registerTag(LOGISTICS, true) + .registerTag(REDSTONE, true) + .registerTag(DECORATION, true) + .registerTag(CREATIVE, true) + .registerTag(MOVEMENT_ANCHOR, true) + .registerTag(CONTRAPTION_ACTOR, true) + .registerTag(CONTRAPTION_ASSEMBLY, true) + .registerTag(SAILS) + .registerTag(ARM_TARGETS) + .registerTag(TRAIN_RELATED, true) + .registerTag(RECENTLY_UPDATED, true) + .registerTag(DISPLAY_SOURCES) + .registerTag(DISPLAY_TARGETS); HELPER.addToTag(RECENTLY_UPDATED) - .add(AllBlocks.WATER_WHEEL) - .add(AllBlocks.LARGE_WATER_WHEEL) - .add(AllBlocks.COPPER_VALVE_HANDLE) - .add(AllBlocks.ELEVATOR_PULLEY) - .add(AllBlocks.CONTRAPTION_CONTROLS) - .add(AllBlocks.MECHANICAL_ROLLER) - .add(AllBlocks.MECHANICAL_PUMP) - .add(AllBlocks.SMART_OBSERVER) - .add(AllBlocks.THRESHOLD_SWITCH) - .add(AllItems.NETHERITE_BACKTANK) - .add(AllBlocks.COPYCAT_PANEL) - .add(AllBlocks.COPYCAT_STEP); + .add(AllBlocks.WATER_WHEEL) + .add(AllBlocks.LARGE_WATER_WHEEL) + .add(AllBlocks.COPPER_VALVE_HANDLE) + .add(AllBlocks.ELEVATOR_PULLEY) + .add(AllBlocks.CONTRAPTION_CONTROLS) + .add(AllBlocks.MECHANICAL_ROLLER) + .add(AllBlocks.MECHANICAL_PUMP) + .add(AllBlocks.SMART_OBSERVER) + .add(AllBlocks.THRESHOLD_SWITCH) + .add(AllItems.NETHERITE_BACKTANK) + .add(AllBlocks.COPYCAT_PANEL) + .add(AllBlocks.COPYCAT_STEP); HELPER.addToTag(KINETIC_RELAYS) - .add(AllBlocks.SHAFT) - .add(AllBlocks.COGWHEEL) - .add(AllBlocks.LARGE_COGWHEEL) - .add(AllItems.BELT_CONNECTOR) - .add(AllBlocks.GEARBOX) - .add(AllBlocks.CLUTCH) - .add(AllBlocks.GEARSHIFT) - .add(AllBlocks.ENCASED_CHAIN_DRIVE) - .add(AllBlocks.ADJUSTABLE_CHAIN_GEARSHIFT) - .add(AllBlocks.SEQUENCED_GEARSHIFT) - .add(AllBlocks.ROTATION_SPEED_CONTROLLER); + .add(AllBlocks.SHAFT) + .add(AllBlocks.COGWHEEL) + .add(AllBlocks.LARGE_COGWHEEL) + .add(AllItems.BELT_CONNECTOR) + .add(AllBlocks.GEARBOX) + .add(AllBlocks.CLUTCH) + .add(AllBlocks.GEARSHIFT) + .add(AllBlocks.ENCASED_CHAIN_DRIVE) + .add(AllBlocks.ADJUSTABLE_CHAIN_GEARSHIFT) + .add(AllBlocks.SEQUENCED_GEARSHIFT) + .add(AllBlocks.ROTATION_SPEED_CONTROLLER); HELPER.addToTag(KINETIC_SOURCES) - .add(AllBlocks.HAND_CRANK) - .add(AllBlocks.COPPER_VALVE_HANDLE) - .add(AllBlocks.WATER_WHEEL) - .add(AllBlocks.LARGE_WATER_WHEEL) - .add(AllBlocks.WINDMILL_BEARING) - .add(AllBlocks.STEAM_ENGINE) - .add(AllBlocks.CREATIVE_MOTOR); + .add(AllBlocks.HAND_CRANK) + .add(AllBlocks.COPPER_VALVE_HANDLE) + .add(AllBlocks.WATER_WHEEL) + .add(AllBlocks.LARGE_WATER_WHEEL) + .add(AllBlocks.WINDMILL_BEARING) + .add(AllBlocks.STEAM_ENGINE) + .add(AllBlocks.CREATIVE_MOTOR); HELPER.addToTag(TRAIN_RELATED) - .add(AllBlocks.TRACK) - .add(AllBlocks.TRACK_STATION) - .add(AllBlocks.TRACK_SIGNAL) - .add(AllBlocks.TRACK_OBSERVER) - .add(AllBlocks.TRAIN_CONTROLS) - .add(AllItems.SCHEDULE) - .add(AllBlocks.TRAIN_DOOR) - .add(AllBlocks.TRAIN_TRAPDOOR) - .add(AllBlocks.RAILWAY_CASING); + .add(AllBlocks.TRACK) + .add(AllBlocks.TRACK_STATION) + .add(AllBlocks.TRACK_SIGNAL) + .add(AllBlocks.TRACK_OBSERVER) + .add(AllBlocks.TRAIN_CONTROLS) + .add(AllItems.SCHEDULE) + .add(AllBlocks.TRAIN_DOOR) + .add(AllBlocks.TRAIN_TRAPDOOR) + .add(AllBlocks.RAILWAY_CASING); HELPER.addToTag(KINETIC_APPLIANCES) - .add(AllBlocks.MILLSTONE) - .add(AllBlocks.TURNTABLE) - .add(AllBlocks.ENCASED_FAN) - .add(AllBlocks.CUCKOO_CLOCK) - .add(AllBlocks.MECHANICAL_PRESS) - .add(AllBlocks.MECHANICAL_MIXER) - .add(AllBlocks.MECHANICAL_CRAFTER) - .add(AllBlocks.MECHANICAL_DRILL) - .add(AllBlocks.MECHANICAL_SAW) - .add(AllBlocks.DEPLOYER) - .add(AllBlocks.MECHANICAL_PUMP) - .add(AllBlocks.MECHANICAL_ARM) - .add(AllBlocks.MECHANICAL_PISTON) - .add(AllBlocks.ROPE_PULLEY) - .add(AllBlocks.ELEVATOR_PULLEY) - .add(AllBlocks.MECHANICAL_BEARING) - .add(AllBlocks.GANTRY_SHAFT) - .add(AllBlocks.GANTRY_CARRIAGE) - .add(AllBlocks.CLOCKWORK_BEARING) - .add(AllBlocks.DISPLAY_BOARD) - .add(AllBlocks.CRUSHING_WHEEL); + .add(AllBlocks.MILLSTONE) + .add(AllBlocks.TURNTABLE) + .add(AllBlocks.ENCASED_FAN) + .add(AllBlocks.CUCKOO_CLOCK) + .add(AllBlocks.MECHANICAL_PRESS) + .add(AllBlocks.MECHANICAL_MIXER) + .add(AllBlocks.MECHANICAL_CRAFTER) + .add(AllBlocks.MECHANICAL_DRILL) + .add(AllBlocks.MECHANICAL_SAW) + .add(AllBlocks.DEPLOYER) + .add(AllBlocks.MECHANICAL_PUMP) + .add(AllBlocks.MECHANICAL_ARM) + .add(AllBlocks.MECHANICAL_PISTON) + .add(AllBlocks.ROPE_PULLEY) + .add(AllBlocks.ELEVATOR_PULLEY) + .add(AllBlocks.MECHANICAL_BEARING) + .add(AllBlocks.GANTRY_SHAFT) + .add(AllBlocks.GANTRY_CARRIAGE) + .add(AllBlocks.CLOCKWORK_BEARING) + .add(AllBlocks.DISPLAY_BOARD) + .add(AllBlocks.CRUSHING_WHEEL); HELPER.addToTag(FLUIDS) - .add(AllBlocks.FLUID_PIPE) - .add(AllBlocks.MECHANICAL_PUMP) - .add(AllBlocks.FLUID_VALVE) - .add(AllBlocks.SMART_FLUID_PIPE) - .add(AllBlocks.HOSE_PULLEY) - .add(AllBlocks.ITEM_DRAIN) - .add(AllBlocks.SPOUT) - .add(AllBlocks.PORTABLE_FLUID_INTERFACE) - .add(AllBlocks.FLUID_TANK) - .add(AllBlocks.CREATIVE_FLUID_TANK); + .add(AllBlocks.FLUID_PIPE) + .add(AllBlocks.MECHANICAL_PUMP) + .add(AllBlocks.FLUID_VALVE) + .add(AllBlocks.SMART_FLUID_PIPE) + .add(AllBlocks.HOSE_PULLEY) + .add(AllBlocks.ITEM_DRAIN) + .add(AllBlocks.SPOUT) + .add(AllBlocks.PORTABLE_FLUID_INTERFACE) + .add(AllBlocks.FLUID_TANK) + .add(AllBlocks.CREATIVE_FLUID_TANK); HELPER.addToTag(ARM_TARGETS) - .add(AllBlocks.MECHANICAL_ARM) - .add(AllItems.BELT_CONNECTOR) - .add(AllBlocks.CHUTE) - .add(AllBlocks.DEPOT) - .add(AllBlocks.WEIGHTED_EJECTOR) - .add(AllBlocks.BASIN) - .add(AllBlocks.ANDESITE_FUNNEL) - .add(AllBlocks.BRASS_FUNNEL) - .add(AllBlocks.MECHANICAL_CRAFTER) - .add(AllBlocks.MILLSTONE) - .add(AllBlocks.DEPLOYER) - .add(AllBlocks.MECHANICAL_SAW) - .add(AllBlocks.BLAZE_BURNER) - .add(AllBlocks.CRUSHING_WHEEL) - .add(AllBlocks.TRACK_STATION) - .add(Blocks.COMPOSTER) - .add(Blocks.JUKEBOX) - .add(Blocks.CAMPFIRE) - .add(Blocks.SOUL_CAMPFIRE) - .add(Blocks.RESPAWN_ANCHOR); + .add(AllBlocks.MECHANICAL_ARM) + .add(AllItems.BELT_CONNECTOR) + .add(AllBlocks.CHUTE) + .add(AllBlocks.DEPOT) + .add(AllBlocks.WEIGHTED_EJECTOR) + .add(AllBlocks.BASIN) + .add(AllBlocks.ANDESITE_FUNNEL) + .add(AllBlocks.BRASS_FUNNEL) + .add(AllBlocks.MECHANICAL_CRAFTER) + .add(AllBlocks.MILLSTONE) + .add(AllBlocks.DEPLOYER) + .add(AllBlocks.MECHANICAL_SAW) + .add(AllBlocks.BLAZE_BURNER) + .add(AllBlocks.CRUSHING_WHEEL) + .add(AllBlocks.TRACK_STATION); + + itemHelper.addToTag(ARM_TARGETS) + .add(Blocks.COMPOSTER) + .add(Blocks.JUKEBOX) + .add(Blocks.CAMPFIRE) + .add(Blocks.SOUL_CAMPFIRE) + .add(Blocks.RESPAWN_ANCHOR); HELPER.addToTag(LOGISTICS) - .add(AllItems.BELT_CONNECTOR) - .add(AllItems.FILTER) - .add(AllItems.ATTRIBUTE_FILTER) - .add(AllBlocks.CHUTE) - .add(AllBlocks.SMART_CHUTE) - .add(AllBlocks.ITEM_VAULT) - .add(AllBlocks.DEPOT) - .add(AllBlocks.WEIGHTED_EJECTOR) - .add(AllBlocks.MECHANICAL_ARM) - .add(AllBlocks.ANDESITE_FUNNEL) - .add(AllBlocks.BRASS_FUNNEL) - .add(AllBlocks.ANDESITE_TUNNEL) - .add(AllBlocks.BRASS_TUNNEL) - .add(AllBlocks.SMART_OBSERVER) - .add(AllBlocks.THRESHOLD_SWITCH) - .add(AllBlocks.CREATIVE_CRATE) - .add(AllBlocks.PORTABLE_STORAGE_INTERFACE); + .add(AllItems.BELT_CONNECTOR) + .add(AllItems.FILTER) + .add(AllItems.ATTRIBUTE_FILTER) + .add(AllBlocks.CHUTE) + .add(AllBlocks.SMART_CHUTE) + .add(AllBlocks.ITEM_VAULT) + .add(AllBlocks.DEPOT) + .add(AllBlocks.WEIGHTED_EJECTOR) + .add(AllBlocks.MECHANICAL_ARM) + .add(AllBlocks.ANDESITE_FUNNEL) + .add(AllBlocks.BRASS_FUNNEL) + .add(AllBlocks.ANDESITE_TUNNEL) + .add(AllBlocks.BRASS_TUNNEL) + .add(AllBlocks.SMART_OBSERVER) + .add(AllBlocks.THRESHOLD_SWITCH) + .add(AllBlocks.CREATIVE_CRATE) + .add(AllBlocks.PORTABLE_STORAGE_INTERFACE); HELPER.addToTag(DECORATION) - .add(AllBlocks.ORANGE_NIXIE_TUBE) - .add(AllBlocks.DISPLAY_BOARD) - .add(AllBlocks.CUCKOO_CLOCK) - .add(AllBlocks.WOODEN_BRACKET) - .add(AllBlocks.METAL_BRACKET) - .add(AllBlocks.METAL_GIRDER) - .add(AllBlocks.ANDESITE_CASING) - .add(AllBlocks.BRASS_CASING) - .add(AllBlocks.COPPER_CASING) - .add(AllBlocks.RAILWAY_CASING); + .add(AllBlocks.ORANGE_NIXIE_TUBE) + .add(AllBlocks.DISPLAY_BOARD) + .add(AllBlocks.CUCKOO_CLOCK) + .add(AllBlocks.WOODEN_BRACKET) + .add(AllBlocks.METAL_BRACKET) + .add(AllBlocks.METAL_GIRDER) + .add(AllBlocks.ANDESITE_CASING) + .add(AllBlocks.BRASS_CASING) + .add(AllBlocks.COPPER_CASING) + .add(AllBlocks.RAILWAY_CASING); HELPER.addToTag(CREATIVE) - .add(AllBlocks.CREATIVE_CRATE) - .add(AllBlocks.CREATIVE_FLUID_TANK) - .add(AllBlocks.CREATIVE_MOTOR); + .add(AllBlocks.CREATIVE_CRATE) + .add(AllBlocks.CREATIVE_FLUID_TANK) + .add(AllBlocks.CREATIVE_MOTOR); HELPER.addToTag(SAILS) - .add(AllBlocks.SAIL) - .add(AllBlocks.SAIL_FRAME) - .add(Blocks.WHITE_WOOL); + .add(AllBlocks.SAIL) + .add(AllBlocks.SAIL_FRAME); + + itemHelper.addToTag(SAILS) + .add(Blocks.WHITE_WOOL); HELPER.addToTag(REDSTONE) - .add(AllBlocks.SMART_OBSERVER) - .add(AllBlocks.THRESHOLD_SWITCH) - .add(AllBlocks.ORANGE_NIXIE_TUBE) - .add(AllBlocks.REDSTONE_CONTACT) - .add(AllBlocks.ANALOG_LEVER) - .add(AllBlocks.REDSTONE_LINK) - .add(AllBlocks.PULSE_EXTENDER) - .add(AllBlocks.PULSE_REPEATER) - .add(AllBlocks.POWERED_LATCH) - .add(AllBlocks.POWERED_TOGGLE_LATCH) - .add(AllBlocks.ROSE_QUARTZ_LAMP); + .add(AllBlocks.SMART_OBSERVER) + .add(AllBlocks.THRESHOLD_SWITCH) + .add(AllBlocks.ORANGE_NIXIE_TUBE) + .add(AllBlocks.REDSTONE_CONTACT) + .add(AllBlocks.ANALOG_LEVER) + .add(AllBlocks.REDSTONE_LINK) + .add(AllBlocks.PULSE_EXTENDER) + .add(AllBlocks.PULSE_REPEATER) + .add(AllBlocks.POWERED_LATCH) + .add(AllBlocks.POWERED_TOGGLE_LATCH) + .add(AllBlocks.ROSE_QUARTZ_LAMP); HELPER.addToTag(MOVEMENT_ANCHOR) - .add(AllBlocks.MECHANICAL_PISTON) - .add(AllBlocks.WINDMILL_BEARING) - .add(AllBlocks.MECHANICAL_BEARING) - .add(AllBlocks.CLOCKWORK_BEARING) - .add(AllBlocks.ROPE_PULLEY) - .add(AllBlocks.ELEVATOR_PULLEY) - .add(AllBlocks.GANTRY_CARRIAGE) - .add(AllBlocks.CART_ASSEMBLER) - .add(AllBlocks.TRACK_STATION); + .add(AllBlocks.MECHANICAL_PISTON) + .add(AllBlocks.WINDMILL_BEARING) + .add(AllBlocks.MECHANICAL_BEARING) + .add(AllBlocks.CLOCKWORK_BEARING) + .add(AllBlocks.ROPE_PULLEY) + .add(AllBlocks.ELEVATOR_PULLEY) + .add(AllBlocks.GANTRY_CARRIAGE) + .add(AllBlocks.CART_ASSEMBLER) + .add(AllBlocks.TRACK_STATION); HELPER.addToTag(CONTRAPTION_ASSEMBLY) - .add(AllBlocks.LINEAR_CHASSIS) - .add(AllBlocks.SECONDARY_LINEAR_CHASSIS) - .add(AllBlocks.RADIAL_CHASSIS) - .add(AllItems.SUPER_GLUE) - .add(AllBlocks.STICKER) - .add(Blocks.SLIME_BLOCK) - .add(Blocks.HONEY_BLOCK); + .add(AllBlocks.LINEAR_CHASSIS) + .add(AllBlocks.SECONDARY_LINEAR_CHASSIS) + .add(AllBlocks.RADIAL_CHASSIS) + .add(AllItems.SUPER_GLUE) + .add(AllBlocks.STICKER); + + itemHelper.addToTag(CONTRAPTION_ASSEMBLY) + .add(Blocks.SLIME_BLOCK) + .add(Blocks.HONEY_BLOCK); HELPER.addToTag(CONTRAPTION_ACTOR) - .add(AllBlocks.MECHANICAL_HARVESTER) - .add(AllBlocks.MECHANICAL_PLOUGH) - .add(AllBlocks.MECHANICAL_DRILL) - .add(AllBlocks.MECHANICAL_SAW) - .add(AllBlocks.DEPLOYER) - .add(AllBlocks.PORTABLE_STORAGE_INTERFACE) - .add(AllBlocks.PORTABLE_FLUID_INTERFACE) - .add(AllBlocks.MECHANICAL_BEARING) - .add(AllBlocks.ANDESITE_FUNNEL) - .add(AllBlocks.BRASS_FUNNEL) - .add(AllBlocks.SEATS.get(DyeColor.WHITE)) - .add(AllBlocks.TRAIN_CONTROLS) - .add(AllBlocks.CONTRAPTION_CONTROLS) - .add(AllBlocks.REDSTONE_CONTACT) - .add(Blocks.BELL) - .add(Blocks.DISPENSER) - .add(Blocks.DROPPER); + .add(AllBlocks.MECHANICAL_HARVESTER) + .add(AllBlocks.MECHANICAL_PLOUGH) + .add(AllBlocks.MECHANICAL_DRILL) + .add(AllBlocks.MECHANICAL_SAW) + .add(AllBlocks.DEPLOYER) + .add(AllBlocks.PORTABLE_STORAGE_INTERFACE) + .add(AllBlocks.PORTABLE_FLUID_INTERFACE) + .add(AllBlocks.MECHANICAL_BEARING) + .add(AllBlocks.ANDESITE_FUNNEL) + .add(AllBlocks.BRASS_FUNNEL) + .add(AllBlocks.SEATS.get(DyeColor.WHITE)) + .add(AllBlocks.TRAIN_CONTROLS) + .add(AllBlocks.CONTRAPTION_CONTROLS) + .add(AllBlocks.REDSTONE_CONTACT); + + itemHelper.addToTag(CONTRAPTION_ACTOR) + .add(Blocks.BELL) + .add(Blocks.DISPENSER) + .add(Blocks.DROPPER); HELPER.addToTag(DISPLAY_SOURCES) - .add(AllBlocks.SEATS.get(DyeColor.WHITE)) - .add(AllBlocks.ORANGE_NIXIE_TUBE) - .add(AllBlocks.THRESHOLD_SWITCH) - .add(AllBlocks.SMART_OBSERVER) - .add(AllBlocks.ANDESITE_TUNNEL) - .add(AllBlocks.TRACK_OBSERVER) - .add(AllBlocks.TRACK_STATION) - .add(AllBlocks.DISPLAY_LINK) - .add(AllBlocks.BRASS_TUNNEL) - .add(AllBlocks.CUCKOO_CLOCK) - .add(AllBlocks.STRESSOMETER) - .add(AllBlocks.SPEEDOMETER) - .add(AllBlocks.FLUID_TANK) - .add(AllItems.BELT_CONNECTOR) - .add(Blocks.ENCHANTING_TABLE) - .add(Blocks.RESPAWN_ANCHOR) - .add(Blocks.COMMAND_BLOCK) - .add(Blocks.TARGET); + .add(AllBlocks.SEATS.get(DyeColor.WHITE)) + .add(AllBlocks.ORANGE_NIXIE_TUBE) + .add(AllBlocks.THRESHOLD_SWITCH) + .add(AllBlocks.SMART_OBSERVER) + .add(AllBlocks.ANDESITE_TUNNEL) + .add(AllBlocks.TRACK_OBSERVER) + .add(AllBlocks.TRACK_STATION) + .add(AllBlocks.DISPLAY_LINK) + .add(AllBlocks.BRASS_TUNNEL) + .add(AllBlocks.CUCKOO_CLOCK) + .add(AllBlocks.STRESSOMETER) + .add(AllBlocks.SPEEDOMETER) + .add(AllBlocks.FLUID_TANK) + .add(AllItems.BELT_CONNECTOR); + + itemHelper.addToTag(DISPLAY_SOURCES) + .add(Blocks.ENCHANTING_TABLE) + .add(Blocks.RESPAWN_ANCHOR) + .add(Blocks.COMMAND_BLOCK) + .add(Blocks.TARGET); Mods.COMPUTERCRAFT.executeIfInstalled(() -> () -> { Block computer = ForgeRegistries.BLOCKS.getValue(Mods.COMPUTERCRAFT.rl("computer_advanced")); if (computer != null) - HELPER.addToTag(DISPLAY_SOURCES).add(computer); + itemHelper.addToTag(DISPLAY_SOURCES).add(computer); }); HELPER.addToTag(DISPLAY_TARGETS) - .add(AllBlocks.ORANGE_NIXIE_TUBE) - .add(AllBlocks.DISPLAY_BOARD) - .add(AllBlocks.DISPLAY_LINK) - .add(Blocks.OAK_SIGN) - .add(Blocks.LECTERN); + .add(AllBlocks.ORANGE_NIXIE_TUBE) + .add(AllBlocks.DISPLAY_BOARD) + .add(AllBlocks.DISPLAY_LINK); + + itemHelper.addToTag(DISPLAY_TARGETS) + .add(Blocks.OAK_SIGN) + .add(Blocks.LECTERN); } } diff --git a/src/main/java/com/simibubi/create/infrastructure/ponder/CreatePonderIndex.java b/src/main/java/com/simibubi/create/infrastructure/ponder/CreatePonderIndex.java index 4f8fe6bd2..7645966a1 100644 --- a/src/main/java/com/simibubi/create/infrastructure/ponder/CreatePonderIndex.java +++ b/src/main/java/com/simibubi/create/infrastructure/ponder/CreatePonderIndex.java @@ -54,7 +54,8 @@ import com.tterrag.registrate.util.entry.BlockEntry; import com.tterrag.registrate.util.entry.ItemProviderEntry; import com.tterrag.registrate.util.entry.RegistryEntry; -import net.createmod.ponder.foundation.CustomPonderRegistrationHelper; +import net.createmod.ponder.foundation.api.registration.PonderSceneRegistrationHelper; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.BlockItem; import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.block.Block; @@ -62,9 +63,6 @@ import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.RegistryObject; public class CreatePonderIndex { - - static final CustomPonderRegistrationHelper> HELPER = new CustomPonderRegistrationHelper<>(Create.ID, RegistryEntry::getId); - public static final List> INDEX_SCREEN_EXCLUSIONS = List.of( itemLike -> { if (!(itemLike instanceof BlockItem blockItem)) @@ -78,10 +76,8 @@ public class CreatePonderIndex { } ); - public static void register() { - // Register storyboards here - // (!) Added entries require re-launch - // (!) Modifications inside storyboard methods only require re-opening the ui + public static void register(PonderSceneRegistrationHelper helper) { + PonderSceneRegistrationHelper> HELPER = helper.withKeyFunction(RegistryEntry::getId); HELPER.forComponents(AllBlocks.SHAFT) .addStoryBoard("shaft/relay", KineticsScenes::shaftAsRelay, AllPonderTags.KINETIC_RELAYS);