Dash

Act as a Minecraft Fabrick 1.26.2 Mod Developer. Create a minimal MVP for a horror mod named "Verity" with only two core features:

  1. THE ENTITY & COMBAT:
  • Create a custom mob: a floating yellow sphere with a creepy black smiley face texture.
  • It should slowly glide towards the player and constantly face them.
  • If the player attacks it, trigger a simple jumpscare: play a loud static sound effect, flash a dark overlay on the screen, and make the entity teleport 20 blocks away.
  1. INTERACTION & BASIC UI:
  • When the player right-clicks the entity, open a custom Screen/GUI overlay.
  • For this MVP, the GUI only needs a title "Verity", a text input box, and a "Send" button that prints the typed message to the standard player chat.

Provide only the clean Java code for the Entity class, the Jumpscare event handler, and the basic GUI class. Keep it simple and modular.

Kodari AI
KodariOct 30 at 2:41 pm 1
VerityHorrorMod
A minimal Minecraft Fabric mod introducing a custom horror entity: a floating yellow sphere with a creepy smiley face that glides toward players. Combat triggers a jumpscare with static sound and screen flash while teleporting the entity away. Right-clicking opens a custom GUI with a text input and send button that prints messages to chat.
  1. Add the floating, player-tracking Verity entity.

  2. Add attack jumpscare and right-click event handling.

  3. Add the “Verity” screen with a text field and Send button.

Added the entity, event handler, and screen classes. The entity faces its target every tick and glides toward them.

VerityEventHandler.register() must be called from your mod initializer. Entity type registration and a renderer are still needed for the sphere; the jumpscare uses a vanilla ghast scream, and the custom smiley texture requires an asset. Studio can be enabled in project settings or at https://kodari.ai/settings?tab=features to create the texture.

Kodari can make mistakes. Review important code before using.
Files
src
Code
3 158
src/main/java/com/verity/event/VerityEventHandler.java
package com.verity.event;

import com.verity.client.VerityScreen;
import com.verity.entity.VerityEntity;
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
import net.fabricmc.fabric.api.event.player.AttackEntityCallback;
import net.fabricmc.fabric.api.event.player.UseEntityCallback;
import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.api.EnvType;
import net.minecraft.client.MinecraftClient;
import net.minecraft.entity.Entity;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.minecraft.util.ActionResult;
import net.minecraft.util.math.Vec3d;

public final class VerityEventHandler {
    private static final long FLASH_DURATION_MILLIS = 300L;
    private static volatile long flashUntilMillis;

    private VerityEventHandler() {
    }

    public static void register() {
        AttackEntityCallback.EVENT.register((player, world, hand, target, hitResult) -> {
            if (!(target instanceof VerityEntity)) {
                return ActionResult.PASS;
            }

            if (world.isClient) {
                world.playSound(null, target.getX(), target.getY(), target.getZ(),
                        SoundEvents.ENTITY_GHAST_SCREAM, SoundCategory.HOSTILE, 2.0F, 0.65F);
                flashUntilMillis = System.currentTimeMillis() + FLASH_DURATION_MILLIS;
            } else {
                teleportAway(target, player);
            }
            return ActionResult.PASS;
        });

        UseEntityCallback.EVENT.register((player, world, hand, target, hitResult) -> {
            if (!(target instanceof VerityEntity)) {
                return ActionResult.PASS;
            }

            if (world.isClient) {
                MinecraftClient.getInstance().setScreen(new VerityScreen());
            }
            return ActionResult.SUCCESS;
        });

        if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT) {
            HudRenderCallback.EVENT.register((drawContext, tickCounter) -> {
                long remaining = flashUntilMillis - System.currentTimeMillis();
                if (remaining <= 0L) {
                    return;
                }

                int alpha = (int) (190 * remaining / FLASH_DURATION_MILLIS);
                drawContext.fill(0, 0, drawContext.getScaledWindowWidth(),
                        drawContext.getScaledWindowHeight(), alpha << 24);
            });
        }
    }

    private static void teleportAway(Entity entity, Entity player) {
        Vec3d away = entity.getPos().subtract(player.getPos());
        Vec3d horizontal = new Vec3d(away.x, 0.0, away.z);
        if (horizontal.lengthSquared() < 1.0E-6) {
            horizontal = new Vec3d(1.0, 0.0, 0.0);
        } else {
            horizontal = horizontal.normalize();
        }

        Vec3d destination = player.getPos().add(horizontal.multiply(20.0))
                .add(0.0, entity.getY() - player.getY(), 0.0);
        entity.refreshPositionAndAngles(destination.x, destination.y, destination.z,
                entity.getYaw(), entity.getPitch());
    }
}