Skip to content

Holografische Beschriftungen (MC 26.1.2)

Dieses Dokument beschreibt das System schwebender Mengenkennzeichnungen und das native Namensschild-Rendering für ungemoddete Clients in Item Clumps für Minecraft 26.1.2.


📊 Feature-Infobox

EigenschaftSpezifikation
SystemnameServerseitiger Provider für Namensschilder
Rendering-StrategieNative Vanilla-Namensschilder (setCustomName / setCustomNameVisible)
Client-Mod erforderlich?Nein (wird zu 100 % von normalen Vanilla-Clients dargestellt)
Formatmuster<item_name> x<anzahl> (z. B. Diamant x128, Eichenstamm x500)
Schwellenwert-RegelErscheint, wenn $\text{count} > \text{maxStackSize}$ (z. B. $> 64$ für Bruchstein)
Anzeige-Umschalt-GameRuleitem_clumps:render_labels (Standard: true)

🏷️ Darstellung schwebender Beschriftungen auf Vanilla-Clients

Item Clumps nutzt das native Namensschild-Rendering von Vanilla Minecraft:

                      ┌───────────────────────────────┐
                      │ Ground Item Stack Size Changes│
                      └───────────────┬───────────────┘


                      ┌───────────────────────────────┐
                      │  Is render_labels Enabled?    │
                      │  Does count > maxStackSize?   │
                      └───────────────┬───────────────┘

                     ┌────────────────┴────────────────┐
                     │ (Yes)                           │ (No)
                     ▼                                 ▼
       ┌───────────────────────────┐     ┌───────────────────────────┐
       │ Set Entity Custom Name    │     │ Clear Entity Custom Name  │
       │ setCustomName(name xCount)│     │ setCustomName(null)       │
       │ setCustomNameVisible(true)│     │ setCustomNameVisible(false│
       └─────────────┬─────────────┘     └───────────────────────────┘


       ┌───────────────────────────┐
       │ SyncedEntityData Packet   │
       │ Sent to all nearby clients│
       └─────────────┬─────────────┘


       ┌───────────────────────────┐
       │ Vanilla Client Renders    │
       │ Clean Floating Name Tag!  │
       └───────────────────────────┘

💻 Reale Java-Quellcode-Implementierung

Aus ItemEntityMixin.java in Minecraft 26.1.2:

java
private void item_clumps$updateVanillaNameTag() {
    if (this.level() == null || this.level().isClientSide()) return;
    ItemStack stack = this.getItem();
    if (stack.isEmpty()) {
        this.setCustomName(null);
        this.setCustomNameVisible(false);
        return;
    }

    int count = stack.getCount();
    int maxStack = stack.getMaxStackSize();
    if (DynamicGameRuleManager.getBoolean(this.level(), ItemClumpsFabric.RENDER_LABELS) && count > maxStack) {
        Component name = stack.getItemName().copy().append(" x" + count);
        if (!this.hasCustomName() || !this.getCustomName().getString().equals(name.getString())) {
            this.setCustomName(name);
            this.setCustomNameVisible(true);
        }
    } else {
        if (this.hasCustomName()) {
            this.setCustomName(null);
            this.setCustomNameVisible(false);
        }
    }
}

@Inject(method = "tick", at = @At("HEAD"))
private void item_clumps$onTick(CallbackInfo ci) {
    if (!this.level().isClientSide()) {
        this.item_clumps$updateVanillaNameTag();
    }
}

@Inject(method = "setItem", at = @At("TAIL"))
private void item_clumps$onSetItem(ItemStack itemStack, CallbackInfo ci) {
    if (!this.level().isClientSide()) {
        this.item_clumps$updateVanillaNameTag();
    }
}

🔗 Verwandte Dokumentation (MC 26.1.2)

Official documentation & web portal for Dasik Igaijinn mods.