Skip to content

Etiquetas Holográficas (MC 26.1.2)

Este documento detalha o sistema de indicadores flutuantes de quantidade e renderização de etiquetas vanilla do Item Clumps para Minecraft 26.1.2.


📊 Ficha Técnica do Recurso

PropriedadeEspecificação
Nome do SistemaProvedor de Etiquetas Holográficas no Servidor
Estratégia de RenderizaçãoEtiquetas de nome personalizadas nativas do vanilla (setCustomName / setCustomNameVisible)
Mod no Cliente Necessário?Não (100% renderizado por clientes vanilla não modificados)
Padrão de Formato de Etiqueta<nome_localizado_item> x<quantidade> (ex.: Diamond x128, Oak Log x500)
Regra de LimiarExibe quando $\text{count} > \text{maxStackSize}$ (ex.: $> 64$ para pedregulho)
GameRule de Alternânciaitem_clumps:render_labels (Padrão: true)

🏷️ Como as Etiquetas Flutuantes Renderizam em Clientes Vanilla

O Item Clumps utiliza a renderização nativa de etiquetas de nome de entidades do Minecraft Vanilla:

                      ┌───────────────────────────────┐
                      │ 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!  │
       └───────────────────────────┘

💻 Implementação do Código-Fonte Java Real

De ItemEntityMixin.java no 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();
    }
}

🔗 Documentação Relacionada (MC 26.1.2)

Official documentation & web portal for Dasik Igaijinn mods.