Package com.petrolpark.util
Interface Conversion<T>
- All Known Subinterfaces:
Conversion.BlockStateConversion,Conversion.ItemStackConversion
- All Known Implementing Classes:
Conversion.AlwaysConversion,Conversion.ArmorItemConversion,Conversion.BlockIDRegexConversion,Conversion.BlockItemConversion,Conversion.BlockStateBlockConversion,Conversion.BlockStateItemStackConversion,Conversion.ColorEntityConversion,Conversion.ContainerConversion,Conversion.DyedBlockConversion,Conversion.InventoryEntityConversion,Conversion.ItemEntityConversion,Conversion.ItemFrameItemConversion,Conversion.ItemIDRegexConversion,Conversion.ItemStackComponentConversion,Conversion.ItemStackContainerConversion,Conversion.ItemStackItemConversion,Conversion.NoConversion,Conversion.ReplacementConversion,Conversion.TaggedBlockConversion,Conversion.TaggedItemConversion,Conversion.TieredItemConversion,CopycatBlockConversion,GoldHelper.GoldDyedBlockConversion
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordstatic classstatic final recordstatic final recordstatic final classstatic interfacestatic final recordstatic classstatic final recordstatic interfacestatic classstatic final recordstatic final recordstatic final recordstatic final recordstatic final recordstatic final recordstatic final recordstatic interfacestatic final classstatic final recordstatic classstatic final recordstatic final recordstatic final recordstatic class -
Method Summary
Modifier and TypeMethodDescriptionconvert(net.minecraft.world.level.Level level, T object, net.minecraft.world.entity.player.Player player) static <T> Conversion.ConversionResult<T> convert(net.minecraft.world.level.Level level, T object, net.minecraft.world.entity.player.Player player, Collection<Conversion.Entry<T>> conversions) static Conversion.ReplacementConversion<net.minecraft.world.level.block.Block> convertBlock(Supplier<net.minecraft.world.level.block.Block> block, Supplier<net.minecraft.world.level.block.Block> result) Convert the first Block into the second and finishstatic Conversion.ReplacementConversion<net.minecraft.world.level.block.Block> convertBlock(net.minecraft.world.level.block.Block block, net.minecraft.world.level.block.Block result) Convert the first Block into the second and finishconvertBlockIdRegex(String namespaceRegex, String pathRegex, Supplier<net.minecraft.world.level.block.Block> block) Convert all Blocks whose IDs match the given regexes into the given Block (if it exists) and finishconvertBlockIdRegex(String regex, Supplier<net.minecraft.world.level.block.Block> block) Convert all Blocks whose ID paths match the given regex into the given Block (if it exists), and finishconvertBlockIdRegexStrict(String namespaceRegex, String pathRegex, Supplier<net.minecraft.world.level.block.Block> block) Convert all Blocks whose IDs match the given regexes into the given Block (if it exists), if they are the exact same class, and finishconvertBlockIdRegexStrict(String regex, Supplier<net.minecraft.world.level.block.Block> block) Convert all Blocks whose ID paths match the given regex into the given Block (if it exists), if they are the exact same class, and finishconvertBlockIdRegexStrict(String regex, net.minecraft.world.level.block.Block block) Convert all Blocks whose ID paths match the given regex into the given Block, if they are the exact same class, and finishstatic Conversion.ReplacementConversion<net.minecraft.world.level.block.Block> convertBlockIds(net.minecraft.resources.ResourceLocation id, net.minecraft.resources.ResourceLocation resultId) Convert the Block with the first ID (if it exists) to the Block with the second ID (if it exists) and finish, or else passconvertBlockItem(Conversion<net.minecraft.world.level.block.Block> blockConversion) Apply the given Block Conversion to any Items which are Block Items and finishstatic Conversion.AlwaysConversion<net.minecraft.world.level.block.Block> convertBlockSameClass(Supplier<net.minecraft.world.level.block.Block> block) Convert all Blocks with the exact same class as the given Block into the given Block (if it exists) and finishstatic Conversion.AlwaysConversion<net.minecraft.world.level.block.Block> convertBlockSameClass(net.minecraft.world.level.block.Block block) Convert all Blocks with the exact same class as the given Block into the given Block and finishconvertBlockStateBlock(Conversion<net.minecraft.world.level.block.Block> blockConversion) Convert the Blocks of BlockStates according to the given Block Conversion.convertContainerContents(Conversion<net.minecraft.world.item.ItemStack> contentsConversion) If the Block is a Container, convert all ItemStacks in it according to the given ItemStack Conversion, and continuestatic Conversion.ReplacementConversion<net.minecraft.world.item.Item> convertItem(Supplier<net.minecraft.world.item.Item> item, Supplier<net.minecraft.world.item.Item> result) Convert the first Item (if it exists) into the second (if it exists) and finishstatic Conversion.ReplacementConversion<net.minecraft.world.item.Item> convertItem(net.minecraft.world.item.Item item, net.minecraft.world.item.Item result) Convert the first Item into the second and finishconvertItemIdRegexStrict(String namespaceRegex, String pathRegex, Supplier<net.minecraft.world.item.Item> item) Convert all Items whose IDs match the given regexes into the given Item (if it exists), if they are the exact same class, and finishconvertItemIdRegexStrict(String pathRegex, Supplier<net.minecraft.world.item.Item> item) Convert all Items whose IDs match the given regex into the given Item (if it exists), if they are the exact same class, and finishstatic Conversion.ReplacementConversion<net.minecraft.world.item.Item> convertItemIds(net.minecraft.resources.ResourceLocation id, net.minecraft.resources.ResourceLocation resultId) Convert the Item with the first ID (if it exists) to the Item with the second ID (if it exists) and finish, or else passstatic Conversion.AlwaysConversion<net.minecraft.world.item.Item> convertItemSameClass(Supplier<net.minecraft.world.item.Item> item) Convert all Items with the exact same class as the given Item into the given Item and finishstatic Conversion.AlwaysConversion<net.minecraft.world.item.Item> convertItemSameClass(net.minecraft.world.item.Item item) Convert all Items with the exact same class as the given Item into the given Item and finishconvertItemStackBlockState(Conversion<BlockStateAndEntity> blockConversion) Convert all BlockItems into the corresponding BlockItems of the Blocks converted with the given Block Conversion, and finishstatic <T> Conversion.ItemStackComponentConversion<T> convertItemStackComponent(Predicate<net.minecraft.world.item.ItemStack> predicate, Supplier<net.minecraft.core.component.DataComponentType<T>> component, BiFunction<net.minecraft.world.level.Level, T, T> map, boolean pass) Apply the given transformation to the given Component if the ItemStack passes the given predicatestatic <T> Conversion.ItemStackComponentConversion<T> convertItemStackComponent(Predicate<net.minecraft.world.item.ItemStack> predicate, net.minecraft.core.component.DataComponentType<T> component, BiFunction<net.minecraft.world.level.Level, T, T> map) Apply the given transformation to the given Component if the ItemStack passes the given predicate, and continuestatic <T> Conversion.ItemStackComponentConversion<T> convertItemStackComponentAndFinish(Predicate<net.minecraft.world.item.ItemStack> predicate, net.minecraft.core.component.DataComponentType<T> component, BiFunction<net.minecraft.world.level.Level, T, T> map) Apply the given transformation to the given Component if the ItemStack passes the given predicate, and finishstatic <T> Conversion.ItemStackComponentConversion<T> convertItemStackComponentIfPresent(net.minecraft.core.component.DataComponentType<T> component, BiFunction<net.minecraft.world.level.Level, T, T> map) Apply the given transformation to the given Component, only if that Component already existed, and continueconvertItemStackContainerContents(Conversion<net.minecraft.world.item.ItemStack> contentsConversion) Apply the given ItemStack Conversion to all Container contents or BundleContents of the ItemStack, and continueconvertItemStackItem(Conversion<net.minecraft.world.item.Item> itemConversion) Convert the Items of ItemStacks according to the given Item Conversion.convertTaggedBlock(net.minecraft.tags.TagKey<net.minecraft.world.level.block.Block> tag, Supplier<net.minecraft.world.level.block.Block> block) Convert all Blocks with the given Tag into the given Block (if it exists), if they are a subclass of the class of that Block, and finishconvertTaggedBlock(net.minecraft.tags.TagKey<net.minecraft.world.level.block.Block> tag, net.minecraft.resources.ResourceLocation blockId) Convert all Blocks with the given Tag into the Block with the given ID (if it exists), if they are a subclass of the class of that Block, and finishconvertTaggedBlockStrict(net.minecraft.tags.TagKey<net.minecraft.world.level.block.Block> tag, Supplier<net.minecraft.world.level.block.Block> block) Convert all Blocks of the given Tag into the given Block (if it exists), if they are the exact same class, and finishconvertTaggedBlockStrict(net.minecraft.tags.TagKey<net.minecraft.world.level.block.Block> tag, net.minecraft.world.level.block.Block block) Convert all Blocks with the given Tag into the given Block, if they are the exact same class, and finishconvertTaggedItemStrict(net.minecraft.tags.TagKey<net.minecraft.world.item.Item> tag, Supplier<net.minecraft.world.item.Item> item) Convert all Items with the given Tag into the given Item (if it exists), if they are the exact same class, and finishconvertTaggedItemStrict(net.minecraft.tags.TagKey<net.minecraft.world.item.Item> tag, net.minecraft.world.item.Item item) Convert all Items with the given Tag into the given Item, if they are the exact same class, and finishstatic <T> Conversion.NoConversion<T> dontConvert(Predicate<T> predicate) default Conversion.ConversionResult.Finish<T> default <U,S extends U>
booleanisChildInstance(U object, Class<S> subClass) default <U,S extends U>
booleanisInstance(U object, Class<S> subClass) default Conversion.ConversionResult.Pass<T> default Supplier<Conversion.ConversionResult<T>> supplyPass(T object)
-
Method Details
-
convert
Conversion.ConversionResult<T> convert(net.minecraft.world.level.Level level, T object, @Nullable net.minecraft.world.entity.player.Player player) -
pass
-
supplyPass
-
finish
-
isInstance
-
isChildInstance
-
convert
static <T> Conversion.ConversionResult<T> convert(net.minecraft.world.level.Level level, T object, @Nullable net.minecraft.world.entity.player.Player player, Collection<Conversion.Entry<T>> conversions) -
dontConvert
-
convertItemStackItem
static Conversion.ItemStackItemConversion convertItemStackItem(Conversion<net.minecraft.world.item.Item> itemConversion) Convert the Items of ItemStacks according to the given Item Conversion. The results are cached -
convertItem
static Conversion.ReplacementConversion<net.minecraft.world.item.Item> convertItem(net.minecraft.world.item.Item item, net.minecraft.world.item.Item result) Convert the first Item into the second and finish -
convertItemIds
static Conversion.ReplacementConversion<net.minecraft.world.item.Item> convertItemIds(net.minecraft.resources.ResourceLocation id, net.minecraft.resources.ResourceLocation resultId) Convert the Item with the first ID (if it exists) to the Item with the second ID (if it exists) and finish, or else pass -
convertItem
static Conversion.ReplacementConversion<net.minecraft.world.item.Item> convertItem(Supplier<net.minecraft.world.item.Item> item, Supplier<net.minecraft.world.item.Item> result) Convert the first Item (if it exists) into the second (if it exists) and finish -
convertTaggedItemStrict
static Conversion.TaggedItemConversion convertTaggedItemStrict(net.minecraft.tags.TagKey<net.minecraft.world.item.Item> tag, net.minecraft.world.item.Item item) Convert all Items with the given Tag into the given Item, if they are the exact same class, and finish -
convertTaggedItemStrict
static Conversion.TaggedItemConversion convertTaggedItemStrict(net.minecraft.tags.TagKey<net.minecraft.world.item.Item> tag, Supplier<net.minecraft.world.item.Item> item) Convert all Items with the given Tag into the given Item (if it exists), if they are the exact same class, and finish -
convertItemIdRegexStrict
static Conversion.ItemIDRegexConversion convertItemIdRegexStrict(String pathRegex, Supplier<net.minecraft.world.item.Item> item) Convert all Items whose IDs match the given regex into the given Item (if it exists), if they are the exact same class, and finish -
convertItemIdRegexStrict
static Conversion.ItemIDRegexConversion convertItemIdRegexStrict(String namespaceRegex, String pathRegex, Supplier<net.minecraft.world.item.Item> item) Convert all Items whose IDs match the given regexes into the given Item (if it exists), if they are the exact same class, and finish -
convertItemSameClass
static Conversion.AlwaysConversion<net.minecraft.world.item.Item> convertItemSameClass(net.minecraft.world.item.Item item) Convert all Items with the exact same class as the given Item into the given Item and finish -
convertItemSameClass
static Conversion.AlwaysConversion<net.minecraft.world.item.Item> convertItemSameClass(Supplier<net.minecraft.world.item.Item> item) Convert all Items with the exact same class as the given Item into the given Item and finish -
convertBlockItem
static Conversion.BlockItemConversion convertBlockItem(Conversion<net.minecraft.world.level.block.Block> blockConversion) Apply the given Block Conversion to any Items which are Block Items and finish -
convertItemStackBlockState
static Conversion.BlockStateItemStackConversion convertItemStackBlockState(Conversion<BlockStateAndEntity> blockConversion) Convert all BlockItems into the corresponding BlockItems of the Blocks converted with the given Block Conversion, and finish -
convertItemStackComponentIfPresent
static <T> Conversion.ItemStackComponentConversion<T> convertItemStackComponentIfPresent(net.minecraft.core.component.DataComponentType<T> component, BiFunction<net.minecraft.world.level.Level, T, T> map) Apply the given transformation to the given Component, only if that Component already existed, and continue -
convertItemStackComponent
static <T> Conversion.ItemStackComponentConversion<T> convertItemStackComponent(Predicate<net.minecraft.world.item.ItemStack> predicate, net.minecraft.core.component.DataComponentType<T> component, BiFunction<net.minecraft.world.level.Level, T, T> map) Apply the given transformation to the given Component if the ItemStack passes the given predicate, and continue- Type Parameters:
T- Component type- See Also:
-
convertItemStackComponentAndFinish
static <T> Conversion.ItemStackComponentConversion<T> convertItemStackComponentAndFinish(Predicate<net.minecraft.world.item.ItemStack> predicate, net.minecraft.core.component.DataComponentType<T> component, BiFunction<net.minecraft.world.level.Level, T, T> map) Apply the given transformation to the given Component if the ItemStack passes the given predicate, and finish- Type Parameters:
T- Component type- See Also:
-
convertItemStackComponent
static <T> Conversion.ItemStackComponentConversion<T> convertItemStackComponent(Predicate<net.minecraft.world.item.ItemStack> predicate, Supplier<net.minecraft.core.component.DataComponentType<T>> component, BiFunction<net.minecraft.world.level.Level, T, T> map, boolean pass) Apply the given transformation to the given Component if the ItemStack passes the given predicate- Type Parameters:
T- Component type
-
convertItemStackContainerContents
static Conversion.ItemStackContainerConversion convertItemStackContainerContents(Conversion<net.minecraft.world.item.ItemStack> contentsConversion) Apply the given ItemStack Conversion to all Container contents or BundleContents of the ItemStack, and continue -
convertBlockStateBlock
static Conversion.BlockStateBlockConversion convertBlockStateBlock(Conversion<net.minecraft.world.level.block.Block> blockConversion) Convert the Blocks of BlockStates according to the given Block Conversion. The results are cached -
convertBlock
static Conversion.ReplacementConversion<net.minecraft.world.level.block.Block> convertBlock(net.minecraft.world.level.block.Block block, net.minecraft.world.level.block.Block result) Convert the first Block into the second and finish -
convertBlockIds
static Conversion.ReplacementConversion<net.minecraft.world.level.block.Block> convertBlockIds(net.minecraft.resources.ResourceLocation id, net.minecraft.resources.ResourceLocation resultId) Convert the Block with the first ID (if it exists) to the Block with the second ID (if it exists) and finish, or else pass -
convertBlock
static Conversion.ReplacementConversion<net.minecraft.world.level.block.Block> convertBlock(Supplier<net.minecraft.world.level.block.Block> block, Supplier<net.minecraft.world.level.block.Block> result) Convert the first Block into the second and finish -
convertTaggedBlockStrict
static Conversion.TaggedBlockConversion convertTaggedBlockStrict(net.minecraft.tags.TagKey<net.minecraft.world.level.block.Block> tag, net.minecraft.world.level.block.Block block) Convert all Blocks with the given Tag into the given Block, if they are the exact same class, and finish -
convertTaggedBlock
static Conversion.TaggedBlockConversion convertTaggedBlock(net.minecraft.tags.TagKey<net.minecraft.world.level.block.Block> tag, net.minecraft.resources.ResourceLocation blockId) Convert all Blocks with the given Tag into the Block with the given ID (if it exists), if they are a subclass of the class of that Block, and finish -
convertTaggedBlock
static Conversion.TaggedBlockConversion convertTaggedBlock(net.minecraft.tags.TagKey<net.minecraft.world.level.block.Block> tag, Supplier<net.minecraft.world.level.block.Block> block) Convert all Blocks with the given Tag into the given Block (if it exists), if they are a subclass of the class of that Block, and finish -
convertTaggedBlockStrict
static Conversion.TaggedBlockConversion convertTaggedBlockStrict(net.minecraft.tags.TagKey<net.minecraft.world.level.block.Block> tag, Supplier<net.minecraft.world.level.block.Block> block) Convert all Blocks of the given Tag into the given Block (if it exists), if they are the exact same class, and finish -
convertBlockIdRegexStrict
static Conversion.BlockIDRegexConversion convertBlockIdRegexStrict(String regex, net.minecraft.world.level.block.Block block) Convert all Blocks whose ID paths match the given regex into the given Block, if they are the exact same class, and finish -
convertBlockIdRegexStrict
static Conversion.BlockIDRegexConversion convertBlockIdRegexStrict(String regex, Supplier<net.minecraft.world.level.block.Block> block) Convert all Blocks whose ID paths match the given regex into the given Block (if it exists), if they are the exact same class, and finish -
convertBlockIdRegex
static Conversion.BlockIDRegexConversion convertBlockIdRegex(String regex, Supplier<net.minecraft.world.level.block.Block> block) Convert all Blocks whose ID paths match the given regex into the given Block (if it exists), and finish -
convertBlockIdRegexStrict
static Conversion.BlockIDRegexConversion convertBlockIdRegexStrict(String namespaceRegex, String pathRegex, Supplier<net.minecraft.world.level.block.Block> block) Convert all Blocks whose IDs match the given regexes into the given Block (if it exists), if they are the exact same class, and finish -
convertBlockIdRegex
static Conversion.BlockIDRegexConversion convertBlockIdRegex(String namespaceRegex, String pathRegex, Supplier<net.minecraft.world.level.block.Block> block) Convert all Blocks whose IDs match the given regexes into the given Block (if it exists) and finish -
convertBlockSameClass
static Conversion.AlwaysConversion<net.minecraft.world.level.block.Block> convertBlockSameClass(net.minecraft.world.level.block.Block block) Convert all Blocks with the exact same class as the given Block into the given Block and finish -
convertBlockSameClass
static Conversion.AlwaysConversion<net.minecraft.world.level.block.Block> convertBlockSameClass(Supplier<net.minecraft.world.level.block.Block> block) Convert all Blocks with the exact same class as the given Block into the given Block (if it exists) and finish -
convertContainerContents
static Conversion.ContainerConversion convertContainerContents(Conversion<net.minecraft.world.item.ItemStack> contentsConversion) If the Block is a Container, convert all ItemStacks in it according to the given ItemStack Conversion, and continue
-