Dudul Lolipops

,делай мод который мужюдет как визуалы на мечте удара по сущностям появился круговорот эффект на 1 секунду

Kodari AI
KodariOct 7 at 4:11 am 1
WhirlwindStrikeFX
A Minecraft Fabric mod that adds a visually striking whirlwind effect when the player hits an entity with a sword. Upon striking, a swirling vortex of particles and air distortion appears around the target, lasting for one second. The effect includes rotating particle streams, a central glowing core, and a brief screen shake for impact feedback. Compatible with Fabric 1.21.4, the mod intercepts melee attack events, spawns a custom particle system at the hit location, and automatically cleans up after the duration expires. Lightweight and performance-friendly, it enhances combat feedback without altering game mechanics.

План:

  1. Создать клиентский Fabric-мод под Minecraft 1.21.4.

  2. При ударе запускать вокруг цели вращающуюся спираль частиц на 20 тиков.

  3. Добавить минимальные Gradle-файлы и метаданные мода.

Создан клиентский мод Hit Vortex: при ударе вокруг сущности на 1 секунду появляется вращающаяся спираль частиц критического удара. Добавлены Gradle-настройки и метаданные Fabric для Minecraft 1.21.4.

Dudul Lolipops

Как скачать мод?

Kodari AI
KodariOct 7 at 5:04 am 1

На компьютере нажмите Compile в верхней панели; на телефоне — ⋮ → Compile Project. В открывшемся окне нажмите Compile, а после успешной сборки — Download у сборки или Download HitVortex.jar в чате.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
5 143
src/main/java/com/kodari/hitvortex/HitVortexClient.java
package com.kodari.hitvortex;

import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.event.player.AttackEntityCallback;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.Entity;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.util.ActionResult;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public final class HitVortexClient implements ClientModInitializer {
    private static final int DURATION_TICKS = 20;
    private static final Map<Entity, Integer> ACTIVE_EFFECTS = new HashMap<>();

    @Override
    public void onInitializeClient() {
        AttackEntityCallback.EVENT.register((player, world, hand, entity, hitResult) -> {
            ACTIVE_EFFECTS.put(entity, 0);
            return ActionResult.PASS;
        });

        ClientTickEvents.END_CLIENT_TICK.register(HitVortexClient::tickEffects);
    }

    private static void tickEffects(MinecraftClient client) {
        ClientWorld world = client.world;
        if (world == null || ACTIVE_EFFECTS.isEmpty()) {
            return;
        }

        Iterator<Map.Entry<Entity, Integer>> iterator = ACTIVE_EFFECTS.entrySet().iterator();
        while (iterator.hasNext()) {
            Map.Entry<Entity, Integer> effect = iterator.next();
            Entity entity = effect.getKey();
            int age = effect.getValue();

            if (entity.isRemoved() || age >= DURATION_TICKS) {
                iterator.remove();
                continue;
            }

            spawnVortex(world, entity, age);
            effect.setValue(age + 1);
        }
    }

    private static void spawnVortex(ClientWorld world, Entity entity, int age) {
        double radius = Math.max(0.35, entity.getWidth() * 0.6);

        for (int strand = 0; strand < 3; strand++) {
            double progress = (age / (double) DURATION_TICKS + strand / 3.0) % 1.0;
            double angle = age * 0.55 + progress * Math.PI * 2.0;
            double x = entity.getX() + Math.cos(angle) * radius;
            double y = entity.getY() + 0.1 + entity.getHeight() * progress;
            double z = entity.getZ() + Math.sin(angle) * radius;

            world.addParticle(ParticleTypes.CRIT, x, y, z, 0.0, 0.015, 0.0);
        }
    }
}