forked from michaljaz/webmc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprebuild.coffee
More file actions
48 lines (45 loc) · 1.2 KB
/
prebuild.coffee
File metadata and controls
48 lines (45 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
fs=require "fs"
config=require "./server.json"
pBlock=require("prismarine-block")(config.version)
atlasCreator=require "./atlasCreator.coffee"
new atlasCreator {
pref:"items"
toxelSize:50
loadPath:"#{__dirname}/assets/items"
buildPath:"#{__dirname}/client/assets/items"
atlasSize:32
oneFrame:false
}
new atlasCreator {
pref:"blocks"
toxelSize:16
loadPath:"#{__dirname}/assets/blocks"
buildPath:"#{__dirname}/client/assets/blocks"
atlasSize:36
oneFrame:false
}
new atlasCreator {
pref:"blocksSnap"
toxelSize:16
loadPath:"#{__dirname}/assets/blocks"
buildPath:"#{__dirname}/client/assets/blocks"
atlasSize:27
oneFrame:true
}
maxStateId=0
for i in [0..100000]
block=pBlock.fromStateId i
if block.type is undefined
maxStateId=i-1
break
console.log "\x1b[33mBlock max stateId: #{maxStateId}\x1b[0m"
result=[]
for i in [0..maxStateId]
if pBlock.fromStateId(i).boundingBox is "block"
bbox=1
else
bbox=0
result.push [pBlock.fromStateId(i).name,bbox]
buildPath="#{__dirname}/client/assets/blocks/blocksDef.json"
fs.writeFileSync buildPath, JSON.stringify(result)
console.log "\x1b[32mGenerated blocksDefinitions: #{buildPath}\x1b[0m\n"