package main
import (
"strconv"
"strings"
)
var xmlHeader = `
{NAME}
0
CastShadows InScene
0
0
0
0
Large
`
var xmlFooter = `
{NAME}
true
false
0
None
0
0
0
`
// LargeBlockArmorBlock
// LargeHeavyBlockArmorBlock
var blockTemplate = `
{BLOCKTYPE}
{SKIN}
0
`
// blocktype, HSV color as three floats
func writeBlock(blockType string, color []float64, pos []int, bpName string) string {
newBlock := blockTemplate
newBlock = strings.Replace(newBlock, "{BLOCKTYPE}", blockType, 1)
newBlock = strings.Replace(newBlock, "{COLOR1}", strconv.FormatFloat(color[0], 'f', 6, 64), 1)
newBlock = strings.Replace(newBlock, "{COLOR2}", strconv.FormatFloat(color[1], 'f', 6, 64), 1)
newBlock = strings.Replace(newBlock, "{COLOR3}", strconv.FormatFloat(color[2], 'f', 6, 64), 1)
newBlock = strings.Replace(newBlock, "{POSX}", strconv.Itoa(pos[0]), 1)
newBlock = strings.Replace(newBlock, "{POSY}", strconv.Itoa(pos[1]), 1)
newBlock = strings.Replace(newBlock, "{POSZ}", strconv.Itoa(pos[2]), 1)
// TODO: do not hardcode {SKIN}
newBlock = strings.Replace(newBlock, "{SKIN}", "Concrete_Armor", 1)
xmlFooter = strings.Replace(xmlFooter, "{NAME}", bpName, -1)
xmlHeader = strings.Replace(xmlHeader, "{NAME}", bpName, -1)
return newBlock
}