From e17998933c2bc8a747dd4d448d3f613659d28c82 Mon Sep 17 00:00:00 2001 From: NotEvil Date: Mon, 13 Apr 2026 03:57:34 +0200 Subject: [PATCH] Add creator field and enriched tooltip for data-driven items - Add optional "creator" JSON field to display author name in tooltip - Show body regions, movement style, lock status, and escape difficulty - Show pose priority and item ID in advanced mode (F3+H) - Update ARTIST_GUIDE.md field reference and test JSON --- README.md | 2 +- docs/ARTIST_GUIDE.md | 1 + .../datadriven/DataDrivenBondageItem.java | 68 +++++++++++++++++++ .../datadriven/DataDrivenItemDefinition.java | 3 + .../datadriven/DataDrivenItemParser.java | 4 ++ .../resources/assets/tiedup/lang/en_us.json | 4 ++ .../tiedup/tiedup_items/test_handcuffs.json | 1 + 7 files changed, 82 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 55add80..b9bfe05 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,7 @@ Some dependencies are included as local JARs in `libs/` because they are not ava GPL-3.0 with Commons Clause - see [LICENSE](LICENSE) for details. **TL;DR:** Free to use, modify, and distribute. Cannot be sold or put behind a paywall. -The 3D models are the **property of their creators**; if their names are listed, please ask them for permission. +The 3D models are the **property of their creators**; if their names are listed, please ask them for permission otherwise me. ## Status diff --git a/docs/ARTIST_GUIDE.md b/docs/ARTIST_GUIDE.md index 81acc2e..3b72aeb 100644 --- a/docs/ARTIST_GUIDE.md +++ b/docs/ARTIST_GUIDE.md @@ -762,6 +762,7 @@ The `movement_style` changes how the player physically moves — slower speed, d | `animations` | string/object | No | `"auto"` (default) or explicit name mapping | | `movement_style` | string | No | Movement restriction: `"waddle"`, `"shuffle"`, `"hop"`, or `"crawl"` | | `movement_modifier` | object | No | Override speed/jump for the movement style (requires `movement_style`) | +| `creator` | string | No | Author/creator name, shown in the item tooltip | | `animation_bones` | object | Yes | Per-animation bone whitelist (see below) | ### animation_bones (required) diff --git a/src/main/java/com/tiedup/remake/v2/bondage/datadriven/DataDrivenBondageItem.java b/src/main/java/com/tiedup/remake/v2/bondage/datadriven/DataDrivenBondageItem.java index 77dd380..9f215a2 100644 --- a/src/main/java/com/tiedup/remake/v2/bondage/datadriven/DataDrivenBondageItem.java +++ b/src/main/java/com/tiedup/remake/v2/bondage/datadriven/DataDrivenBondageItem.java @@ -5,12 +5,17 @@ import com.tiedup.remake.v2.bondage.IV2BondageEquipment; import com.tiedup.remake.v2.bondage.V2BondageItems; import com.tiedup.remake.v2.bondage.capability.V2EquipmentHelper; import com.tiedup.remake.v2.bondage.items.AbstractV2BondageItem; +import java.util.List; import java.util.Map; import java.util.Set; +import java.util.stream.Collectors; +import net.minecraft.ChatFormatting; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.level.Level; import org.jetbrains.annotations.Nullable; /** @@ -177,6 +182,69 @@ public class DataDrivenBondageItem extends AbstractV2BondageItem { ); } + // ===== TOOLTIPS ===== + + @Override + public void appendHoverText( + ItemStack stack, + @Nullable Level level, + List tooltip, + TooltipFlag flag + ) { + DataDrivenItemDefinition def = DataDrivenItemRegistry.get(stack); + if (def != null) { + // Creator + if (def.creator() != null && !def.creator().isEmpty()) { + tooltip.add( + Component.translatable( + "item.tiedup.tooltip.creator", + Component.literal(def.creator()) + .withStyle(ChatFormatting.WHITE) + ).withStyle(ChatFormatting.GRAY) + ); + } + + // Regions + String regions = def.occupiedRegions().stream() + .map(r -> r.name().toLowerCase()) + .collect(Collectors.joining(", ")); + tooltip.add( + Component.translatable( + "item.tiedup.tooltip.regions", + regions + ).withStyle(ChatFormatting.DARK_AQUA) + ); + + // Movement style + if (def.movementStyle() != null) { + tooltip.add( + Component.translatable( + "item.tiedup.tooltip.movement_style", + def.movementStyle().name().toLowerCase() + ).withStyle(ChatFormatting.DARK_PURPLE) + ); + } + } + + // Lock status + escape difficulty (from AbstractV2BondageItem) + super.appendHoverText(stack, level, tooltip, flag); + + if (def != null && flag.isAdvanced()) { + // Advanced info (F3+H): pose priority + item ID + tooltip.add( + Component.translatable( + "item.tiedup.tooltip.pose_priority", + def.posePriority() + ).withStyle(ChatFormatting.DARK_GRAY) + ); + tooltip.add( + Component.literal( + def.id().toString() + ).withStyle(ChatFormatting.DARK_GRAY) + ); + } + } + // ===== DISPLAY NAME ===== @Override diff --git a/src/main/java/com/tiedup/remake/v2/bondage/datadriven/DataDrivenItemDefinition.java b/src/main/java/com/tiedup/remake/v2/bondage/datadriven/DataDrivenItemDefinition.java index c3c7aea..0c5f5f4 100644 --- a/src/main/java/com/tiedup/remake/v2/bondage/datadriven/DataDrivenItemDefinition.java +++ b/src/main/java/com/tiedup/remake/v2/bondage/datadriven/DataDrivenItemDefinition.java @@ -81,6 +81,9 @@ public record DataDrivenItemDefinition( @Nullable com.tiedup.remake.v2.bondage.movement.MovementModifier movementModifier, + /** Optional creator/author name displayed in the item tooltip. */ + @Nullable String creator, + /** * Per-animation bone whitelist. Maps animation name (e.g. "idle", "struggle") * to the set of PlayerAnimator bone names this item is allowed to animate. diff --git a/src/main/java/com/tiedup/remake/v2/bondage/datadriven/DataDrivenItemParser.java b/src/main/java/com/tiedup/remake/v2/bondage/datadriven/DataDrivenItemParser.java index abd6f70..ff9e9fb 100644 --- a/src/main/java/com/tiedup/remake/v2/bondage/datadriven/DataDrivenItemParser.java +++ b/src/main/java/com/tiedup/remake/v2/bondage/datadriven/DataDrivenItemParser.java @@ -250,6 +250,9 @@ public final class DataDrivenItemParser { ); } + // Optional: creator (author name for tooltip) + String creator = getStringOrNull(root, "creator"); + // Required: animation_bones (per-animation bone whitelist) Map> animationBones = parseAnimationBones( root, @@ -298,6 +301,7 @@ public final class DataDrivenItemParser { icon, movementStyle, movementModifier, + creator, animationBones ); } diff --git a/src/main/resources/assets/tiedup/lang/en_us.json b/src/main/resources/assets/tiedup/lang/en_us.json index 8c18a6f..0069fa3 100644 --- a/src/main/resources/assets/tiedup/lang/en_us.json +++ b/src/main/resources/assets/tiedup/lang/en_us.json @@ -229,6 +229,10 @@ "item.tiedup.tooltip.lockable": "Lockable (has padlock)", "item.tiedup.tooltip.jammed": "Jammed (lockpick blocked)", "item.tiedup.tooltip.escape_difficulty": "Escape Difficulty: %s", + "item.tiedup.tooltip.creator": "By %s", + "item.tiedup.tooltip.regions": "Regions: %s", + "item.tiedup.tooltip.movement_style": "Movement: %s", + "item.tiedup.tooltip.pose_priority": "Pose Priority: %s", "item.tiedup.v2_handcuffs": "Handcuffs", diff --git a/src/main/resources/assets/tiedup/tiedup_items/test_handcuffs.json b/src/main/resources/assets/tiedup/tiedup_items/test_handcuffs.json index 97c188c..e9ee163 100644 --- a/src/main/resources/assets/tiedup/tiedup_items/test_handcuffs.json +++ b/src/main/resources/assets/tiedup/tiedup_items/test_handcuffs.json @@ -1,6 +1,7 @@ { "type": "tiedup:bondage_item", "display_name": "Data-Driven Handcuffs", + "creator": "TiedUp! Team", "model": "tiedup:models/gltf/v2/handcuffs/cuffs_prototype.glb", "regions": ["ARMS"], "pose_priority": 30, -- 2.49.1