Class: Lapis::Minecraft::Versioning::Detailed

Inherits:
Basic
  • Object
show all
Defined in:
lib/lapis/minecraft/versioning/detailed.rb

Overview

Additional information about a Minecraft version.

Instance Attribute Summary collapse

Attributes inherited from Basic

#id, #time, #type, #url

Instance Method Summary collapse

Constructor Details

#initialize(basic_info, asset_index, downloads, libraries, launcher_properties) ⇒ Detailed

Creates version information.

Parameters:

  • basic_info (Basic)

    Minimal information to extend from.

  • asset_index (AssetIndex)

    Overview of assets needed for the version.

  • downloads (Array<Resource>)

    List of downloads available for this version.

  • libraries (Array<Library>)

    List of libraries needed to run this version.

  • launcher_properties (LauncherProperties)

    Information about how to start the client in a launcher.


40
41
42
43
44
45
46
47
48
49
# File 'lib/lapis/minecraft/versioning/detailed.rb', line 40

def initialize(basic_info, asset_index, downloads, libraries, launcher_properties)
  super(basic_info.id, basic_info.type, basic_info.time, basic_info.url)
  @asset_index         = asset_index
  @downloads           = downloads.dup.freeze
  @libraries           = libraries.dup.freeze
  @launcher_properties = launcher_properties

  @client_download = downloads.find { |download| download.classifier == 'client' }
  @server_download = downloads.find { |download| download.classifier == 'server' }
end

Instance Attribute Details

#asset_indexAssetIndex (readonly)

Overview of assets included in this version.

Returns:


12
13
14
# File 'lib/lapis/minecraft/versioning/detailed.rb', line 12

def asset_index
  @asset_index
end

#client_downloadResource? (readonly)

Retrieves the client jar information for this version.

Returns:

  • (Resource, nil)

    Download information for the client, or nil if there is no client for this version.


28
29
30
# File 'lib/lapis/minecraft/versioning/detailed.rb', line 28

def client_download
  @client_download
end

#downloadsArray<Resource> (readonly)

List of downloads available for this version.

Returns:


16
17
18
# File 'lib/lapis/minecraft/versioning/detailed.rb', line 16

def downloads
  @downloads
end

#launcher_propertiesLauncherProperties (readonly)

Information about how to start the client in a launcher.

Returns:


24
25
26
# File 'lib/lapis/minecraft/versioning/detailed.rb', line 24

def launcher_properties
  @launcher_properties
end

#librariesArray<Library> (readonly)

List of libraries needed to run this version.

Returns:


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

def libraries
  @libraries
end

#server_downloadResource? (readonly)

Retrieves the server jar information for this version.

Returns:

  • (Resource, nil)

    Download information for the server, or nil if there is no server for this version.


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

def server_download
  @server_download
end

Instance Method Details

#==(other) ⇒ true, false

Compares one version to another.

Parameters:

  • other (Detailed)

    Version to compare against.

Returns:

  • (true)

    The versions are the same.

  • (false)

    The versions are different.


55
56
57
58
59
60
61
62
63
# File 'lib/lapis/minecraft/versioning/detailed.rb', line 55

def ==(other)
  super(other) &&
      other.asset_index == @asset_index &&
      other.downloads == @downloads &&
      other.libraries == @libraries &&
      other.launcher_properties == @launcher_properties &&
      other.client_download == @client_download &&
      other.server_download == @server_download
end