flame
📎 1 file 2,015 chars
📄
pasted-code-1791639024375.txt
txt 24 lines
▶
Create a working Minecraft Java 26.2 Fabric mod for our SMP server, **МоссШилд**.

### Features

1. **Hidden player nametags:** Completely hide names above players' heads while keeping names visible in chat and the Tab list.

2. **Hidden coordinates:** Hide XYZ coordinates in F3 while preserving other debug information where possible. Show coordinates only when a compass is held in either hand, using a HUD line formatted as `53 | -21 | 123` (X | Y | Z), positioned above the hotbar and hearts. Update coordinates in real time.

3. **Invisible item frames:** When crouching (Shift) and right-clicking an item frame with shears, toggle its invisibility. Empty invisible frames emit subtle particles so players can locate them. Once an item is placed inside, stop the particles while keeping the frame invisible and the item visible. If the item is removed, restore the particles. Preserve the frame's state after server restarts.

### Requirements

- Use Java and the correct Fabric API for Minecraft 26.2.
- Implement server-side mechanics on the server and HUD/rendering features on the client.
- Ensure multiplayer synchronization and prevent item duplication or loss.
- Use **dark green** as the primary color for any custom UI or messages.
- All player-facing text, messages, and visible names must be in **Russian**. Use **«МоссШилд»** as the main name everywhere instead of “MossShield”, except where technical identifiers require otherwise.
- Keep the implementation clean, lightweight, and compatible with Minecraft 26.2.

### Deliverables

Provide the complete project with all source files, dependencies, configuration, and build scripts. Include simple Windows installation and build instructions, and provide a ZIP archive of the project if file creation is available.

Verify compatibility with Fabric 26.2. Do not invent APIs or claim the mod compiles unless it has actually been tested. Prioritize a functional, complete implementation over explanations or placeholder code.
Kodari AI
KodariOct 10 at 1:52 pm 3
MossShieldSMPTools
Fabric mod for МоссШилд SMP server providing three core features: hidden player nametags above heads while keeping chat/tab names visible, a real-time coordinate HUD shown above the hotbar when holding a compass (formatted as X | Y | Z), and toggleable invisible item frames via crouch-right-click with shears, including particle effects for empty frames and state persistence across restarts. Server-side mechanics handle nametag hiding and frame invisibility with multiplayer synchronization, while client-side rendering displays the coordinate HUD. All UI text and messages are in Russian with dark green coloring, using «МоссШилд» as the primary name.
  1. Create the Fabric 26.2 project scaffold and server-side hidden nametags.

  2. Add the client HUD: hide F3 coordinates and show live coordinates while holding a compass.

  3. Add synchronized, persistent invisible item frames with subtle particles when empty.

Создан проект Fabric-мода «МоссШилд» для Minecraft 26.2.

  • Имена над игроками скрываются сервером; существующее членство в командах сохраняется, видимость имён для команды меняется на «никогда».

  • В F3 убирается только строка XYZ, остальные отладочные данные остаются.

  • При компасе в любой руке над хотбаром отображаются координаты X | Y | Z тёмно-зелёным цветом.

  • Присев, нажмите ПКМ по рамке с ножницами: её невидимость переключится. Пустые невидимые рамки периодически испускают зелёные частицы; предмет внутри остаётся видимым. Состояние рамки сохраняет ванильная система.

Для механик используются существующие компас и ножницы — новых предметов и рецептов нет. Для клиентского HUD мод нужен и на клиенте, и на сервере.

Исходники и скрипты сборки добавлены. Сигнатуры проверены по исходникам 26.2, но сборка не запускалась, поэтому утверждать, что проект успешно компилируется, не могу. Отдельный ZIP-архив доступными операциями создать нельзя.

На Windows: поместите собранный JAR в папку mods Fabric-сервера; для HUD установите его и в клиентскую папку mods. В Kodari нажмите Compile в верхней панели → Compile в окне сборки → Download после успеха.

flame

ошибка он не запускается ничего в игре не меняется

Kodari AI
KodariOct 10 at 2:20 pm 1

Исправил настройку сборки: версия из gradle.properties теперь подставляется в fabric.mod.json. Раньше в JAR мог попасть буквальный ${version}, из-за чего загрузчик мог отклонить мод.

Сборку здесь не запускал, поэтому подтвердить, что ошибка устранена, не могу. Для HUD мод должен быть установлен и на сервере, и на клиенте. Если после этой правки мод всё ещё не запускается, пришлите текст ошибки из сборки или файл logs/latest.log — по нему можно будет найти точную причину.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
README.md
settings.gradle
Code
9 230
src/client/java/ru/mossshield/client/MossShieldClient.java
package ru.mossshield.client;

import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.rendering.v1.hud.HudElementRegistry;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.Minecraft;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.resources.Identifier;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.decoration.ItemFrame;
import net.minecraft.world.item.Items;

public class MossShieldClient implements ClientModInitializer {
	private static final int DARK_GREEN = 0xFF006400;
	private static int particleTick;

	@Override
	public void onInitializeClient() {
		ClientTickEvents.END_CLIENT_TICK.register(client -> {
			ClientLevel level = client.level;
			if (level == null) {
				return;
			}

			particleTick++;
			if (particleTick % 10 != 0) {
				return;
			}

			for (Entity entity : level.entitiesForRendering()) {
				if (entity instanceof ItemFrame frame && frame.isInvisible() && frame.getItem().isEmpty()) {
					level.addParticle(ParticleTypes.HAPPY_VILLAGER, frame.getX(), frame.getY(), frame.getZ(), 0.0, 0.0, 0.0);
				}
			}
		});

		HudElementRegistry.addLast(Identifier.fromNamespaceAndPath("mossshield", "coordinates"), (graphics, deltaTracker) -> {
			Minecraft minecraft = Minecraft.getInstance();
			if (minecraft.player == null) {
				return;
			}

			var player = minecraft.player;
			if (player.getMainHandItem().getItem() != Items.COMPASS && player.getOffhandItem().getItem() != Items.COMPASS) {
				return;
			}

			String coordinates = player.getBlockX() + " | " + player.getBlockY() + " | " + player.getBlockZ();
			int x = (graphics.guiWidth() - minecraft.font.width(coordinates)) / 2;
			int y = graphics.guiHeight() - 65;
			graphics.text(minecraft.font, coordinates, x, y, DARK_GREEN, true);
		});
	}
}