Merge pull request 'feature/item-tooltip-creator' (#4) from feature/item-tooltip-creator into develop
Reviewed-on: #4
This commit was merged in pull request #4.
This commit is contained in:
@@ -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.
|
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.
|
**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
|
## Status
|
||||||
|
|
||||||
|
|||||||
@@ -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 |
|
| `animations` | string/object | No | `"auto"` (default) or explicit name mapping |
|
||||||
| `movement_style` | string | No | Movement restriction: `"waddle"`, `"shuffle"`, `"hop"`, or `"crawl"` |
|
| `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`) |
|
| `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` | object | Yes | Per-animation bone whitelist (see below) |
|
||||||
|
|
||||||
### animation_bones (required)
|
### animation_bones (required)
|
||||||
|
|||||||
@@ -5,12 +5,17 @@ import com.tiedup.remake.v2.bondage.IV2BondageEquipment;
|
|||||||
import com.tiedup.remake.v2.bondage.V2BondageItems;
|
import com.tiedup.remake.v2.bondage.V2BondageItems;
|
||||||
import com.tiedup.remake.v2.bondage.capability.V2EquipmentHelper;
|
import com.tiedup.remake.v2.bondage.capability.V2EquipmentHelper;
|
||||||
import com.tiedup.remake.v2.bondage.items.AbstractV2BondageItem;
|
import com.tiedup.remake.v2.bondage.items.AbstractV2BondageItem;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import net.minecraft.ChatFormatting;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.item.TooltipFlag;
|
||||||
|
import net.minecraft.world.level.Level;
|
||||||
import org.jetbrains.annotations.Nullable;
|
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<Component> 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 =====
|
// ===== DISPLAY NAME =====
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -81,6 +81,9 @@ public record DataDrivenItemDefinition(
|
|||||||
@Nullable
|
@Nullable
|
||||||
com.tiedup.remake.v2.bondage.movement.MovementModifier movementModifier,
|
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")
|
* Per-animation bone whitelist. Maps animation name (e.g. "idle", "struggle")
|
||||||
* to the set of PlayerAnimator bone names this item is allowed to animate.
|
* to the set of PlayerAnimator bone names this item is allowed to animate.
|
||||||
|
|||||||
@@ -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)
|
// Required: animation_bones (per-animation bone whitelist)
|
||||||
Map<String, Set<String>> animationBones = parseAnimationBones(
|
Map<String, Set<String>> animationBones = parseAnimationBones(
|
||||||
root,
|
root,
|
||||||
@@ -298,6 +301,7 @@ public final class DataDrivenItemParser {
|
|||||||
icon,
|
icon,
|
||||||
movementStyle,
|
movementStyle,
|
||||||
movementModifier,
|
movementModifier,
|
||||||
|
creator,
|
||||||
animationBones
|
animationBones
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -229,6 +229,10 @@
|
|||||||
"item.tiedup.tooltip.lockable": "Lockable (has padlock)",
|
"item.tiedup.tooltip.lockable": "Lockable (has padlock)",
|
||||||
"item.tiedup.tooltip.jammed": "Jammed (lockpick blocked)",
|
"item.tiedup.tooltip.jammed": "Jammed (lockpick blocked)",
|
||||||
"item.tiedup.tooltip.escape_difficulty": "Escape Difficulty: %s",
|
"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",
|
"item.tiedup.v2_handcuffs": "Handcuffs",
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"type": "tiedup:bondage_item",
|
"type": "tiedup:bondage_item",
|
||||||
"display_name": "Data-Driven Handcuffs",
|
"display_name": "Data-Driven Handcuffs",
|
||||||
|
"creator": "TiedUp! Team",
|
||||||
"model": "tiedup:models/gltf/v2/handcuffs/cuffs_prototype.glb",
|
"model": "tiedup:models/gltf/v2/handcuffs/cuffs_prototype.glb",
|
||||||
"regions": ["ARMS"],
|
"regions": ["ARMS"],
|
||||||
"pose_priority": 30,
|
"pose_priority": 30,
|
||||||
|
|||||||
Reference in New Issue
Block a user