Skip to content

Commit fa9a41e

Browse files
committed
Transparent items
1 parent 5bcd870 commit fa9a41e

File tree

977 files changed

+80
-5
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

977 files changed

+80
-5
lines changed

coffee/items.coffee

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,57 @@ options = {
1010
encoding: "utf-8"
1111
}
1212

13+
removeBg=()->
14+
replaceColor = require 'replace-color'
15+
fs=require "fs"
16+
17+
removeBg=(filePath)->
18+
replaceColor {
19+
image: filePath
20+
colors: {
21+
type: 'rgb'
22+
targetColor: [139, 139, 139]
23+
replaceColor: [0,0,0,0]
24+
}
25+
}, (err, jimpObject)->
26+
if err
27+
return console.log err
28+
jimpObject.write filePath, (err) ->
29+
if err
30+
return console.log err
31+
32+
dir_path=__dirname+"/client/assets/items/"
33+
fs.readdir dir_path, (err, files)->
34+
files.forEach (file)->
35+
filePath=__dirname+"/client/assets/items/"+file
36+
removeBg filePath
37+
return
38+
return
39+
1340
request options, (err, response, body)->
1441
soup=new JSSoup(body)
1542
map={}
1643
last=null
44+
ile=0
45+
zal=0
1746
for i in soup.findAll("td")
1847
if (i.text isnt " ") and (i.text.includes "minecraft:")
48+
ile+=1
1949
title=i.text.split("(")[0]
2050
war=0
2151
for j in [0..i.text.length-1]
2252
if i.text[j] is "("
2353
war=j
2454
type=(i.text.substr war+11).split(")")[0]
25-
console.log type,last
2655
((type,url)->
2756
file=fs.createWriteStream "#{__dirname}/client/assets/items/#{type}.png"
2857
https.get url,(response)->
58+
console.log type,url
2959
response.pipe(file)
60+
zal+=1
61+
if ile is zal
62+
console.log("Removing gray backgrounds...")
63+
removeBg()
3064
)(type,"https://www.digminecraft.com#{last}")
3165
else if i.find("img") isnt undefined
3266
last=i.find("img").attrs["data-src"]
405 Bytes
213 Bytes
182 Bytes
949 Bytes
843 Bytes
1.99 KB
1.68 KB
1.94 KB
638 Bytes

0 commit comments

Comments
 (0)