tim1438746

при .drop предмет которыл лежал у тебя в руке выкидывался

Kodari AI
KodariSep 18 at 3:37 pm 3
DropItemRemover
Minecraft Fabric mod that removes dropped items from the world when a player drops them. When a player uses the drop key or drops an item from their hand, the item entity is immediately deleted instead of appearing in the world. This prevents accidental item loss and keeps the ground clean. The mod hooks into the drop item event and cancels the item entity spawn, ensuring no dropped items remain in the world.
  1. Создать минимальный Fabric-мод для Minecraft 1.21.11.

  2. Перехватить .drop в чате и отменять отправку сообщения.

  3. Выбросить предмет из текущего выбранного слота, сохранив обычную механику выбрасывания.

  4. Добавить обязательные Gradle/Fabric-метаданные проекта.

Создан Fabric-мод для Minecraft 1.21.11:

  • Команда .drop перехватывается в чате.

  • Предмет из выбранной руки выбрасывается целиком.

  • Сообщение .drop не отправляется на сервер.

  • Добавлены Gradle-конфигурация, fabric.mod.json и клиентский entrypoint.

Использование: напиши .drop в игровом чате.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
5 120
src/client/java/com/example/dropcommand/DropCommandClient.java
package com.example.dropcommand;

import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.message.v1.ClientSendMessageEvents;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientPlayerEntity;

public final class DropCommandClient implements ClientModInitializer {
    @Override
    public void onInitializeClient() {
        ClientSendMessageEvents.ALLOW_CHAT.register(message -> {
            if (!message.equals(".drop")) {
                return true;
            }

            ClientPlayerEntity player = MinecraftClient.getInstance().player;
            if (player == null) {
                return true;
            }

            player.dropSelectedItem(true);
            return false;
        });
    }
}