Skip to content

Commit e8bb4ee

Browse files
committed
🦐 Reduce plugin size by almost 800KB.
- Removed extra THREE.js import, instead extracting the code AJ needs. - Reduced the size of a few images. -
1 parent a24c116 commit e8bb4ee

16 files changed

+1223
-26646
lines changed

.eslintrc.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,14 @@
99
"plugin:@typescript-eslint/recommended",
1010
"plugin:@typescript-eslint/recommended-requiring-type-checking"
1111
],
12-
"ignorePatterns": ["node_modules/", "dist/", "exporters/", "tools/", "svelte.config.ts"],
12+
"ignorePatterns": [
13+
"node_modules/",
14+
"dist/",
15+
"exporters/",
16+
"tools/",
17+
"svelte.config.ts",
18+
"src/util/bufferGeometryUtils.ts"
19+
],
1320
"overrides": [
1421
{
1522
"files": ["*.js", "*.d.ts"],

src/assets/armor_stand_running.gif

-188 KB
Binary file not shown.

src/assets/armor_stand_running.webp

65.8 KB
Binary file not shown.

src/assets/armor_stand_wave.gif

-192 KB
Binary file not shown.

src/assets/armor_stand_wave.webp

112 KB
Binary file not shown.

src/assets/text.json

Lines changed: 0 additions & 26615 deletions
This file was deleted.

src/components/animatedJavaLoadingPopup.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts" context="module">
2-
import RunningArmorStand from '../assets/armor_stand_running.gif'
2+
import RunningArmorStand from '../assets/armor_stand_running.webp'
33
import { type Valuable } from '../util/stores'
44
</script>
55

src/components/exportProgressDialog.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script lang="ts" context="module">
22
import { Valuable } from '../util/stores'
3-
import ArmorStandRunningGif from '../assets/armor_stand_running.gif'
3+
import ArmorStandRunningGif from '../assets/armor_stand_running.webp'
44
</script>
55

66
<script lang="ts">

src/pluginPackage/about.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
>
2525
<h1>Welcome to Animated Java!</h1>
2626
<img
27-
src="https://github.com/Animated-Java/animated-java/blob/rewrite/src/assets/armor_stand_wave.gif?raw=true"
27+
src="https://github.com/Animated-Java/animated-java/blob/main/src/assets/armor_stand_wave.webp?raw=true"
2828
alt="Armor Stand Waving"
2929
width="80px"
3030
/>

src/systems/minecraft/blockModelManager.ts

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { mergeGeometries } from '../../util/bufferGeometryUtils'
12
import {
23
IParsedBlock,
34
getPathFromResourceLocation,
@@ -15,7 +16,6 @@ import {
1516
IBlockStateVariant,
1617
} from './model'
1718
import { TEXTURE_FRAG_SHADER, TEXTURE_VERT_SHADER } from './textureShaders'
18-
import * as BufferGeometryUtils from 'three/examples/jsm/utils/BufferGeometryUtils'
1919

2020
type BlockModelMesh = { mesh: THREE.Mesh; outline: THREE.LineSegments; isBlock: true }
2121

@@ -340,19 +340,9 @@ async function generateModelMesh(
340340
mesh.add(elementMesh)
341341
}
342342

343-
// @ts-expect-error
344-
const outlineGeo = BufferGeometryUtils.mergeBufferGeometries(outlineGeos)
343+
const outlineGeo = mergeGeometries(outlineGeos)!
345344
const outline = new THREE.LineSegments(outlineGeo, Canvas.outlineMaterial)
346345

347-
// if (variant.y) {
348-
// mesh.rotateY(Math.degToRad(-variant.y))
349-
// outline.rotateY(Math.degToRad(-variant.y))
350-
// }
351-
// if (variant.x) {
352-
// mesh.rotateX(Math.degToRad(-variant.x))
353-
// outline.rotateX(Math.degToRad(-variant.x))
354-
// }
355-
356346
outline.no_export = true
357347
outline.renderOrder = 2
358348
outline.frustumCulled = false
@@ -456,8 +446,7 @@ export async function parseBlockState(block: IParsedBlock): Promise<BlockModelMe
456446
)
457447
}
458448

459-
// @ts-expect-error
460-
const outlineGeo = BufferGeometryUtils.mergeBufferGeometries(outlines)
449+
const outlineGeo = mergeGeometries(outlines)!
461450
const outline = new THREE.LineSegments(outlineGeo, Canvas.outlineMaterial)
462451

463452
outline.no_export = true

0 commit comments

Comments
 (0)