Skip to content

Commit

Permalink
1.12.0+的root骨骼处理
Browse files Browse the repository at this point in the history
模型包转换器bug修复
  • Loading branch information
ENIACJushi committed Jul 18, 2024
1 parent 34033d8 commit a67ed32
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 254 deletions.
16 changes: 12 additions & 4 deletions SkinPacksConvertor/root骨骼.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,20 @@ <h1>待处理文件(压缩包)</h1>
function processFile(_input){
let input = JSON.parse(_input);

for(let key in input){
if(key !== "format_version"){
processBone(input[key]["bones"])
// 旧格式
if(input["format_version"] === "1.10.0"){
for(let key in input){
if(key !== "format_version"){
processBone(input[key]["bones"])
}
}
}
// 新格式
else{
for(let geo of input["minecraft:geometry"]){
processBone(geo["bones"]);
}
}

return JSON.stringify(input);
}

Expand Down
26 changes: 19 additions & 7 deletions SkinPacksConvertor/模型包转换器.html
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ <h1>车万女仆模型包转换器</h1>

//// 转换并输出 ////
// 骨骼处理
const rootBone = {
"name": "root",
"pivot": [0, 0, 0]
}
function processBone(bones){
if(bones===undefined) return false;

Expand Down Expand Up @@ -317,21 +321,29 @@ <h1>车万女仆模型包转换器</h1>


// 补充模型标识符信息
if(modelJson["format_version"] === "1.12.0"){ // 1.12.0
if(modelJson["format_version"] === "1.10.0"){ // 1.10.0
bedrock = modelText.replace("geometry.model", `geometry.${packName2}.${model_name}`);
}
else{ // 1.12.0+
for(let model of modelJson["minecraft:geometry"]){
model["description"]["identifier"] = `geometry.${packName2}.${model_name}`;
}
bedrock = JSON.stringify(modelJson, null, '\t');
}
else{ // 1.10.0
bedrock = modelText.replace("geometry.model", `geometry.${packName2}.${model_name}`);
}

// 骨骼修改
bedrock = JSON.parse(bedrock);
for(let key in bedrock){
if(key !== "format_version"){
processBone(input[key]["bones"])
if(bedrock["format_version"] === "1.10.0"){
for(let key in bedrock){
if(key !== "format_version"){
processBone(bedrock[key]["bones"])
}
}
}
// 新格式
else{
for(let geo of bedrock["minecraft:geometry"]){
processBone(geo["bones"]);
}
}

Expand Down
43 changes: 41 additions & 2 deletions TouHouLittleMaid_BP/entities/maid/maid.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,24 @@
"track_target": true
}
},
// 抱起时移动属性 其实是取消碰撞箱
"thlmm:maid_basic_hug_movement":{
"minecraft:collision_box": { "width": 0, "height": 0 },
"minecraft:navigation.walk": {
"can_walk": false
},
"minecraft:behavior.random_stroll": {
"priority": 8,
"speed_multiplier": 0.0
},
"minecraft:movement.basic": { },
"minecraft:behavior.mount_pathing": {
"priority": 3,
"speed_multiplier": 0.0,
"target_dist": 0,
"track_target": true
}
},
// 正常跟随(站立)
"status:follow_standard":{
"minecraft:behavior.follow_owner": {
Expand Down Expand Up @@ -554,9 +572,21 @@
}
}
},
// 只是加了一个 parrot_tame
// 加了一个 parrot_tame 和rideable
"mode:searching_danmaku_attack_hug":{
"minecraft:type_family" : { "family": [ "maid", "mob", "player", "parrot_tame" ] },
"minecraft:rideable": {// 提供交互
"controlling_seat": 0,
"crouching_skip_interact": true,
"family_types": ["hug_maid"],
"interact_text": "",
"pull_in_entities": false,
"rider_can_interact": false,
"seat_count": 1,
"seats":[
{"position": [ -0.4, 0.2, 0.1 ], "lock_rider_rotation": 0, "rotate_rider_by": 0}
]
},
"minecraft:behavior.nearest_attackable_target": {
"priority": 4, "must_see": true, "must_reach": false,
"reselect_targets": true, "within_radius": 16, "scan_interval": 10,
Expand Down Expand Up @@ -1169,14 +1199,23 @@
{
"filters": {"test": "int_property", "domain": "thlm:work", "value": 2, "operator": "not"},
"add": { "component_groups": [ "mode:hug" ] }
},
// 切换移动属性
{
"remove": {"component_groups": ["thlmm:maid_basic_sit_movement"]},
"add": {"component_groups": ["thlmm:maid_basic_hug_movement"]}
}
]
},
"thlmm:k": {
}, // Hug stop
"api:hug_to_sit":{
"sequence": [

// 切换移动属性
{
"add": {"component_groups": ["thlmm:maid_basic_sit_movement"]},
"remove": {"component_groups": ["thlmm:maid_basic_hug_movement"]}
},
// 移除通用 hug 组
{
"filters": {"test": "int_property", "domain": "thlm:work", "value": 2, "operator": "not"},
Expand Down
19 changes: 0 additions & 19 deletions TouHouLittleMaid_BP/items/7fc2dcef9d9b81fbf0a3.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"identifier": "touhou_little_maid:hakurei_gohei_amulet"
},
"components": {

"minecraft:allow_off_hand": true,
"minecraft:icon": {
"texture": "touhou_little_maid.hakurei_gohei"
},
Expand Down
21 changes: 12 additions & 9 deletions TouHouLittleMaid_BP/scripts/src/maid/MaidManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -787,16 +787,19 @@ export class MaidManager{
* @param {DataDrivenEntityTriggerAfterEvent} event
*/
static seatScan(event){
let seat = event.entity;

let maids = seat.dimension.getEntities({
"location": seat.location,
"maxDistance": 1,
"families": ["maid"]
});
if(maids.length === 0){
seat.remove();
try{
let seat = event.entity;
if(seat === undefined) return;
let maids = seat.dimension.getEntities({
"location": seat.location,
"maxDistance": 1,
"families": ["maid"]
});
if(maids.length === 0){
seat.remove();
}
}
catch{}
}
/**
* 女仆扫描
Expand Down
2 changes: 1 addition & 1 deletion TouHouLittleMaid_RP/animations/entity/maid.animation.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"bones": {
"root": {
"rotation": [0, -90, -90],
"position": [6, -5.5, -9]
"position": [6, -4.5, -9]
},
"head": {
"rotation": [27.5, 0, 0]
Expand Down
Loading

0 comments on commit a67ed32

Please sign in to comment.