Example #1
0
func initResources() {
	var pBar *progressBar
	resource.Init(func(progress float64, done bool) {
		if !done {
			if pBar == nil {
				pBar = newProgressBar()
			}
			pBar.update(progress, fmt.Sprintf("Downloading textures: %v/100", int(100*progress)))
		} else {
			if pBar != nil {
				pBar.remove()
			}
			reloadResources()
		}
	}, syncChan)

	for _, pck := range strings.Split(resourcePacks.Value(), ",") {
		if pck == "" {
			continue
		}
		resource.LoadZip(pck)
	}
	locale.Clear()
	loadBiomes()
	render.LoadSkinBuffer()
}
Example #2
0
func reloadResources() {
	console.Text("Bringing everything to a stop")
	for freeBuilders < maxBuilders {
		select {
		case pos := <-completeBuilders:
			freeBuilders++
			if c := chunkMap[chunkPosition{pos.X, pos.Z}]; c != nil {
				if s := c.Sections[pos.Y]; s != nil {
					s.building = false
				}
			}
		}
	}
	locale.Clear()
	render.LoadSkinBuffer()
	modelCache = map[string]*model{}
	console.Text("Reloading textures")
	render.LoadTextures()
	console.Text("Reloading biomes")
	loadBiomes()
	ui.ForceDraw()
	console.Text("Reloading blocks")
	reinitBlocks()
	console.Text("Marking chunks for rebuild")
	for _, c := range chunkMap {
		for _, s := range c.Sections {
			if s != nil {
				s.dirty = true
			}
		}
	}
	console.Text("Rebuilding static models")
	render.RefreshModels()
	console.Text("Reloading inventory")
	Client.playerInventory.Update()
}