Created
June 15, 2026 16:36
-
-
Save ApexModder/9baa8bb599345ae76cd6d98ace736496 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static final DeferredRegister.Blocks BLOCKS = DeferredRegister.createBlocks(ID); | |
| public static final DeferredRegister.Items ITEMS = DeferredRegister.createItems(ID); | |
| public static final ColorCollection<DeferredHolder<Block, Block>> WOOL_BLOCKS = registerBlocks( | |
| BLOCKS, | |
| "wool", | |
| (color, properties) -> new Block(properties), | |
| color -> BlockBehaviour.Properties.ofFullCopy(Blocks.WOOL.pick(color)) | |
| ); | |
| public static final ColorCollection<DeferredHolder<Item, BlockItem>> WOOL_BLOCK_ITEMS = registerBlockItems( | |
| ITEMS, | |
| "wool", | |
| WOOL_BLOCKS, | |
| (block, color, properties) -> new BlockItem(block, properties), | |
| color -> new Item.Properties() | |
| ); | |
| public static <TRegistry, TValue extends TRegistry> ColorCollection<DeferredHolder<TRegistry, TValue>> registerEntries( | |
| DeferredRegister<TRegistry> registry, | |
| String identifier, | |
| BiFunction<DyeColor, Identifier, TValue> factory | |
| ) { | |
| return ColorCollection.zipMap( | |
| ColorCollection.VALUES, | |
| ColorCollection.prefixWithColor(ColorCollection.create(identifier)), | |
| (color, coloredIdentifier) -> registry.register(coloredIdentifier, registryName -> factory.apply(color, registryName)) | |
| ); | |
| } | |
| public static <TRegistry, TValue extends TRegistry> ColorCollection<DeferredHolder<TRegistry, TValue>> registerEntries( | |
| DeferredRegister<TRegistry> registry, | |
| String identifier, | |
| Function<DyeColor, TValue> factory | |
| ) { | |
| return registerEntries(registry, identifier, (color, registryName) -> factory.apply(color)); | |
| } | |
| public static <TBlock extends Block> ColorCollection<DeferredHolder<Block, TBlock>> registerBlocks( | |
| DeferredRegister<Block> registry, | |
| String identifier, | |
| BiFunction<DyeColor, BlockBehaviour.Properties, TBlock> factory, | |
| Function<DyeColor, BlockBehaviour.Properties> propertiesFactory | |
| ) { | |
| return registerEntries( | |
| registry, | |
| identifier, | |
| (color, registryName) -> factory.apply(color, propertiesFactory | |
| .apply(color) | |
| .setId(ResourceKey.create(Registries.BLOCK, registryName)) | |
| ) | |
| ); | |
| } | |
| public static <TItem extends Item> ColorCollection<DeferredHolder<Item, TItem>> registerItems( | |
| DeferredRegister<Item> registry, | |
| String identifier, | |
| BiFunction<DyeColor, Item.Properties, TItem> factory, | |
| Function<DyeColor, Item.Properties> propertiesFactory | |
| ) { | |
| return registerEntries( | |
| registry, | |
| identifier, | |
| (color, registryName) -> factory.apply(color, propertiesFactory | |
| .apply(color) | |
| .setId(ResourceKey.create(Registries.ITEM, registryName)) | |
| ) | |
| ); | |
| } | |
| public static <TItem extends Item, TBlock extends Block> ColorCollection<DeferredHolder<Item, TItem>> registerBlockItems( | |
| DeferredRegister<Item> registry, | |
| String identifier, | |
| ColorCollection<DeferredHolder<Block, TBlock>> blocks, | |
| TriFunction<TBlock, DyeColor, Item.Properties, TItem> factory, | |
| Function<DyeColor, Item.Properties> propertiesFactory | |
| ) { | |
| return registerItems( | |
| registry, | |
| identifier, | |
| (color, properties) -> factory.apply(blocks.pick(color).value(), color, properties), | |
| color -> propertiesFactory.apply(color).useBlockDescriptionPrefix() | |
| ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment