# 실험적 기능

실험중인 기능들입니다. 정상적인 작동을 보장하지 않습니다

### BetterModel Compatibility

&#x20;베러모델의 모델을 허드로 사용합니다.

```
import:
    org.joml.Vector3f
    java.util.function.Supplier
    kr.toxicity.model.api.BetterModel
    kr.toxicity.model.api.util.function.FloatSupplier
    
function addBmHud(p:entity,id:string,location:vector,scale:number,model:string,animate:string):: object:
    create section with {_pre} stored in {_pre::getAsFloat}:
        return {_scale}
    set {_pre} to new proxy instance of FloatSupplier using {_pre::*}

    create section with {_spl} stored in {_m::get}:
        return new Vector3f({_location}.x,-50000 + {_location}.y,{_location}.z)
    set {_spl} to new proxy instance of Supplier using {_m::*}

    set {_e} to addHud({_p},{_id},{_location},vector(0,0,0),stone)
    set {_m} to BetterModel.model({_model}).orElse(null)
    set {_r} to {_m}.create({_e})
    set {_pipe} to {_r}.getPipeline()
    if {_p} is a player:
        loop all players where [input is not {_p}]:
            {_pipe}.hide(loop-player)
    {_pipe}.defaultPosition({_spl})
    {_pipe}.scale({_pre})
    {_r}.animate({_string})
    return {_r}
```

허드는 기본적으로 그림자가 제거되므로 -30000 ( center aligned ) 에서 사용시 부자연스럽게 보입니다. 따라서 -40000 범위를 감지하는 구문을 hud.glsl에 추가해야합니다

```
if (Position.y < -20000.0) { //정렬
            if (Position.y < -50000.0) { //베러모델
                pos.y += 30000.0;
                vertexColor = tempColor;
            }
            else if (Position.y < -40000.0) { //오른쪽
                pos.y += 20000.0;
                offset = 1-(ScreenSize.y/9*16)/ScreenSize.x;
            } else if (Position.y < -30000.0) { //중앙
                pos.y += 10000.0;
            } else { //왼쪽
                offset = -1+(ScreenSize.y/9*16)/ScreenSize.x;
            }
            pos.y += 10000.0;
            pos.x *= (ScreenSize.y/9*16)/ScreenSize.x;
        }
```

<figure><img src="https://2580338160-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKuhi8aSwWgM2WuG3xVEN%2Fuploads%2F03mpegD57OZhdtOIf0f2%2FHoneycam%202025-11-11%2018-58-50.gif?alt=media&#x26;token=fecf66d6-4d14-4411-acb5-9b2ab5a0d240" alt=""><figcaption></figcaption></figure>

### Global Hud

&#x20;특정 허드를 가진 엔티티가 각 플레이어에게 탑승하는 패킷을 보내서 허드의 위치를 고정합니다

실제 엔티티까지의 거리가 엔티티 가시거리를 넘어서면 허드가 사라집니다

```
import:
    net.minecraft.network.protocol.game.ClientboundSetPassengersPacket
    io.netty.buffer.Unpooled
    net.minecraft.network.FriendlyByteBuf

function addGlobalHud(p:player,e:entity):
    set {_Arr} to new int[1 + size of passengers of {_p}]
    set {_Arr}[0] to ({_e}).getEntityId().intValue()
    loop passengers of {_p}:
        set {_Arr}[loop-counter] to loop-value.getEntityId().intValue()
    set {_buf} to new FriendlyByteBuf(Unpooled.buffer())
    {_buf}.writeVarInt({_p}.getEntityId().intValue())
    {_buf}.writeVarIntArray({_Arr})
    {_p}.getHandle().connection.send(new ClientboundSetPassengersPacket({_buf}))
```

### 1인칭 허드

&#x20;허드가 1인칭에서만 표시되도록 합니다

대부분의 엔티티 가시거리 설정(클라이언트)에서 작동합니다

완벽하게 3인칭에서 허드를 숨기려면 unit을 매우 낮은값으로 수정하고 hud.glsl에서 x,z의 최댓값을 제한하는 조건을 추가하세요

```
set display view range of {_e} to 0.003 #display
{_r}.update(TrackerUpdateAction.viewRange(0.003)) #BetterModel
```
