Богдан Грунский

Создай мод на фабрик 1.21.11 который добавляет игроков имписи который будет делать по приказу что бы заспавнить нужно яйцо призыва что они всё телепортировались к тебе надо дуноть в рок зов

Kodari AI
KodariTue at 4:36 pm 16
ImpSummoner
Adds mischievous imp mobs to Minecraft Fabric 1.21.11. Imps spawn via a special summoning egg and follow player commands. When the player uses a horn (rock call) item, all summoned imps teleport to the player's location. The mod includes custom entity AI, spawn egg item, horn item with cooldown, and complete registration for entities, items, and sounds.

Создам NPC с яйцом призыва и рогом зова. Владельцем станет игрок, который использовал яйцо; NPC будут следовать за ним, а рог соберёт их к владельцу.

Добавлены спутники-NPC для Fabric 1.21.11.

  • Яйцо призыва: разместите по вертикали резную тыкву, яйцо и железный слиток.

  • Рог зова: создаётся из козьего рога и трёх железных слитков.

  • Нажмите ПКМ по своему спутнику, чтобы переключить приказ «следуй» / «жди». Рог телепортирует к вам ваших спутников, находящихся в загруженных чанках.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
21 261
src/main/java/ru/kodari/npcs/ObedientNpcs.java
package ru.kodari.npcs;

import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.fabricmc.fabric.api.object.builder.v1.entity.FabricDefaultAttributeRegistry;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.entity.mob.MobEntity;
import net.minecraft.item.Item;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.util.Identifier;

public class ObedientNpcs implements ModInitializer {
    public static final String ID = "obedient_npcs";
    private static final RegistryKey<EntityType<?>> NPC_KEY = RegistryKey.of(RegistryKeys.ENTITY_TYPE, Identifier.of(ID, "npc"));
    public static final EntityType<NpcEntity> NPC = Registry.register(Registries.ENTITY_TYPE, NPC_KEY,
            EntityType.Builder.create(NpcEntity::new, SpawnGroup.MISC).dimensions(0.6f, 1.8f).build(NPC_KEY));
    private static final RegistryKey<Item> EGG_KEY = RegistryKey.of(RegistryKeys.ITEM, Identifier.of(ID, "npc_spawn_egg"));
    private static final RegistryKey<Item> HORN_KEY = RegistryKey.of(RegistryKeys.ITEM, Identifier.of(ID, "call_horn"));
    public static final Item EGG = Registry.register(Registries.ITEM, EGG_KEY, new NpcEggItem(new Item.Settings().registryKey(EGG_KEY)));
    public static final Item HORN = Registry.register(Registries.ITEM, HORN_KEY, new CallHornItem(new Item.Settings().registryKey(HORN_KEY).maxCount(1)));

    @Override
    public void onInitialize() {
        FabricDefaultAttributeRegistry.register(NPC, MobEntity.createMobAttributes());
        ItemGroupEvents.modifyEntriesEvent(RegistryKey.of(RegistryKeys.ITEM_GROUP, Identifier.ofVanilla("spawn_eggs"))).register(entries -> entries.add(EGG));
        ItemGroupEvents.modifyEntriesEvent(RegistryKey.of(RegistryKeys.ITEM_GROUP, Identifier.ofVanilla("tools_and_utilities"))).register(entries -> entries.add(HORN));
    }
}