Skip to content

Commit b712fec

Browse files
committed
I didn't fully clean my mess last time
1 parent 1f51ef5 commit b712fec

2 files changed

Lines changed: 1 addition & 409 deletions

File tree

plugins/geckolib/geckolib.js

Lines changed: 1 addition & 188 deletions
Original file line numberDiff line numberDiff line change
@@ -6993,7 +6993,7 @@ createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$')
69936993
/***/ ((module) => {
69946994

69956995
"use strict";
6996-
module.exports = /*#__PURE__*/JSON.parse('{"name":"geckolib","version":"4.2.5","private":true,"description":"GeckoLib Models & Animations","main":"index.js","scripts":{"prebuild":"npm run test","build":"npm run build:only","build:only":"webpack && npm run update_manifest","update_manifest":"node scripts/updateManifest.mjs","start":"webpack --watch --mode=development","lint":"eslint .","lint:fix":"eslint --fix .","tsc":"tsc --noEmit","pretest":"npm run lint && npm run tsc","test":"npm run test:only","test:only":"jest"},"author":"Eliot Lash, Tslat, Gecko, McHorse, matmat37000","license":"MIT","pluginOptions":{"title":"GeckoLib Models & Animations","description":"Create animated blocks, items, entities, and armor for the GeckoLib java mod library.","icon":"icon.png","tags":["Minecraft: Java Edition"],"variant":"both","min_version":"5.0.0","max_version":"6.0.0","await_loading":true,"has_changelog":true,"website":"https://github.com/bernie-g/geckolib/wiki","repository":"https://github.com/JannisX11/blockbench-plugins/tree/master/plugins/geckolib","bug_tracker":"https://github.com/bernie-g/geckolib/issues"},"sideEffects":["./index.js"],"devDependencies":{"@types/jest":"^30.0.0","@types/lodash":"^4.17.20","@typescript-eslint/eslint-plugin":"^8.41.0","@typescript-eslint/parser":"^8.41.0","blockbench-types":"^5.1.0","css-loader":"^7.1.2","eol":"0.10.0","eslint":"^9.34.0","indent-string":"^5.0.0","jest":"^30.1.1","to-string-loader":"^1.2.0","ts-jest":"^29.4.1","ts-loader":"^9.5.4","typescript":"^5.9.2","webpack":"^5.101.3","webpack-cli":"^6.0.1"},"dependencies":{"lodash":"^4.17.21","semver":"7.7.2"}}');
6996+
module.exports = /*#__PURE__*/JSON.parse('{"name":"geckolib","version":"4.2.5","private":true,"description":"GeckoLib Models & Animations","main":"index.js","scripts":{"prebuild":"npm run test","build":"npm run build:only","build:only":"webpack && npm run update_manifest","update_manifest":"node scripts/updateManifest.mjs","start":"webpack --watch --mode=development","lint":"eslint .","lint:fix":"eslint --fix .","tsc":"tsc --noEmit","pretest":"npm run lint && npm run tsc","test":"npm run test:only","test:only":"jest"},"author":"Eliot Lash, Tslat, Gecko, McHorse, matmat37000","license":"MIT","pluginOptions":{"title":"GeckoLib Models & Animations","description":"Create animated blocks, items, entities, and armor for the GeckoLib java mod library.","icon":"icon.png","tags":["Minecraft: Java Edition"],"variant":"both","min_version":"5.0.0","max_version":"6.0.0","await_loading":true,"has_changelog":true,"website":"https://github.com/bernie-g/geckolib/wiki","repository":"https://github.com/JannisX11/blockbench-plugins/tree/master/plugins/geckolib","bug_tracker":"https://github.com/bernie-g/geckolib/issues"},"sideEffects":["./index.js"],"devDependencies":{"@types/jest":"^30.0.0","@types/lodash":"^4.17.20","@typescript-eslint/eslint-plugin":"^8.41.0","@typescript-eslint/parser":"^8.41.0","blockbench-types":"^5.0.6","css-loader":"^7.1.2","eol":"0.10.0","eslint":"^9.34.0","indent-string":"^5.0.0","jest":"^30.1.1","to-string-loader":"^1.2.0","ts-jest":"^29.4.1","ts-loader":"^9.5.4","typescript":"^5.9.2","webpack":"^5.101.3","webpack-cli":"^6.0.1"},"dependencies":{"lodash":"^4.17.21","semver":"7.7.2"}}');
69976997

69986998
/***/ }),
69996999

