package com.tiedup.remake.v2.furniture; import java.util.List; import java.util.Map; import net.minecraft.resources.ResourceLocation; import org.jetbrains.annotations.Nullable; /** * Immutable definition for a data-driven furniture piece. * *
Loaded from JSON files in {@code data/
All rendering and gameplay properties are read from this record at runtime * via the furniture entity and renderer.
*/ public record FurnitureDefinition( /** Unique identifier (e.g., "tiedup:wooden_stocks"). */ ResourceLocation id, /** Human-readable display name (fallback if no translation key). */ String displayName, /** Optional translation key for localized display name. */ @Nullable String translationKey, /** Resource location of the GLB model file. */ ResourceLocation modelLocation, /** Tint channel defaults: channel name to ARGB color (e.g., "tintable_0" -> 0x8B4513). */ MapPoints to a standard {@code item/generated} model JSON that will be used * as the inventory sprite for this furniture variant when held as a placer item. * When null, the default {@code tiedup:item/furniture_placer} model is used.
*/ @Nullable ResourceLocation icon ) { /** * Find a seat definition by its unique ID. * * @param seatId the seat identifier to search for * @return the matching {@link SeatDefinition}, or null if not found */ @Nullable public SeatDefinition getSeat(String seatId) { for (SeatDefinition seat : seats) { if (seat.id().equals(seatId)) return seat; } return null; } /** * Get the positional index of a seat (for bitmask operations on lock state, occupancy, etc.). * * @param seatId the seat identifier to search for * @return the zero-based index, or -1 if not found */ public int getSeatIndex(String seatId) { for (int i = 0; i < seats.size(); i++) { if (seats.get(i).id().equals(seatId)) return i; } return -1; } }