Class: Lapis::Minecraft::Version

Inherits:
Lapis::Minecraft::Versioning::Basic show all
Defined in:
lib/lapis/minecraft/version.rb

Overview

Note:

This class uses lazy-loading to retrieve additional information only when it is needed.

Complete information about a Minecraft version.

Instance Attribute Summary

Attributes inherited from Lapis::Minecraft::Versioning::Basic

#id, #time, #type, #url

Instance Method Summary collapse

Constructor Details

#initialize(basic_info, meta_server) ⇒ Version

Creates version information.


13
14
15
16
# File 'lib/lapis/minecraft/version.rb', line 13

def initialize(basic_info, meta_server)
  super(basic_info.id, basic_info.type, basic_info.time, basic_info.url)
  @meta_server = meta_server
end

Instance Method Details

#==(other) ⇒ true, false

Compares one version to another.


66
67
68
69
70
71
72
73
74
75
76
# File 'lib/lapis/minecraft/version.rb', line 66

def ==(other)
  # Ordered by least expensive to most expensive.
  super(other) &&
      other.asset_index == asset_index &&
      other.launcher_properties == launcher_properties &&
      other.client_download == client_download &&
      other.server_download == server_download &&
      other.downloads == downloads &&
      other.libraries == libraries &&
      other.assets == assets
end

#asset_indexVersioning::AssetIndex

Overview of assets included in this version.


26
27
28
# File 'lib/lapis/minecraft/version.rb', line 26

def asset_index
  details.asset_index
end

#assetsArray<Versioning::Asset>

List of assets needed for this version.


20
21
22
# File 'lib/lapis/minecraft/version.rb', line 20

def assets
  @assets ||= @meta_server.get_assets(asset_index.url)
end

#client_downloadVersioning::Resource?

Retrieves the client jar information for this version.


39
40
41
# File 'lib/lapis/minecraft/version.rb', line 39

def client_download
  details.client_download
end

#downloadsArray<Versioning::Resource>

List of downloads available for this version.


32
33
34
# File 'lib/lapis/minecraft/version.rb', line 32

def downloads
  details.downloads
end

#launcher_propertiesVersioning::LauncherProperties

Information about how to start the client in a launcher.


58
59
60
# File 'lib/lapis/minecraft/version.rb', line 58

def launcher_properties
  details.launcher_properties
end

#librariesArray<Versioning::Library>

List of libraries needed to run this version.


52
53
54
# File 'lib/lapis/minecraft/version.rb', line 52

def libraries
  details.libraries
end

#server_downloadVersioning::Resource?

Retrieves the server jar information for this version.


46
47
48
# File 'lib/lapis/minecraft/version.rb', line 46

def server_download
  details.server_download
end