@@ -7397,8 +7397,6 @@ __webpack_require__.r(__webpack_exports__);
73977397
/* harmony import */ var _resources_armorTemplate_json__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../resources/armorTemplate.json */ "./resources/armorTemplate.json");
73987398
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils */ "./ts/utils.ts");
73997399
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./constants */ "./ts/constants.ts");
7400-
/* harmony import */ var _keyframe__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./keyframe */ "./ts/keyframe.ts");
7401-
74027400

74037401

74047402

@@ -7715,191 +7713,6 @@ function buildDisplaySettingsJson(options = {}) {
77157713
});
77167714
return this;
77177715
}
7718-
/**
7719-
* When the animation file is being loaded into the project
7720-
* <p>
7721-
* The project <b><u>may not</u></b> be a GeckoLib project, so check it as necessary
7722-
*/
7723-
function LoadFile(file, exportingAnims) {
7724-
// eslint-disable-next-line no-undef
7725-
const json = file.json || autoParseJSON(file.content);
7726-
const path = file.path;
7727-
const new_animations = [];
7728-
function geoLoopToBbLoop(jsonLoop) {
7729-
if (jsonLoop) {
7730-
if (typeof jsonLoop === 'boolean')
7731-
return jsonLoop ? 'loop' : 'once';
7732-
if (typeof jsonLoop === 'string') {
7733-
if (jsonLoop === "hold_on_last_frame")
7734-
return 'hold';
7735-
if (jsonLoop === "loop" || jsonLoop === "true")
7736-
return 'loop';
7737-
}
7738-
}
7739-
return 'once';
7740-
}
7741-
function getKeyframeDataPoints(channel, source) {
7742-
if (source instanceof Array)
7743-
return invertAnimKeyframe(channel, [{ x: source[0], y: source[1], z: source[2] }]);
7744-
if (['number', 'string'].includes(typeof source))
7745-
return invertAnimKeyframe(channel, [{ x: source, y: source, z: source }]);
7746-
if (typeof source == 'object') {
7747-
if (source.vector)
7748-
return getKeyframeDataPoints(channel, source.vector);
7749-
const points = [];
7750-
if (source.pre)
7751-
points.push(getKeyframeDataPoints(channel, source.pre)[0]);
7752-
if (source.post)
7753-
points.push(getKeyframeDataPoints(channel, source.post)[0]);
7754-
return points;
7755-
}
7756-
}
7757-
// Because Blockbench now implicitly inverts rotation and position keyframes on export and import (??)
7758-
function invertAnimKeyframe(channel, value) {
7759-
if (channel != 'position' && channel != 'rotation')
7760-
return value;
7761-
if (value instanceof Array) {
7762-
switch (value.length) {
7763-
case 1: return [invertAnimKeyframe(channel, value[0])];
7764-
case 3: return [invertAnimKeyframe(channel, value[0]), channel == 'rotation' ? invertAnimKeyframe(channel, value[1]) : value[1], value[2]];
7765-
default: return value;
7766-
}
7767-
}
7768-
else if (typeof value == 'object') {
7769-
if (value.x)
7770-
value.x = invertMolang(value.x);
7771-
if (value.y && channel == 'rotation')
7772-
value.y = invertMolang(value.y);
7773-
return value;
7774-
}
7775-
return invertMolang(value);
7776-
}
7777-
if (json && typeof json.animations === 'object') {
7778-
for (const animName in json.animations) {
7779-
if (exportingAnims && !exportingAnims.includes(animName))
7780-
continue;
7781-
//Animation
7782-
const animData = json.animations[animName];
7783-
let animation = new Animation({
7784-
name: animName,
7785-
path,
7786-
loop: geoLoopToBbLoop(animData.loop),
7787-
override: animData.override_previous_animation,
7788-
anim_time_update: (typeof animData.anim_time_update == 'string'
7789-
? animData.anim_time_update.replace(/;(?!$)/, ';\n')
7790-
: animData.anim_time_update),
7791-
blend_weight: (typeof animData.blend_weight == 'string'
7792-
? animData.blend_weight.replace(/;(?!$)/, ';\n')
7793-
: animData.blend_weight),
7794-
length: animData.animation_length
7795-
});
7796-
animation = animation.add();
7797-
//Bones
7798-
if (animData.bones) {
7799-
for (const boneName in animData.bones) {
7800-
const bone = animData.bones[boneName];
7801-
const lowercase_bone_name = boneName.toLowerCase();
7802-
const group = Group.all.find(group => group.name.toLowerCase() == lowercase_bone_name);
7803-
const uuid = group ? group.uuid : guid();
7804-
const boneAnimator = new _keyframe__WEBPACK_IMPORTED_MODULE_3__.GeckolibBoneAnimator(uuid, animation, boneName);
7805-
animation.animators[uuid] = boneAnimator;
7806-
//Channels
7807-
for (const channel in bone) {
7808-
if (Animator.possible_channels[channel]) {
7809-
if (typeof bone[channel] === 'string' || typeof bone[channel] === 'number' || bone[channel] instanceof Array) {
7810-
boneAnimator.addKeyframe({
7811-
time: 0,
7812-
channel,
7813-
easing: bone[channel]["easing"],
7814-
easingArgs: bone[channel]["easingArgs"],
7815-
data_points: getKeyframeDataPoints(channel, bone[channel]),
7816-
});
7817-
}
7818-
else if (typeof bone[channel] === 'object' && bone[channel].post) {
7819-
boneAnimator.addKeyframe({
7820-
time: 0,
7821-
channel,
7822-
easing: bone[channel].easing == "bezier" ? undefined : bone[channel].easing,
7823-
easingArgs: bone[channel]["easingArgs"],
7824-
interpolation: bone[channel].easing == "bezier" ? "bezier" : bone[channel].lerp_mode,
7825-
data_points: getKeyframeDataPoints(channel, bone[channel]),
7826-
bezier_right_time: bone[channel].right_time,
7827-
bezier_left_time: bone[channel].left_time,
7828-
bezier_left_value: bone[channel].left,
7829-
bezier_right_value: bone[channel].right
7830-
});
7831-
}
7832-
else if (typeof bone[channel] === 'object') {
7833-
for (const timestamp in bone[channel]) {
7834-
boneAnimator.addKeyframe({
7835-
time: parseFloat(timestamp),
7836-
channel,
7837-
easing: bone[channel][timestamp].easing == "bezier" ? undefined : bone[channel][timestamp].easing,
7838-
easingArgs: bone[channel][timestamp].easingArgs,
7839-
interpolation: bone[channel][timestamp].easing == "bezier" ? "bezier" : bone[channel][timestamp].lerp_mode,
7840-
data_points: getKeyframeDataPoints(channel, bone[channel][timestamp]),
7841-
bezier_right_time: bone[channel][timestamp].right_time,
7842-
bezier_left_time: bone[channel][timestamp].left_time,
7843-
bezier_left_value: bone[channel][timestamp].left,
7844-
bezier_right_value: bone[channel][timestamp].right
7845-
});
7846-
}
7847-
}
7848-
}
7849-
}
7850-
}
7851-
}
7852-
if (animData.sound_effects) {
7853-
if (!animation.animators.effects)
7854-
animation.animators.effects = new EffectAnimator(animation);
7855-
for (const timestamp in animData.sound_effects) {
7856-
const sounds = animData.sound_effects[timestamp];
7857-
animation.animators.effects.addKeyframe({
7858-
channel: 'sound',
7859-
time: parseFloat(timestamp),
7860-
data_points: sounds instanceof Array ? sounds : [sounds]
7861-
});
7862-
}
7863-
}
7864-
if (animData.particle_effects) {
7865-
if (!animation.animators.effects)
7866-
animation.animators.effects = new EffectAnimator(animation);
7867-
for (const timestamp in animData.particle_effects) {
7868-
let particles = animData.particle_effects[timestamp];
7869-
if (!(particles instanceof Array))
7870-
particles = [particles];
7871-
particles.forEach(particle => {
7872-
if (particle)
7873-
particle.script = particle.pre_effect_script;
7874-
});
7875-
animation.animators.effects.addKeyframe({
7876-
channel: 'particle',
7877-
time: parseFloat(timestamp),
7878-
data_points: particles
7879-
});
7880-
}
7881-
}
7882-
if (animData.timeline) {
7883-
if (!animation.animators.effects)
7884-
animation.animators.effects = new EffectAnimator(animation);
7885-
for (const timestamp in animData.timeline) {
7886-
const entry = animData.timeline[timestamp];
7887-
const script = entry instanceof Array ? entry.join('\n') : entry;
7888-
animation.animators.effects.addKeyframe({
7889-
channel: 'timeline',
7890-
time: parseFloat(timestamp),
7891-
data_points: [{ script }]
7892-
});
7893-
}
7894-
}
7895-
animation.calculateSnappingFromKeyframes();
7896-
if (!Animator.selected && Animator.open)
7897-
animation.select();
7898-
new_animations.push(animation);
7899-
}
7900-
}
7901-
return new_animations;
7902-
}
79037716
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (codec);
79047717

79057718

0 commit comments

Comments
 (0)