홀로그램 라벨 (MC 26.1.2)
이 문서는 Minecraft 26.1.2 버전의 Item Clumps에 대한 부유 수량 표시 시스템 및 순수 바닐라 클라이언트 이름표 렌더링에 대해 다룹니다.
📊 기능 정보 상자
| 속성 | 세부 정보 |
|---|---|
| 시스템 이름 | 서버 측 홀로그램 이름표 제공 시스템 |
| 렌더링 방식 | 바닐라 기본 사용자 정의 이름표 (setCustomName / setCustomNameVisible) |
| 클라이언트 모드 필요 여부 | 불필요 (순정 바닐라 클라이언트에서 100% 렌더링) |
| 라벨 형식 | <아이템 이름> x<수량> (예: 다이아몬드 x128, 참나무 원목 x500) |
| 표시 기준 | $\text{count} > \text{maxStackSize}$ 시 표시 (예: 조약돌의 경우 $> 64$) |
| 라벨 표시 전환 규칙 | item_clumps:render_labels (기본값: true) |
🏷️ 바닐라 클라이언트에서의 부유 라벨 렌더링 방식
Item Clumps는 바닐라 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! │
└───────────────────────────┘💻 실제 Java 소스 코드 구현
Minecraft 26.1.2의 ItemEntityMixin.java 출처:
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();
}
}