diff --git a/renderer/viewer/lib/entities.ts b/renderer/viewer/lib/entities.ts index b60a5fef..c6be8004 100644 --- a/renderer/viewer/lib/entities.ts +++ b/renderer/viewer/lib/entities.ts @@ -505,11 +505,13 @@ export class Entities extends EventEmitter { if (textureUv && 'resolvedModel' in textureUv) { const mesh = getBlockMeshFromModel(this.viewer.world.material, textureUv.resolvedModel, textureUv.modelName) + let SCALE = 1 if (specificProps['minecraft:display_context'] === 'ground') { - const SCALE = 0.5 - mesh.scale.set(SCALE, SCALE, SCALE) - mesh.position.set(0, 0.2, 0) + SCALE = 0.5 + } else if (specificProps['minecraft:display_context'] === 'thirdperson') { + SCALE = 6 } + mesh.scale.set(SCALE, SCALE, SCALE) const outerGroup = new THREE.Group() outerGroup.add(mesh) return { @@ -554,6 +556,13 @@ export class Entities extends EventEmitter { new THREE.MeshBasicMaterial({ color: 0x00_00_00 }), new THREE.MeshBasicMaterial({ color: 0x00_00_00 }), material, materialFlipped, ]) + let SCALE = 1 + if (specificProps['minecraft:display_context'] === 'ground') { + SCALE = 0.5 + } else if (specificProps['minecraft:display_context'] === 'thirdperson') { + SCALE = 6 + } + mesh.scale.set(SCALE, SCALE, SCALE) return { mesh, isBlock: false, @@ -589,6 +598,9 @@ export class Entities extends EventEmitter { if (entity.delete) { if (!e) return if (e.additionalCleanup) e.additionalCleanup() + e.traverse(c => { + if (c['additionalCleanup']) c['additionalCleanup']() + }) this.emit('remove', entity) this.viewer.scene.remove(e) disposeObject(e) @@ -702,6 +714,8 @@ export class Entities extends EventEmitter { // check if entity has armor if (entity.equipment) { + this.addItemModel(e, 'left', entity.equipment[0]) + this.addItemModel(e, 'right', entity.equipment[1]) addArmorModel(e, 'feet', entity.equipment[2]) addArmorModel(e, 'legs', entity.equipment[3], 2) addArmorModel(e, 'chest', entity.equipment[4]) @@ -775,7 +789,7 @@ export class Entities extends EventEmitter { c.setRotationFromEuler(poseToEuler(armorStandMeta.body_pose)) } break - case 'bone_leftarm': + case 'bone_rightarm': if (c.parent?.name !== 'bone_armor') { this.setVisible(c, hasArms) } @@ -785,7 +799,7 @@ export class Entities extends EventEmitter { c.setRotationFromEuler(poseToEuler({ 'yaw': -10, 'pitch': -10, 'roll': 0 })) } break - case 'bone_rightarm': + case 'bone_leftarm': if (c.parent?.name !== 'bone_armor') { this.setVisible(c, hasArms) } @@ -795,14 +809,14 @@ export class Entities extends EventEmitter { c.setRotationFromEuler(poseToEuler({ 'yaw': 10, 'pitch': -10, 'roll': 0 })) } break - case 'bone_leftleg': + case 'bone_rightleg': if (armorStandMeta.left_leg_pose) { c.setRotationFromEuler(poseToEuler(armorStandMeta.left_leg_pose)) } else { c.setRotationFromEuler(poseToEuler({ 'yaw': -1, 'pitch': -1, 'roll': 0 })) } break - case 'bone_rightleg': + case 'bone_leftleg': if (armorStandMeta.right_leg_pose) { c.setRotationFromEuler(poseToEuler(armorStandMeta.right_leg_pose)) } else { @@ -852,9 +866,13 @@ export class Entities extends EventEmitter { }) if (itemMesh) { itemMesh.mesh.position.set(0, 0, 0.43) - itemMesh.mesh.scale.set(0.5, 0.5, 0.5) + if (itemMesh.isBlock) { + itemMesh.mesh.scale.set(0.25, 0.25, 0.25) + } else { + itemMesh.mesh.scale.set(0.5, 0.5, 0.5) + } itemMesh.mesh.rotateY(Math.PI) - itemMesh.mesh.rotateZ(rotation * Math.PI / 4) + itemMesh.mesh.rotateZ(-rotation * Math.PI / 4) itemMesh.mesh.name = 'item' e.add(itemMesh.mesh) } @@ -951,6 +969,45 @@ export class Entities extends EventEmitter { return texture } + addItemModel (entityMesh: SceneEntity, hand: 'left' | 'right', item: Item) { + const parentName = `bone_${hand}item` + // remove existing item + entityMesh.traverse(c => { + if (c.parent?.name.toLowerCase() === parentName) { + c.removeFromParent() + if (c['additionalCleanup']) c['additionalCleanup']() + } + }) + if (!item) return + + const itemObject = this.getItemMesh(item, { + 'minecraft:display_context': 'thirdperson', + }) + if (itemObject) { + entityMesh.traverse(c => { + if (c.name.toLowerCase() === parentName) { + const group = new THREE.Object3D() + group['additionalCleanup'] = () => { + // important: avoid texture memory leak and gpu slowdown + itemObject.itemsTexture?.dispose() + itemObject.itemsTextureFlipped?.dispose() + } + const itemMesh = itemObject.mesh + group.rotation.z = -Math.PI / 16 + if (itemObject.isBlock) { + group.rotation.y = Math.PI / 4 + } else { + itemMesh.rotation.z = -Math.PI / 4 + group.rotation.y = Math.PI / 2 + group.scale.multiplyScalar(2) + } + group.add(itemMesh) + c.add(group) + } + }) + } + } + handleDamageEvent (entityId, damageAmount) { const entityMesh = this.entities[entityId]?.children.find(c => c.name === 'mesh') if (entityMesh) { diff --git a/renderer/viewer/lib/entity/armorModels.json b/renderer/viewer/lib/entity/armorModels.json index 3e33939e..d7a77d4c 100644 --- a/renderer/viewer/lib/entity/armorModels.json +++ b/renderer/viewer/lib/entity/armorModels.json @@ -84,7 +84,7 @@ ] }, { - "name": "rightarm", + "name": "leftarm", "parent": "armor", "pivot": [5, 10, 0], "cubes": [ @@ -97,7 +97,7 @@ ] }, { - "name": "leftarm", + "name": "rightarm", "parent": "armor", "pivot": [-5, 10, 0], "cubes": [ @@ -133,7 +133,7 @@ ] }, { - "name": "rightleg", + "name": "leftleg", "parent": "armor", "pivot": [1.9, 1, 0], "cubes": [ @@ -146,7 +146,7 @@ ] }, { - "name": "leftleg", + "name": "rightleg", "parent": "armor", "pivot": [-1.9, 1, 0], "cubes": [ @@ -169,7 +169,7 @@ "bones": [ {"name": "armor", "pivot": [0, 12, 0]}, { - "name": "rightleg", + "name": "leftleg", "parent": "armor", "pivot": [1.9, 1, 0], "cubes": [ @@ -182,7 +182,7 @@ ] }, { - "name": "leftleg", + "name": "rightleg", "parent": "armor", "pivot": [-1.9, 1, 0], "cubes": [ diff --git a/renderer/viewer/lib/entity/entities.json b/renderer/viewer/lib/entity/entities.json index 645635b7..feca5dc7 100644 --- a/renderer/viewer/lib/entity/entities.json +++ b/renderer/viewer/lib/entity/entities.json @@ -41,7 +41,7 @@ ] }, { - "name": "rightarm", + "name": "leftarm", "parent": "waist", "mirror": true, "pivot": [5, 10, 0], @@ -49,9 +49,9 @@ {"origin": [5, 12, -1], "size": [2, 12, 2], "uv": [32, 16]} ] }, - {"name": "rightitem", "parent": "leftarm", "pivot": [6, 15, 1]}, + {"name": "leftitem", "parent": "leftarm", "pivot": [1, -9, -5]}, { - "name": "rightleg", + "name": "leftleg", "parent": "waist", "mirror": true, "pivot": [1.9, 1, 0], @@ -60,16 +60,16 @@ ] }, { - "name": "leftarm", + "name": "rightarm", "parent": "waist", "pivot": [-5, 10, 0], "cubes": [ {"origin": [-7, 12, -1], "size": [2, 12, 2], "uv": [24, 0]} ] }, - {"name": "leftitem", "parent": "rightarm", "pivot": [-6, 15, 1]}, + {"name": "rightitem", "parent": "rightarm", "pivot": [-1, -9, -5]}, { - "name": "leftleg", + "name": "rightleg", "parent": "waist", "pivot": [-1.9, 1, 0], "cubes": [ @@ -769,8 +769,8 @@ ] }, {"name": "waist", "parent": "body", "pivot": [0, 12, 0]}, - {"name": "rightItem", "parent": "rightArm", "pivot": [-6, 15, 1]}, - {"name": "leftItem", "parent": "leftArm", "pivot": [6, 15, 1]} + {"name": "rightItem", "parent": "rightArm", "pivot": [-1, -45, -5]}, + {"name": "leftItem", "parent": "leftArm", "pivot": [1, -45, -5]} ], "visible_bounds_width": 2.5, "visible_bounds_height": 2.5, @@ -1652,6 +1652,534 @@ }, "render_controllers": ["controller.render.minecart"] }, + "husk": { + "identifier": "minecraft:husk", + "min_engine_version": "1.8.0", + "materials": {"default": "husk"}, + "textures": {"default": "textures/entity/zombie/husk"}, + "geometry": { + "default": { + "visible_bounds_width": 1.5, + "visible_bounds_height": 2.5, + "visible_bounds_offset": [0, 1.25, 0], + "texturewidth": 64, + "textureheight": 32, + "bones": [ + { + "name": "body", + "pivot": [0, 24, 0], + "cubes": [ + {"origin": [-4, 12, -2], "size": [8, 12, 4], "uv": [16, 16]} + ], + "parent": "waist" + }, + {"name": "waist", "neverRender": true, "pivot": [0, 12, 0]}, + { + "name": "head", + "pivot": [0, 24, 0], + "cubes": [ + {"origin": [-4, 24, -4], "size": [8, 8, 8], "uv": [0, 0]} + ], + "parent": "body" + }, + { + "name": "hat", + "pivot": [0, 24, 0], + "cubes": [ + { + "origin": [-4, 24, -4], + "size": [8, 8, 8], + "uv": [32, 0], + "inflate": 0.5 + } + ], + "neverRender": true, + "parent": "head" + }, + { + "name": "rightArm", + "pivot": [-5, 22, 0], + "cubes": [ + {"origin": [-8, 12, -2], "size": [4, 12, 4], "uv": [40, 16]} + ], + "parent": "body" + }, + { + "name": "rightItem", + "pivot": [-1, -45, -5], + "neverRender": true, + "parent": "rightArm" + }, + { + "name": "leftArm", + "pivot": [5, 22, 0], + "cubes": [ + {"origin": [4, 12, -2], "size": [4, 12, 4], "uv": [40, 16]} + ], + "mirror": true, + "parent": "body" + }, + { + "name": "leftItem", + "pivot": [1, -45, -5], + "neverRender": true, + "parent": "leftArm" + }, + { + "name": "rightLeg", + "pivot": [-1.9, 12, 0], + "cubes": [ + {"origin": [-3.9, 0, -2], "size": [4, 12, 4], "uv": [0, 16]} + ], + "parent": "body" + }, + { + "name": "leftLeg", + "pivot": [1.9, 12, 0], + "cubes": [ + {"origin": [-0.1, 0, -2], "size": [4, 12, 4], "uv": [0, 16]} + ], + "mirror": true, + "parent": "body" + } + ] + } + }, + "scripts": { + "pre_animation": [ + "variable.tcos0 = (Math.cos(query.modified_distance_moved * 38.17) * query.modified_move_speed / variable.gliding_speed_value) * 57.3;" + ] + }, + "animations": { + "humanoid_big_head": {"loop": true, "bones": {"head": {"scale": 1.4}}}, + "look_at_target_default": { + "loop": true, + "bones": { + "head": { + "relative_to": {"rotation": "entity"}, + "rotation": [ + "query.target_x_rotation", + "query.target_y_rotation", + 0 + ] + } + } + }, + "look_at_target_gliding": { + "loop": true, + "bones": {"head": {"rotation": [-45, "query.target_y_rotation", 0]}} + }, + "look_at_target_swimming": { + "loop": true, + "bones": { + "head": { + "rotation": [ + "math.lerp(query.target_x_rotation, -45.0, variable.swim_amount)", + "query.target_y_rotation", + 0 + ] + } + } + }, + "move": { + "loop": true, + "bones": { + "leftarm": {"rotation": ["variable.tcos0", 0, 0]}, + "leftleg": {"rotation": ["variable.tcos0 * -1.4", 0, 0]}, + "rightarm": {"rotation": ["-variable.tcos0", 0, 0]}, + "rightleg": {"rotation": ["variable.tcos0 * 1.4", 0, 0]} + } + }, + "riding.arms": { + "loop": true, + "bones": { + "leftarm": {"rotation": [-36, 0, 0]}, + "rightarm": {"rotation": [-36, 0, 0]} + } + }, + "riding.legs": { + "loop": true, + "bones": { + "leftleg": {"rotation": ["-72.0 - this", "-18.0 - this", "-this"]}, + "rightleg": {"rotation": ["-72.0 - this", "18.0 - this", "-this"]} + } + }, + "holding": { + "loop": true, + "bones": { + "leftarm": { + "rotation": [ + "variable.is_holding_left ? (-this * 0.5 - 18.0) : 0.0", + 0, + 0 + ] + }, + "rightarm": { + "rotation": [ + "variable.is_holding_right ? (-this * 0.5 - 18.0) : 0.0", + 0, + 0 + ] + } + } + }, + "brandish_spear": { + "loop": true, + "bones": { + "rightarm": { + "rotation": [ + "this * -0.5 - 157.5 - 22.5 * variable.charge_amount", + "-this", + 0 + ] + } + } + }, + "charging": { + "loop": true, + "bones": { + "rightarm": { + "rotation": ["22.5 * variable.charge_amount - this", "-this", 0] + } + } + }, + "attack.rotations": { + "loop": true, + "bones": { + "body": { + "rotation": [ + 0, + "math.sin(math.sqrt(variable.attack_time) * 360) * 11.46 - this", + 0 + ] + }, + "leftarm": { + "rotation": [ + "math.sin(math.sqrt(variable.attack_time) * 360) * 11.46", + 0, + 0 + ] + }, + "rightarm": { + "rotation": [ + "math.sin(1.0 - math.pow(1.0 - variable.attack_time, 3.0) * 180.0) * (variable.is_brandishing_spear ? -1.0 : 1.0 )", + "variable.is_brandishing_spear ? 0.0 : (math.sin(math.sqrt(variable.attack_time) * 360) * 11.46) * 2.0", + 0 + ] + } + } + }, + "sneaking": { + "loop": true, + "bones": { + "body": {"rotation": ["0.5 - this", 0, 0]}, + "head": {"position": [0, 1, 0]}, + "leftarm": {"rotation": [72, 0, 0]}, + "leftleg": {"position": [0, -3, 4]}, + "rightarm": {"rotation": [72, 0, 0]}, + "rightleg": {"position": [0, -3, 4]} + } + }, + "bob": { + "loop": true, + "bones": { + "leftarm": { + "rotation": [ + 0, + 0, + "((math.cos(query.life_time * 103.2) * 2.865) + 2.865) *-1.0" + ] + }, + "rightarm": { + "rotation": [ + 0, + 0, + "(math.cos(query.life_time * 103.2) * 2.865) + 2.865" + ] + } + } + }, + "damage_nearby_mobs": { + "loop": true, + "bones": { + "leftarm": {"rotation": ["-45.0-this", "-this", "-this"]}, + "leftleg": {"rotation": ["45.0-this", "-this", "-this"]}, + "rightarm": {"rotation": ["45.0-this", "-this", "-this"]}, + "rightleg": {"rotation": ["-45.0-this", "-this", "-this"]} + } + }, + "bow_and_arrow": { + "loop": true, + "bones": { + "leftarm": { + "rotation": [ + "query.target_x_rotation - 90.0 - math.sin(query.life_time * 76.8) * 2.865 - this", + "query.target_y_rotation + 28.65", + "-(math.cos(query.life_time * 103.2) * 2.865) - 2.865" + ] + }, + "rightarm": { + "rotation": [ + "query.target_x_rotation - 90.0 + math.sin(query.life_time * 76.8) * 2.865 - this", + "query.target_y_rotation - 5.73", + "(math.cos(query.life_time * 103.2) * 2.865) + 2.865" + ] + } + } + }, + "use_item_progress": { + "loop": true, + "bones": { + "rightarm": { + "rotation": [ + "variable.use_item_startup_progress * -60.0 + variable.use_item_interval_progress * 11.25", + "variable.use_item_startup_progress * -22.5 + variable.use_item_interval_progress * 11.25", + "variable.use_item_startup_progress * -5.625 + variable.use_item_interval_progress * 11.25" + ] + } + } + }, + "zombie_attack_bare_hand": { + "loop": true, + "bones": { + "leftarm": { + "rotation": [ + "-90.0 - ((math.sin(variable.attack_time * 180.0) * 57.3) * 1.2 - (math.sin((1.0 - (1.0 - variable.attack_time) * (1.0 - variable.attack_time)) * 180.0) * 57.3) * 0.4) - (math.sin(query.life_time * 76.776372) * 2.865) - this", + "5.73 - ((math.sin(variable.attack_time * 180.0) * 57.3) * 0.6) - this", + "math.cos(query.life_time * 103.13244) * -2.865 - 2.865 - this" + ] + }, + "rightarm": { + "rotation": [ + "90.0 * (variable.is_brandishing_spear - 1.0) - ((math.sin(variable.attack_time * 180.0) * 57.3) * 1.2 - (math.sin((1.0 - (1.0 - variable.attack_time) * (1.0 - variable.attack_time)) * 180.0) * 57.3) * 0.4) + (math.sin(query.life_time * 76.776372) * 2.865) - this", + "(math.sin(variable.attack_time * 180.0) * 57.3) * 0.6 - 5.73 - this", + "math.cos(query.life_time * 103.13244) * 2.865 + 2.865 - this" + ] + } + } + }, + "swimming": { + "loop": true, + "bones": { + "body": { + "position": [ + 0, + "variable.swim_amount * -10.0 - this", + "variable.swim_amount * 9.0 - this" + ], + "rotation": [ + "variable.swim_amount * (90.0 + query.target_x_rotation)", + 0, + 0 + ] + }, + "leftarm": { + "rotation": [ + "math.lerp(this, -180.0, variable.swim_amount) - (variable.swim_amount * ((math.sin(variable.attack_time * 180.0) * 57.3) * 1.2 - (math.sin((1.0 - (1.0 - variable.attack_time) * (1.0 - variable.attack_time)) * 180.0) * 57.3) * 0.4)) - (variable.swim_amount * (math.sin(query.life_time * 76.776372) * 2.865)) - this", + "math.lerp(this, 14.325, variable.swim_amount) - this", + "math.lerp(this, 14.325, variable.swim_amount) - (variable.swim_amount * (math.cos(query.life_time * 103.13244) * 2.865 + 2.865)) - this" + ] + }, + "leftleg": { + "rotation": [ + "math.lerp(this, math.cos(query.life_time * 390.0 + 180.0) * 0.3, variable.swim_amount)", + 0, + 0 + ] + }, + "rightarm": { + "rotation": [ + "math.lerp(this, -180.0, variable.swim_amount) - (variable.swim_amount * ((math.sin(variable.attack_time * 180.0) * 57.3) * 1.2 - (math.sin((1.0 - (1.0 - variable.attack_time) * (1.0 - variable.attack_time)) * 180.0) * 57.3) * 0.4)) + (variable.swim_amount * (math.sin(query.life_time * 76.776372) * 2.865)) - this", + "math.lerp(this, 14.325, variable.swim_amount) - this", + "math.lerp(this, -14.325, variable.swim_amount) + (variable.swim_amount * (math.cos(query.life_time * 103.13244) * 2.865 + 2.865)) - this" + ] + }, + "rightleg": { + "rotation": [ + "math.lerp(this, math.cos(query.life_time * 390.0) * 0.3, variable.swim_amount)", + 0, + 0 + ] + } + } + } + }, + "animation_controllers": { + "humanoid_baby_big_head": { + "initial_state": "default", + "states": { + "baby": { + "animations": ["humanoid_big_head"], + "transitions": [{"default": "!query.is_baby"}] + }, + "default": {"transitions": [{"baby": "query.is_baby"}]} + } + }, + "look_at_target": { + "initial_state": "default", + "states": { + "default": { + "animations": ["look_at_target_default"], + "transitions": [ + {"gliding": "query.is_gliding"}, + {"swimming": "query.is_swimming"} + ] + }, + "gliding": { + "animations": ["look_at_target_gliding"], + "transitions": [ + {"swimming": "query.is_swimming"}, + {"default": "!query.is_gliding"} + ] + }, + "swimming": { + "animations": ["look_at_target_swimming"], + "transitions": [ + {"gliding": "query.is_gliding"}, + {"default": "!query.is_swimming"} + ] + } + } + }, + "move": { + "initial_state": "default", + "states": {"default": {"animations": ["move"]}} + }, + "riding": { + "initial_state": "default", + "states": { + "default": {"transitions": [{"riding": "query.is_riding"}]}, + "riding": { + "animations": ["riding.arms", "riding.legs"], + "transitions": [{"default": "!query.is_riding"}] + } + } + }, + "holding": { + "initial_state": "default", + "states": {"default": {"animations": ["holding"]}} + }, + "brandish_spear": { + "initial_state": "default", + "states": { + "brandish_spear": { + "animations": ["brandish_spear"], + "transitions": [{"default": "!variable.is_brandishing_spear"}] + }, + "default": { + "transitions": [{"brandish_spear": "variable.is_brandishing_spear"}] + } + } + }, + "charging": { + "initial_state": "default", + "states": { + "charging": { + "animations": ["charging"], + "transitions": [{"default": "!query.is_charging"}] + }, + "default": {"transitions": [{"charging": "query.is_charging"}]} + } + }, + "attack": { + "initial_state": "default", + "states": { + "attacking": { + "animations": ["attack.rotations"], + "transitions": [{"default": "variable.attack_time < 0.0"}] + }, + "default": { + "transitions": [{"attacking": "variable.attack_time >= 0.0"}] + } + } + }, + "sneaking": { + "initial_state": "default", + "states": { + "default": {"transitions": [{"sneaking": "query.is_sneaking"}]}, + "sneaking": { + "animations": ["sneaking"], + "transitions": [{"default": "!query.is_sneaking"}] + } + } + }, + "bob": { + "initial_state": "default", + "states": {"default": {"animations": ["bob"]}} + }, + "damage_nearby_mobs": { + "initial_state": "default", + "states": { + "damage_nearby_mobs": { + "animations": ["damage_nearby_mobs"], + "transitions": [{"default": "!variable.damage_nearby_mobs"}] + }, + "default": { + "transitions": [ + {"damage_nearby_mobs": "variable.damage_nearby_mobs"} + ] + } + } + }, + "bow_and_arrow": { + "initial_state": "default", + "states": { + "bow_and_arrow": { + "animations": ["bow_and_arrow"], + "transitions": [{"default": "!query.has_target"}] + }, + "default": {"transitions": [{"bow_and_arrow": "query.has_target"}]} + } + }, + "use_item_progress": { + "initial_state": "default", + "states": { + "default": { + "transitions": [ + { + "use_item_progress": "( variable.use_item_interval_progress > 0.0 ) || ( variable.use_item_startup_progress > 0.0 )" + } + ] + }, + "use_item_progress": { + "animations": ["use_item_progress"], + "transitions": [ + { + "default": "( variable.use_item_interval_progress <= 0.0 ) && ( variable.use_item_startup_progress <= 0.0 )" + } + ] + } + } + }, + "zombie_attack_bare_hand": { + "initial_state": "default", + "states": { + "default": { + "transitions": [{"is_bare_hand": "variable.is_holding_left != 1.0"}] + }, + "is_bare_hand": { + "animations": ["zombie_attack_bare_hand"], + "transitions": [{"default": "variable.is_holding_left == 1.0"}] + } + } + }, + "swimming": { + "initial_state": "default", + "states": { + "default": { + "transitions": [{"is_swimming": "variable.swim_amount > 0.0"}] + }, + "is_swimming": { + "animations": ["swimming"], + "transitions": [{"default": "variable.swim_amount <= 0.0"}] + } + } + } + }, + "render_controllers": ["controller.render.husk"], + "enable_attachables": true, + "spawn_egg": {"texture": "spawn_egg", "texture_index": 28} + }, "iron_golem": { "identifier": "minecraft:iron_golem", "materials": {"default": "iron_golem"}, @@ -2262,7 +2790,7 @@ } ] }, - {"name": "rightItem", "parent": "rightarm", "pivot": [-6, 15, 1]}, + {"name": "rightItem", "parent": "rightarm", "pivot": [-1, -45, -5]}, { "name": "leftarm", "parent": "body", @@ -2277,7 +2805,7 @@ } ] }, - {"name": "leftItem", "parent": "leftArm", "pivot": [6, 15, 1]}, + {"name": "leftItem", "parent": "leftArm", "pivot": [1, -45, -5]}, { "name": "rightleg", "parent": "body", @@ -3187,7 +3715,7 @@ }, { "name": "rightItem", - "pivot": [-6, 15, 1], + "pivot": [-1, -45, -5], "neverRender": true, "parent": "rightArm" }, @@ -3202,7 +3730,7 @@ }, { "name": "leftItem", - "pivot": [6, 15, 1], + "pivot": [1, -45, -5], "neverRender": true, "parent": "leftArm" }, @@ -4012,7 +4540,7 @@ }, { "name": "rightItem", - "pivot": [-6, 15, 1], + "pivot": [-1, -45, -5], "neverRender": true, "parent": "rightArm" }, @@ -4027,7 +4555,7 @@ }, { "name": "leftItem", - "pivot": [6, 15, 1], + "pivot": [1, -45, -5], "neverRender": true, "parent": "leftArm" }, @@ -4894,7 +5422,7 @@ { "name": "rightItem", "parent": "rightArm", - "pivot": [-5, 15, 1], + "pivot": [-1, -45, -5], "neverRender": true }, { @@ -4909,7 +5437,7 @@ { "name": "leftItem", "parent": "leftArm", - "pivot": [6, 15, 1], + "pivot": [1, -45, -5], "neverRender": true }, { @@ -5046,6 +5574,534 @@ "spawn_egg": {"base_color": "#c66e55", "overlay_color": "#e6e6e6"}, "render_controllers": ["controller.render.zoglin"] }, + "zombie": { + "identifier": "minecraft:zombie", + "min_engine_version": "1.8.0", + "materials": {"default": "zombie"}, + "textures": {"default": "textures/entity/zombie/zombie"}, + "geometry": { + "default": { + "visible_bounds_width": 2, + "visible_bounds_height": 2, + "visible_bounds_offset": [0, 1, 0], + "texturewidth": 64, + "textureheight": 32, + "bones": [ + { + "name": "body", + "pivot": [0, 24, 0], + "cubes": [ + {"origin": [-4, 12, -2], "size": [8, 12, 4], "uv": [16, 16]} + ], + "parent": "waist" + }, + {"name": "waist", "neverRender": true, "pivot": [0, 12, 0]}, + { + "name": "head", + "pivot": [0, 24, 0], + "cubes": [ + {"origin": [-4, 24, -4], "size": [8, 8, 8], "uv": [0, 0]} + ], + "parent": "body" + }, + { + "name": "hat", + "pivot": [0, 24, 0], + "cubes": [ + { + "origin": [-4, 24, -4], + "size": [8, 8, 8], + "uv": [32, 0], + "inflate": 0.5 + } + ], + "neverRender": true, + "parent": "head" + }, + { + "name": "rightArm", + "pivot": [-5, 22, 0], + "cubes": [ + {"origin": [-8, 12, -2], "size": [4, 12, 4], "uv": [40, 16]} + ], + "parent": "body" + }, + { + "name": "rightItem", + "pivot": [-1, -45, -5], + "neverRender": true, + "parent": "rightArm" + }, + { + "name": "leftArm", + "pivot": [5, 22, 0], + "cubes": [ + {"origin": [4, 12, -2], "size": [4, 12, 4], "uv": [40, 16]} + ], + "mirror": true, + "parent": "body" + }, + { + "name": "leftItem", + "pivot": [1, -45, -5], + "neverRender": true, + "parent": "leftArm" + }, + { + "name": "rightLeg", + "pivot": [-1.9, 12, 0], + "cubes": [ + {"origin": [-3.9, 0, -2], "size": [4, 12, 4], "uv": [0, 16]} + ], + "parent": "body" + }, + { + "name": "leftLeg", + "pivot": [1.9, 12, 0], + "cubes": [ + {"origin": [-0.1, 0, -2], "size": [4, 12, 4], "uv": [0, 16]} + ], + "mirror": true, + "parent": "body" + } + ] + } + }, + "spawn_egg": {"texture": "spawn_egg", "texture_index": 12}, + "scripts": { + "pre_animation": [ + "variable.tcos0 = (Math.cos(query.modified_distance_moved * 38.17) * query.modified_move_speed / variable.gliding_speed_value) * 57.3;" + ] + }, + "animations": { + "humanoid_big_head": {"loop": true, "bones": {"head": {"scale": 1.4}}}, + "look_at_target_default": { + "loop": true, + "bones": { + "head": { + "relative_to": {"rotation": "entity"}, + "rotation": [ + "query.target_x_rotation", + "query.target_y_rotation", + 0 + ] + } + } + }, + "look_at_target_gliding": { + "loop": true, + "bones": {"head": {"rotation": [-45, "query.target_y_rotation", 0]}} + }, + "look_at_target_swimming": { + "loop": true, + "bones": { + "head": { + "rotation": [ + "math.lerp(query.target_x_rotation, -45.0, variable.swim_amount)", + "query.target_y_rotation", + 0 + ] + } + } + }, + "move": { + "loop": true, + "bones": { + "leftarm": {"rotation": ["variable.tcos0", 0, 0]}, + "leftleg": {"rotation": ["variable.tcos0 * -1.4", 0, 0]}, + "rightarm": {"rotation": ["-variable.tcos0", 0, 0]}, + "rightleg": {"rotation": ["variable.tcos0 * 1.4", 0, 0]} + } + }, + "riding.arms": { + "loop": true, + "bones": { + "leftarm": {"rotation": [-36, 0, 0]}, + "rightarm": {"rotation": [-36, 0, 0]} + } + }, + "riding.legs": { + "loop": true, + "bones": { + "leftleg": {"rotation": ["-72.0 - this", "-18.0 - this", "-this"]}, + "rightleg": {"rotation": ["-72.0 - this", "18.0 - this", "-this"]} + } + }, + "holding": { + "loop": true, + "bones": { + "leftarm": { + "rotation": [ + "variable.is_holding_left ? (-this * 0.5 - 18.0) : 0.0", + 0, + 0 + ] + }, + "rightarm": { + "rotation": [ + "variable.is_holding_right ? (-this * 0.5 - 18.0) : 0.0", + 0, + 0 + ] + } + } + }, + "brandish_spear": { + "loop": true, + "bones": { + "rightarm": { + "rotation": [ + "this * -0.5 - 157.5 - 22.5 * variable.charge_amount", + "-this", + 0 + ] + } + } + }, + "charging": { + "loop": true, + "bones": { + "rightarm": { + "rotation": ["22.5 * variable.charge_amount - this", "-this", 0] + } + } + }, + "attack.rotations": { + "loop": true, + "bones": { + "body": { + "rotation": [ + 0, + "math.sin(math.sqrt(variable.attack_time) * 360) * 11.46 - this", + 0 + ] + }, + "leftarm": { + "rotation": [ + "math.sin(math.sqrt(variable.attack_time) * 360) * 11.46", + 0, + 0 + ] + }, + "rightarm": { + "rotation": [ + "math.sin(1.0 - math.pow(1.0 - variable.attack_time, 3.0) * 180.0) * (variable.is_brandishing_spear ? -1.0 : 1.0 )", + "variable.is_brandishing_spear ? 0.0 : (math.sin(math.sqrt(variable.attack_time) * 360) * 11.46) * 2.0", + 0 + ] + } + } + }, + "sneaking": { + "loop": true, + "bones": { + "body": {"rotation": ["0.5 - this", 0, 0]}, + "head": {"position": [0, 1, 0]}, + "leftarm": {"rotation": [72, 0, 0]}, + "leftleg": {"position": [0, -3, 4]}, + "rightarm": {"rotation": [72, 0, 0]}, + "rightleg": {"position": [0, -3, 4]} + } + }, + "bob": { + "loop": true, + "bones": { + "leftarm": { + "rotation": [ + 0, + 0, + "((math.cos(query.life_time * 103.2) * 2.865) + 2.865) *-1.0" + ] + }, + "rightarm": { + "rotation": [ + 0, + 0, + "(math.cos(query.life_time * 103.2) * 2.865) + 2.865" + ] + } + } + }, + "damage_nearby_mobs": { + "loop": true, + "bones": { + "leftarm": {"rotation": ["-45.0-this", "-this", "-this"]}, + "leftleg": {"rotation": ["45.0-this", "-this", "-this"]}, + "rightarm": {"rotation": ["45.0-this", "-this", "-this"]}, + "rightleg": {"rotation": ["-45.0-this", "-this", "-this"]} + } + }, + "bow_and_arrow": { + "loop": true, + "bones": { + "leftarm": { + "rotation": [ + "query.target_x_rotation - 90.0 - math.sin(query.life_time * 76.8) * 2.865 - this", + "query.target_y_rotation + 28.65", + "-(math.cos(query.life_time * 103.2) * 2.865) - 2.865" + ] + }, + "rightarm": { + "rotation": [ + "query.target_x_rotation - 90.0 + math.sin(query.life_time * 76.8) * 2.865 - this", + "query.target_y_rotation - 5.73", + "(math.cos(query.life_time * 103.2) * 2.865) + 2.865" + ] + } + } + }, + "use_item_progress": { + "loop": true, + "bones": { + "rightarm": { + "rotation": [ + "variable.use_item_startup_progress * -60.0 + variable.use_item_interval_progress * 11.25", + "variable.use_item_startup_progress * -22.5 + variable.use_item_interval_progress * 11.25", + "variable.use_item_startup_progress * -5.625 + variable.use_item_interval_progress * 11.25" + ] + } + } + }, + "zombie_attack_bare_hand": { + "loop": true, + "bones": { + "leftarm": { + "rotation": [ + "-90.0 - ((math.sin(variable.attack_time * 180.0) * 57.3) * 1.2 - (math.sin((1.0 - (1.0 - variable.attack_time) * (1.0 - variable.attack_time)) * 180.0) * 57.3) * 0.4) - (math.sin(query.life_time * 76.776372) * 2.865) - this", + "5.73 - ((math.sin(variable.attack_time * 180.0) * 57.3) * 0.6) - this", + "math.cos(query.life_time * 103.13244) * -2.865 - 2.865 - this" + ] + }, + "rightarm": { + "rotation": [ + "90.0 * (variable.is_brandishing_spear - 1.0) - ((math.sin(variable.attack_time * 180.0) * 57.3) * 1.2 - (math.sin((1.0 - (1.0 - variable.attack_time) * (1.0 - variable.attack_time)) * 180.0) * 57.3) * 0.4) + (math.sin(query.life_time * 76.776372) * 2.865) - this", + "(math.sin(variable.attack_time * 180.0) * 57.3) * 0.6 - 5.73 - this", + "math.cos(query.life_time * 103.13244) * 2.865 + 2.865 - this" + ] + } + } + }, + "swimming": { + "loop": true, + "bones": { + "body": { + "position": [ + 0, + "variable.swim_amount * -10.0 - this", + "variable.swim_amount * 9.0 - this" + ], + "rotation": [ + "variable.swim_amount * (90.0 + query.target_x_rotation)", + 0, + 0 + ] + }, + "leftarm": { + "rotation": [ + "math.lerp(this, -180.0, variable.swim_amount) - (variable.swim_amount * ((math.sin(variable.attack_time * 180.0) * 57.3) * 1.2 - (math.sin((1.0 - (1.0 - variable.attack_time) * (1.0 - variable.attack_time)) * 180.0) * 57.3) * 0.4)) - (variable.swim_amount * (math.sin(query.life_time * 76.776372) * 2.865)) - this", + "math.lerp(this, 14.325, variable.swim_amount) - this", + "math.lerp(this, 14.325, variable.swim_amount) - (variable.swim_amount * (math.cos(query.life_time * 103.13244) * 2.865 + 2.865)) - this" + ] + }, + "leftleg": { + "rotation": [ + "math.lerp(this, math.cos(query.life_time * 390.0 + 180.0) * 0.3, variable.swim_amount)", + 0, + 0 + ] + }, + "rightarm": { + "rotation": [ + "math.lerp(this, -180.0, variable.swim_amount) - (variable.swim_amount * ((math.sin(variable.attack_time * 180.0) * 57.3) * 1.2 - (math.sin((1.0 - (1.0 - variable.attack_time) * (1.0 - variable.attack_time)) * 180.0) * 57.3) * 0.4)) + (variable.swim_amount * (math.sin(query.life_time * 76.776372) * 2.865)) - this", + "math.lerp(this, 14.325, variable.swim_amount) - this", + "math.lerp(this, -14.325, variable.swim_amount) + (variable.swim_amount * (math.cos(query.life_time * 103.13244) * 2.865 + 2.865)) - this" + ] + }, + "rightleg": { + "rotation": [ + "math.lerp(this, math.cos(query.life_time * 390.0) * 0.3, variable.swim_amount)", + 0, + 0 + ] + } + } + } + }, + "animation_controllers": { + "humanoid_baby_big_head": { + "initial_state": "default", + "states": { + "baby": { + "animations": ["humanoid_big_head"], + "transitions": [{"default": "!query.is_baby"}] + }, + "default": {"transitions": [{"baby": "query.is_baby"}]} + } + }, + "look_at_target": { + "initial_state": "default", + "states": { + "default": { + "animations": ["look_at_target_default"], + "transitions": [ + {"gliding": "query.is_gliding"}, + {"swimming": "query.is_swimming"} + ] + }, + "gliding": { + "animations": ["look_at_target_gliding"], + "transitions": [ + {"swimming": "query.is_swimming"}, + {"default": "!query.is_gliding"} + ] + }, + "swimming": { + "animations": ["look_at_target_swimming"], + "transitions": [ + {"gliding": "query.is_gliding"}, + {"default": "!query.is_swimming"} + ] + } + } + }, + "move": { + "initial_state": "default", + "states": {"default": {"animations": ["move"]}} + }, + "riding": { + "initial_state": "default", + "states": { + "default": {"transitions": [{"riding": "query.is_riding"}]}, + "riding": { + "animations": ["riding.arms", "riding.legs"], + "transitions": [{"default": "!query.is_riding"}] + } + } + }, + "holding": { + "initial_state": "default", + "states": {"default": {"animations": ["holding"]}} + }, + "brandish_spear": { + "initial_state": "default", + "states": { + "brandish_spear": { + "animations": ["brandish_spear"], + "transitions": [{"default": "!variable.is_brandishing_spear"}] + }, + "default": { + "transitions": [{"brandish_spear": "variable.is_brandishing_spear"}] + } + } + }, + "charging": { + "initial_state": "default", + "states": { + "charging": { + "animations": ["charging"], + "transitions": [{"default": "!query.is_charging"}] + }, + "default": {"transitions": [{"charging": "query.is_charging"}]} + } + }, + "attack": { + "initial_state": "default", + "states": { + "attacking": { + "animations": ["attack.rotations"], + "transitions": [{"default": "variable.attack_time < 0.0"}] + }, + "default": { + "transitions": [{"attacking": "variable.attack_time >= 0.0"}] + } + } + }, + "sneaking": { + "initial_state": "default", + "states": { + "default": {"transitions": [{"sneaking": "query.is_sneaking"}]}, + "sneaking": { + "animations": ["sneaking"], + "transitions": [{"default": "!query.is_sneaking"}] + } + } + }, + "bob": { + "initial_state": "default", + "states": {"default": {"animations": ["bob"]}} + }, + "damage_nearby_mobs": { + "initial_state": "default", + "states": { + "damage_nearby_mobs": { + "animations": ["damage_nearby_mobs"], + "transitions": [{"default": "!variable.damage_nearby_mobs"}] + }, + "default": { + "transitions": [ + {"damage_nearby_mobs": "variable.damage_nearby_mobs"} + ] + } + } + }, + "bow_and_arrow": { + "initial_state": "default", + "states": { + "bow_and_arrow": { + "animations": ["bow_and_arrow"], + "transitions": [{"default": "!query.has_target"}] + }, + "default": {"transitions": [{"bow_and_arrow": "query.has_target"}]} + } + }, + "use_item_progress": { + "initial_state": "default", + "states": { + "default": { + "transitions": [ + { + "use_item_progress": "( variable.use_item_interval_progress > 0.0 ) || ( variable.use_item_startup_progress > 0.0 )" + } + ] + }, + "use_item_progress": { + "animations": ["use_item_progress"], + "transitions": [ + { + "default": "( variable.use_item_interval_progress <= 0.0 ) && ( variable.use_item_startup_progress <= 0.0 )" + } + ] + } + } + }, + "zombie_attack_bare_hand": { + "initial_state": "default", + "states": { + "default": { + "transitions": [{"is_bare_hand": "variable.is_holding_left != 1.0"}] + }, + "is_bare_hand": { + "animations": ["zombie_attack_bare_hand"], + "transitions": [{"default": "variable.is_holding_left == 1.0"}] + } + } + }, + "swimming": { + "initial_state": "default", + "states": { + "default": { + "transitions": [{"is_swimming": "variable.swim_amount > 0.0"}] + }, + "is_swimming": { + "animations": ["swimming"], + "transitions": [{"default": "variable.swim_amount <= 0.0"}] + } + } + } + }, + "render_controllers": ["controller.render.zombie"], + "enable_attachables": true + }, "zombified_piglin": { "identifier": "minecraft:zombie_pigman", "min_engine_version": "1.8.0", @@ -5115,7 +6171,7 @@ } ] }, - {"name": "rightItem", "parent": "rightarm", "pivot": [-6, 15, 1]}, + {"name": "rightItem", "parent": "rightarm", "pivot": [-1, -45, -5]}, { "name": "leftarm", "parent": "body", @@ -5130,7 +6186,7 @@ } ] }, - {"name": "leftItem", "parent": "leftArm", "pivot": [6, 15, 1]}, + {"name": "leftItem", "parent": "leftArm", "pivot": [1, -45, -5]}, { "name": "rightleg", "parent": "body", diff --git a/renderer/viewer/lib/entity/exportedModels.js b/renderer/viewer/lib/entity/exportedModels.js index 60ac6723..fde9391f 100644 --- a/renderer/viewer/lib/entity/exportedModels.js +++ b/renderer/viewer/lib/entity/exportedModels.js @@ -35,6 +35,4 @@ export { default as warden } from './models/warden.obj' export { default as witch } from './models/witch.obj' export { default as wolf } from './models/wolf.obj' export { default as zombie_villager } from './models/zombie_villager.obj' -export { default as zombie } from './models/zombie.obj' -export { default as husk } from './models/zombie.obj' export { default as boat } from './models/boat.obj' diff --git a/renderer/viewer/lib/entity/models/zombie.obj b/renderer/viewer/lib/entity/models/zombie.obj deleted file mode 100644 index fa5d8f4d..00000000 --- a/renderer/viewer/lib/entity/models/zombie.obj +++ /dev/null @@ -1,325 +0,0 @@ -# Made in Blockbench 4.10.4 -mtllib materials.mtl - -o /head -v 0.125 0.5 0.125 -v 0.125 0.5 -0.125 -v 0.125 0.25 0.125 -v 0.125 0.25 -0.125 -v -0.125 0.5 -0.125 -v -0.125 0.5 0.125 -v -0.125 0.25 -0.125 -v -0.125 0.25 0.125 -vt 0.125 0.875 -vt 0.25 0.875 -vt 0.25 0.75 -vt 0.125 0.75 -vt 0 0.875 -vt 0.125 0.875 -vt 0.125 0.75 -vt 0 0.75 -vt 0.375 0.875 -vt 0.5 0.875 -vt 0.5 0.75 -vt 0.375 0.75 -vt 0.25 0.875 -vt 0.375 0.875 -vt 0.375 0.75 -vt 0.25 0.75 -vt 0.25 0.875 -vt 0.125 0.875 -vt 0.125 1 -vt 0.25 1 -vt 0.25 1 -vt 0.375 1 -vt 0.375 0.875 -vt 0.25 0.875 -vn 0 0 -1 -vn 1 0 0 -vn 0 0 1 -vn -1 0 0 -vn 0 1 0 -vn 0 -1 0 -usemtl none -f 4/4/1 7/3/1 5/2/1 2/1/1 -f 3/8/2 4/7/2 2/6/2 1/5/2 -f 8/12/3 3/11/3 1/10/3 6/9/3 -f 7/16/4 8/15/4 6/14/4 5/13/4 -f 6/20/5 1/19/5 2/18/5 5/17/5 -f 7/24/6 4/23/6 3/22/6 8/21/6 -o /right_arm -v -0.125 0.25 0.0625 -v -0.125 0.25 -0.3125 -v -0.125 0.125 0.0625 -v -0.125 0.125 -0.3125 -v -0.25 0.25 -0.3125 -v -0.25 0.25 0.0625 -v -0.25 0.125 -0.3125 -v -0.25 0.125 0.0625 -vt 0.8125 0.6875 -vt 0.75 0.6875 -vt 0.75 0.75 -vt 0.8125 0.75 -vt 0.6875 0.6875 -vt 0.6875 0.5 -vt 0.625 0.5 -vt 0.625 0.6875 -vt 0.75 0.6875 -vt 0.6875 0.6875 -vt 0.6875 0.75 -vt 0.75 0.75 -vt 0.75 0.5 -vt 0.75 0.6875 -vt 0.8125 0.6875 -vt 0.8125 0.5 -vt 0.75 0.5 -vt 0.6875 0.5 -vt 0.6875 0.6875 -vt 0.75 0.6875 -vt 0.8125 0.6875 -vt 0.875 0.6875 -vt 0.875 0.5 -vt 0.8125 0.5 -vn 0 0 -1 -vn 1 0 0 -vn 0 0 1 -vn -1 0 0 -vn 0 1 0 -vn 0 -1 0 -usemtl none -f 12/28/7 15/27/7 13/26/7 10/25/7 -f 11/32/8 12/31/8 10/30/8 9/29/8 -f 16/36/9 11/35/9 9/34/9 14/33/9 -f 15/40/10 16/39/10 14/38/10 13/37/10 -f 14/44/11 9/43/11 10/42/11 13/41/11 -f 15/48/12 12/47/12 11/46/12 16/45/12 -o /left_leg -v 0.12187499999999996 -0.125 0.0625 -v 0.12187499999999996 -0.125 -0.0625 -v 0.12187499999999996 -0.5 0.0625 -v 0.12187499999999996 -0.5 -0.0625 -v -0.0031250000000000444 -0.125 -0.0625 -v -0.0031250000000000444 -0.125 0.0625 -v -0.0031250000000000444 -0.5 -0.0625 -v -0.0031250000000000444 -0.5 0.0625 -vt 0.0625 0.6875 -vt 0.125 0.6875 -vt 0.125 0.5 -vt 0.0625 0.5 -vt 0 0.6875 -vt 0.0625 0.6875 -vt 0.0625 0.5 -vt 0 0.5 -vt 0.1875 0.6875 -vt 0.25 0.6875 -vt 0.25 0.5 -vt 0.1875 0.5 -vt 0.125 0.6875 -vt 0.1875 0.6875 -vt 0.1875 0.5 -vt 0.125 0.5 -vt 0.125 0.6875 -vt 0.0625 0.6875 -vt 0.0625 0.75 -vt 0.125 0.75 -vt 0.125 0.75 -vt 0.1875 0.75 -vt 0.1875 0.6875 -vt 0.125 0.6875 -vn 0 0 -1 -vn 1 0 0 -vn 0 0 1 -vn -1 0 0 -vn 0 1 0 -vn 0 -1 0 -usemtl none -f 20/52/13 23/51/13 21/50/13 18/49/13 -f 19/56/14 20/55/14 18/54/14 17/53/14 -f 24/60/15 19/59/15 17/58/15 22/57/15 -f 23/64/16 24/63/16 22/62/16 21/61/16 -f 22/68/17 17/67/17 18/66/17 21/65/17 -f 23/72/18 20/71/18 19/70/18 24/69/18 -o /left_arm -v 0.25 0.25 0.0625 -v 0.25 0.25 -0.3125 -v 0.25 0.125 0.0625 -v 0.25 0.125 -0.3125 -v 0.125 0.25 -0.3125 -v 0.125 0.25 0.0625 -v 0.125 0.125 -0.3125 -v 0.125 0.125 0.0625 -vt 0.8125 0.6875 -vt 0.75 0.6875 -vt 0.75 0.75 -vt 0.8125 0.75 -vt 0.6875 0.6875 -vt 0.6875 0.5 -vt 0.625 0.5 -vt 0.625 0.6875 -vt 0.75 0.6875 -vt 0.6875 0.6875 -vt 0.6875 0.75 -vt 0.75 0.75 -vt 0.75 0.5 -vt 0.75 0.6875 -vt 0.8125 0.6875 -vt 0.8125 0.5 -vt 0.75 0.5 -vt 0.6875 0.5 -vt 0.6875 0.6875 -vt 0.75 0.6875 -vt 0.8125 0.6875 -vt 0.875 0.6875 -vt 0.875 0.5 -vt 0.8125 0.5 -vn 0 0 -1 -vn 1 0 0 -vn 0 0 1 -vn -1 0 0 -vn 0 1 0 -vn 0 -1 0 -usemtl none -f 28/76/19 31/75/19 29/74/19 26/73/19 -f 27/80/20 28/79/20 26/78/20 25/77/20 -f 32/84/21 27/83/21 25/82/21 30/81/21 -f 31/88/22 32/87/22 30/86/22 29/85/22 -f 30/92/23 25/91/23 26/90/23 29/89/23 -f 31/96/24 28/95/24 27/94/24 32/93/24 -o /right_leg -v 0.0031250000000000444 -0.125 0.0625 -v 0.0031250000000000444 -0.125 -0.0625 -v 0.0031250000000000444 -0.5 0.0625 -v 0.0031250000000000444 -0.5 -0.0625 -v -0.12187499999999996 -0.125 -0.0625 -v -0.12187499999999996 -0.125 0.0625 -v -0.12187499999999996 -0.5 -0.0625 -v -0.12187499999999996 -0.5 0.0625 -vt 0.0625 0.6875 -vt 0.125 0.6875 -vt 0.125 0.5 -vt 0.0625 0.5 -vt 0 0.6875 -vt 0.0625 0.6875 -vt 0.0625 0.5 -vt 0 0.5 -vt 0.1875 0.6875 -vt 0.25 0.6875 -vt 0.25 0.5 -vt 0.1875 0.5 -vt 0.125 0.6875 -vt 0.1875 0.6875 -vt 0.1875 0.5 -vt 0.125 0.5 -vt 0.125 0.6875 -vt 0.0625 0.6875 -vt 0.0625 0.75 -vt 0.125 0.75 -vt 0.125 0.75 -vt 0.1875 0.75 -vt 0.1875 0.6875 -vt 0.125 0.6875 -vn 0 0 -1 -vn 1 0 0 -vn 0 0 1 -vn -1 0 0 -vn 0 1 0 -vn 0 -1 0 -usemtl none -f 36/100/25 39/99/25 37/98/25 34/97/25 -f 35/104/26 36/103/26 34/102/26 33/101/26 -f 40/108/27 35/107/27 33/106/27 38/105/27 -f 39/112/28 40/111/28 38/110/28 37/109/28 -f 38/116/29 33/115/29 34/114/29 37/113/29 -f 39/120/30 36/119/30 35/118/30 40/117/30 -o /hat -v 0.140625 0.515625 0.140625 -v 0.140625 0.515625 -0.140625 -v 0.140625 0.234375 0.140625 -v 0.140625 0.234375 -0.140625 -v -0.140625 0.515625 -0.140625 -v -0.140625 0.515625 0.140625 -v -0.140625 0.234375 -0.140625 -v -0.140625 0.234375 0.140625 -vt 0.625 0.875 -vt 0.75 0.875 -vt 0.75 0.75 -vt 0.625 0.75 -vt 0.5 0.875 -vt 0.625 0.875 -vt 0.625 0.75 -vt 0.5 0.75 -vt 0.875 0.875 -vt 1 0.875 -vt 1 0.75 -vt 0.875 0.75 -vt 0.75 0.875 -vt 0.875 0.875 -vt 0.875 0.75 -vt 0.75 0.75 -vt 0.75 0.875 -vt 0.625 0.875 -vt 0.625 1 -vt 0.75 1 -vt 0.75 1 -vt 0.875 1 -vt 0.875 0.875 -vt 0.75 0.875 -vn 0 0 -1 -vn 1 0 0 -vn 0 0 1 -vn -1 0 0 -vn 0 1 0 -vn 0 -1 0 -usemtl none -f 44/124/31 47/123/31 45/122/31 42/121/31 -f 43/128/32 44/127/32 42/126/32 41/125/32 -f 48/132/33 43/131/33 41/130/33 46/129/33 -f 47/136/34 48/135/34 46/134/34 45/133/34 -f 46/140/35 41/139/35 42/138/35 45/137/35 -f 47/144/36 44/143/36 43/142/36 48/141/36 -o /body -v 0.125 0.25 0.0625 -v 0.125 0.25 -0.0625 -v 0.125 -0.125 0.0625 -v 0.125 -0.125 -0.0625 -v -0.125 0.25 -0.0625 -v -0.125 0.25 0.0625 -v -0.125 -0.125 -0.0625 -v -0.125 -0.125 0.0625 -vt 0.3125 0.6875 -vt 0.4375 0.6875 -vt 0.4375 0.5 -vt 0.3125 0.5 -vt 0.25 0.6875 -vt 0.3125 0.6875 -vt 0.3125 0.5 -vt 0.25 0.5 -vt 0.5 0.6875 -vt 0.625 0.6875 -vt 0.625 0.5 -vt 0.5 0.5 -vt 0.4375 0.6875 -vt 0.5 0.6875 -vt 0.5 0.5 -vt 0.4375 0.5 -vt 0.4375 0.6875 -vt 0.3125 0.6875 -vt 0.3125 0.75 -vt 0.4375 0.75 -vt 0.4375 0.75 -vt 0.5625 0.75 -vt 0.5625 0.6875 -vt 0.4375 0.6875 -vn 0 0 -1 -vn 1 0 0 -vn 0 0 1 -vn -1 0 0 -vn 0 1 0 -vn 0 -1 0 -usemtl none -f 52/148/37 55/147/37 53/146/37 50/145/37 -f 51/152/38 52/151/38 50/150/38 49/149/38 -f 56/156/39 51/155/39 49/154/39 54/153/39 -f 55/160/40 56/159/40 54/158/40 53/157/40 -f 54/164/41 49/163/41 50/162/41 53/161/41 -f 55/168/42 52/167/42 51/166/42 56/165/42 diff --git a/src/index.ts b/src/index.ts index b8727395..c1fa5fd5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -176,7 +176,7 @@ Object.defineProperty(window, 'world', { }) // todo unify viewer.entities.getItemUv = (item, specificProps) => { - const idOrName = item.itemId ?? item.blockId + const idOrName = item.itemId ?? item.blockId ?? item.name try { const name = typeof idOrName === 'number' ? loadedData.items[idOrName]?.name : idOrName if (!name) throw new Error(`Item not found: ${idOrName}`)