Skip to content

Commit 6654b25

Browse files
authored
iteminternal/components.go: Remove deprecated minecraft:render_offsets component (#996)
1 parent 6fbcb9e commit 6654b25

File tree

1 file changed

+0
-34
lines changed

1 file changed

+0
-34
lines changed

server/internal/iteminternal/components.go

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -78,39 +78,5 @@ func Components(it world.CustomItem) map[string]any {
7878
if x, ok := it.(item.HandEquipped); ok {
7979
builder.AddProperty("hand_equipped", x.HandEquipped())
8080
}
81-
itemScale := calculateItemScale(it)
82-
builder.AddComponent("minecraft:render_offsets", map[string]any{
83-
"main_hand": map[string]any{
84-
"first_person": map[string]any{
85-
"scale": itemScale,
86-
},
87-
"third_person": map[string]any{
88-
"scale": itemScale,
89-
},
90-
},
91-
"off_hand": map[string]any{
92-
"first_person": map[string]any{
93-
"scale": itemScale,
94-
},
95-
"third_person": map[string]any{
96-
"scale": itemScale,
97-
},
98-
},
99-
})
100-
10181
return builder.Construct()
10282
}
103-
104-
// calculateItemScale calculates the scale of the item to be rendered to the player according to the given size.
105-
func calculateItemScale(it world.CustomItem) []float32 {
106-
width := float32(it.Texture().Bounds().Dx())
107-
height := float32(it.Texture().Bounds().Dy())
108-
var x, y, z float32 = 0.1, 0.1, 0.1
109-
if _, ok := it.(item.HandEquipped); ok {
110-
x, y, z = 0.075, 0.125, 0.075
111-
}
112-
newX := x / (width / 16)
113-
newY := y / (height / 16)
114-
newZ := z / (width / 16)
115-
return []float32{newX, newY, newZ}
116-
}

0 commit comments

Comments
 (0)