Skip to content

Commit

Permalink
Firefly Bottle in creative inventory has component
Browse files Browse the repository at this point in the history
  • Loading branch information
AViewFromTheTop committed Jan 31, 2025
1 parent 2daadfb commit e9c968f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.frozenblock.lib.item.api.FrozenCreativeTabs;
import net.frozenblock.lib.item.api.ItemBlockStateTagUtils;
import net.frozenblock.wilderwild.entity.variant.firefly.FireflyColors;
import net.frozenblock.wilderwild.tag.WWInstrumentTags;
import net.minecraft.resources.ResourceKey;
import net.minecraft.tags.TagKey;
Expand Down Expand Up @@ -338,6 +339,15 @@ public static void init() {

// FIREFLY
addAfterInSpawnEggs(Items.EVOKER_SPAWN_EGG, WWItems.FIREFLY_SPAWN_EGG);
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.TOOLS_AND_UTILITIES).register(entries -> {
var stack = new ItemStack(WWItems.FIREFLY_BOTTLE);
stack.setCount(1);
stack.set(
WWDataComponents.FIREFLY_COLOR,
entries.getContext().holders().lookupOrThrow(WilderWildRegistries.FIREFLY_COLOR).getOrThrow(FireflyColors.DEFAULT)
);
entries.accept(stack);
});
addInToolsAndUtilities(WWItems.FIREFLY_BOTTLE);

// BUTTERFLY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,7 @@ public final class WWItems {
WWSounds.ITEM_BOTTLE_RELEASE_FIREFLY,
properties
),
new Item.Properties()
.stacksTo(16)
.component(
WWDataComponents.BOTTLE_ENTITY_DATA,
CustomData.EMPTY.update(compoundTag -> compoundTag.putString("FireflyBottleVariantTag", FireflyColors.DEFAULT.location().toString()))
)
new Item.Properties().stacksTo(16).component(WWDataComponents.BOTTLE_ENTITY_DATA, CustomData.EMPTY)
);
public static final MobBottleItem BUTTERFLY_BOTTLE = register("butterfly_bottle",
properties -> new MobBottleItem(
Expand Down

0 comments on commit e9c968f

Please sign in to comment.