José Martínez

jenny mod

Kodari AI
KodariOct 12 at 5:09 pm 4
JennyMod
A Fabric mod for Minecraft 1.26.3 that introduces Jenny, a fully interactive NPC companion with advanced AI behaviors. The mod adds a custom entity with realistic dialogue trees, quest-giving capabilities, and dynamic relationship tracking. Players can engage in conversations through a custom GUI, receive unique quests with rewards, and build friendship levels that unlock special interactions. The mod includes custom animations, sound effects, and particle effects to bring Jenny to life. It also features configurable settings for dialogue frequency, quest difficulty, and relationship progression rates. Built with Fabric API, the mod integrates seamlessly with existing world generation and provides a complete JSON-based dialogue system for easy customization.

Plan:

  1. Add a friendly, summonable Jenny NPC using the vanilla villager model and appearance.

  2. Add a craftable calling bell, creative-tab entry, item assets, and mod build metadata.

  3. Keep the implementation survival-accessible and avoid extra dependencies.

Created a starter Jenny companion mod. Craft Jenny’s Calling Bell with one bell and four gold ingots, then use it to summon a villager named Jenny. The bell is also in the Tools & Utilities creative tab.

Jenny currently uses the vanilla villager appearance and behavior; this version doesn’t add a custom model or companion AI.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
10 171
src/main/java/com/kodari/jenny/JennyCompanionMod.java
package com.kodari.jenny;

import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.creativetab.v1.CreativeModeTabEvents;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.Identifier;
import net.minecraft.resources.ResourceKey;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.EntitySpawnReason;
import net.minecraft.world.entity.EntityTypes;
import net.minecraft.world.entity.npc.villager.Villager;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.Level;

public final class JennyCompanionMod implements ModInitializer {
	public static final String MOD_ID = "jennycompanion";
	private static final Identifier CALLING_BELL_ID = Identifier.fromNamespaceAndPath(MOD_ID, "calling_bell");
	public static final Item CALLING_BELL = Registry.register(
			BuiltInRegistries.ITEM,
			CALLING_BELL_ID,
			new Item(new Item.Properties().setId(ResourceKey.create(Registries.ITEM, CALLING_BELL_ID))) {
				@Override
				public InteractionResult use(final Level level, final Player player, final InteractionHand hand) {
					if (!(level instanceof ServerLevel serverLevel)) {
						return InteractionResult.SUCCESS;
					}

					Villager jenny = EntityTypes.VILLAGER.create(level, EntitySpawnReason.SPAWN_ITEM_USE);
					if (jenny == null) {
						return InteractionResult.FAIL;
					}

					jenny.setPos(player.getX() + 1.25, player.getY(), player.getZ());
					jenny.setCustomName(Component.translatable("entity.jennycompanion.jenny"));
					jenny.setCustomNameVisible(true);
					if (!serverLevel.addFreshEntity(jenny)) {
						return InteractionResult.FAIL;
					}

					if (!player.isCreative()) {
						player.getItemInHand(hand).shrink(1);
					}
					return InteractionResult.SUCCESS;
				}
			}
	);

	@Override
	public void onInitialize() {
		ResourceKey<CreativeModeTab> toolsAndUtilities = ResourceKey.create(
				Registries.CREATIVE_MODE_TAB,
				Identifier.fromNamespaceAndPath("minecraft", "tools_and_utilities")
		);
		CreativeModeTabEvents.modifyOutputEvent(toolsAndUtilities).register(output -> output.accept(CALLING_BELL));
	}
}