Etiquetas holográficas (MC 26.1.2)
Este documento detalla el sistema de indicadores de recuento flotantes y la renderización de etiquetas de nombre puramente vanilla de Item Clumps para Minecraft 26.1.2.
📊 Ficha técnica de características
| Propiedad | Especificación |
|---|---|
| Nombre del sistema | Proveedor de etiquetas holográficas en servidor |
| Estrategia de renderizado | Etiquetas de nombre personalizadas nativas de Vanilla (setCustomName / setCustomNameVisible) |
| ¿Se requiere mod en cliente? | No (100% renderizado por clientes de Minecraft Vanilla sin modificar) |
| Patrón de formato de etiqueta | <nombre_localizado_objeto> x<cantidad> (ej. Diamond x128, Oak Log x500) |
| Regla de umbral | Se muestra cuando $\text{count} > \text{maxStackSize}$ (ej. $> 64$ para adoquín) |
| GameRule de alternancia | item_clumps:render_labels (Predeterminado: true) |
🏷️ Cómo se renderizan las etiquetas flotantes en clientes Vanilla
Item Clumps aprovecha la renderización nativa de etiquetas de nombres de 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! │
└───────────────────────────┘💻 Implementación del código fuente Java real
De ItemEntityMixin.java en 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();
}
}