From 9ced43dce29633a38115f83d3dc3d77ee897dbf0 Mon Sep 17 00:00:00 2001 From: ty7e <61668943+ty7e@users.noreply.github.com> Date: Thu, 8 Aug 2024 21:06:03 +0200 Subject: [PATCH] Icon with custom pattern for makeBannerWithPatternItemGoal. Currently just white banner with black pattern. --- .../goal/EnigmaticsDifficultyGoalProvider.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/rasmusantons/enigmaticsbingogoals/datagen/goal/EnigmaticsDifficultyGoalProvider.java b/src/main/java/de/rasmusantons/enigmaticsbingogoals/datagen/goal/EnigmaticsDifficultyGoalProvider.java index c62e7c4..3fdb799 100644 --- a/src/main/java/de/rasmusantons/enigmaticsbingogoals/datagen/goal/EnigmaticsDifficultyGoalProvider.java +++ b/src/main/java/de/rasmusantons/enigmaticsbingogoals/datagen/goal/EnigmaticsDifficultyGoalProvider.java @@ -22,6 +22,7 @@ import net.minecraft.core.HolderSet; import net.minecraft.core.component.DataComponents; import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; @@ -35,6 +36,7 @@ import net.minecraft.world.entity.animal.WolfVariants; import net.minecraft.world.inventory.SlotRange; import net.minecraft.world.inventory.SlotRanges; +import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; @@ -53,7 +55,6 @@ public abstract class EnigmaticsDifficultyGoalProvider extends DifficultyGoalProvider { public static final ResourceLocation ENIGMATICS = ResourceLocation.fromNamespaceAndPath(Bingo.MOD_ID, "enigmatics"); - public EnigmaticsDifficultyGoalProvider(ResourceLocation difficulty, BiConsumer goalAdder, HolderLookup.Provider registries) { @@ -490,14 +491,17 @@ protected static BingoGoal.Builder breedFrogVariantGoal(ResourceLocation id, Res .icon(IndicatorIcon.infer(BingoGoalGeneratorUtils.getFrogVariantIcon(variant), Items.SLIME_BALL)) .tooltip(Component.translatable("enigmaticsbingogoals.goal.breed_frog.tooltip", EntityType.TADPOLE.getDescription())); } - - protected static BingoGoal.Builder makeBannerWithPatternItemGoal(ResourceLocation id, ResourceKey pattern, String patternName) { + protected BingoGoal.Builder makeBannerWithPatternItemGoal(ResourceLocation id, ResourceKey pattern, String patternName) { + HolderLookup.RegistryLookup bannerPatterns = registries.lookupOrThrow(Registries.BANNER_PATTERN); return BingoGoal.builder(id) .criterion("use", ApplyPatternTrigger.TriggerInstance.hasPatterns(List.of(pattern))) .tags(BingoTags.OVERWORLD, EnigmaticsBingoTags.OVERWORLD_ENTRY, EnigmaticsBingoTags.USE_WORKSTATION) .antisynergy(EnigmaticsBingoSynergies.LOOM) .name(Component.translatable("enigmaticsbingogoals.goal.use_loom_pattern", patternName, Items.LOOM.getDescription())) .tooltip(Component.translatable("enigmaticsbingogoals.goal.use_loom_pattern.tooltip")) - .icon(new IndicatorIcon(ItemIcon.ofItem(Items.WHITE_BANNER), BlockIcon.ofBlock(Blocks.LOOM))); + .icon(IndicatorIcon.infer( + makeBannerWithPattern(Items.WHITE_BANNER, bannerPatterns.getOrThrow(pattern), DyeColor.BLACK), + BlockIcon.ofBlock(Blocks.LOOM) + )); } }