From 6654b256803f7b7517a65e0749eef98ccd79af7b Mon Sep 17 00:00:00 2001 From: Jon <86489758+xNatsuri@users.noreply.github.com> Date: Sat, 18 Jan 2025 16:46:24 -0800 Subject: [PATCH] iteminternal/components.go: Remove deprecated minecraft:render_offsets component (#996) --- server/internal/iteminternal/components.go | 34 ---------------------- 1 file changed, 34 deletions(-) diff --git a/server/internal/iteminternal/components.go b/server/internal/iteminternal/components.go index 9c8d76661..ed6f64d1e 100644 --- a/server/internal/iteminternal/components.go +++ b/server/internal/iteminternal/components.go @@ -78,39 +78,5 @@ func Components(it world.CustomItem) map[string]any { if x, ok := it.(item.HandEquipped); ok { builder.AddProperty("hand_equipped", x.HandEquipped()) } - itemScale := calculateItemScale(it) - builder.AddComponent("minecraft:render_offsets", map[string]any{ - "main_hand": map[string]any{ - "first_person": map[string]any{ - "scale": itemScale, - }, - "third_person": map[string]any{ - "scale": itemScale, - }, - }, - "off_hand": map[string]any{ - "first_person": map[string]any{ - "scale": itemScale, - }, - "third_person": map[string]any{ - "scale": itemScale, - }, - }, - }) - return builder.Construct() } - -// calculateItemScale calculates the scale of the item to be rendered to the player according to the given size. -func calculateItemScale(it world.CustomItem) []float32 { - width := float32(it.Texture().Bounds().Dx()) - height := float32(it.Texture().Bounds().Dy()) - var x, y, z float32 = 0.1, 0.1, 0.1 - if _, ok := it.(item.HandEquipped); ok { - x, y, z = 0.075, 0.125, 0.075 - } - newX := x / (width / 16) - newY := y / (height / 16) - newZ := z / (width / 16) - return []float32{newX, newY, newZ} -}