Skip to content

Commit 94c375f

Browse files
committed
generate shaftless cog models
1 parent ac7cdd0 commit 94c375f

File tree

1 file changed

+23
-20
lines changed

1 file changed

+23
-20
lines changed

src/emit/assets/models.ts

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { encodeId, IdInput, NormalizedId, prefix } from '../../common/id.js'
2-
import CustomEmitter from '../custom.js'
1+
import { Acceptor } from '@pssbletrngle/pack-resolver'
2+
import { encodeId, IdInput, NormalizedId, prefix, suffix } from '../../common/id.js'
33
import { Model } from '../../schema/assets/model.js'
4+
import CustomEmitter from '../custom.js'
45
import { ClearableEmitter } from '../index.js'
5-
import { Acceptor } from '@pssbletrngle/pack-resolver'
66

77
export interface ModelRules {
88
add(id: IdInput, blockstate: Model): NormalizedId
@@ -58,22 +58,25 @@ export default class ModelEmitter implements ModelRules, ClearableEmitter {
5858
}
5959

6060
cog(id: IdInput, large: boolean, texture = prefix(id, 'block/')) {
61-
if (large) {
62-
return this.add(id, {
63-
parent: 'create:block/large_cogwheel',
64-
textures: {
65-
'4': texture,
66-
particle: texture,
67-
},
68-
})
69-
} else {
70-
return this.add(id, {
71-
parent: 'create:block/cogwheel',
72-
textures: {
73-
'1_2': texture,
74-
particle: texture,
75-
},
76-
})
77-
}
61+
const suffixes = ['', '_shaftless']
62+
return suffixes.map(it => {
63+
if (large) {
64+
return this.add(suffix(id, it), {
65+
parent: 'create:block/large_cogwheel' + it,
66+
textures: {
67+
'4': texture,
68+
particle: texture,
69+
},
70+
})
71+
} else {
72+
return this.add(suffix(id, it), {
73+
parent: 'create:block/cogwheel' + it,
74+
textures: {
75+
'1_2': texture,
76+
particle: texture,
77+
},
78+
})
79+
}
80+
})[0]
7881
}
7982
}

0 commit comments

Comments
 (0)