class Rosegold::Slot

Direct Known Subclasses

Defined in:

rosegold/inventory/slot.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(count : UInt32 = 0_u32, item_id_int : UInt32 = 0_u32, components_to_add : Hash(String, Rosegold::DataComponent) = Hash(String, DataComponent).new, components_to_remove : Set(String) = Set(String).new) #

[View source]

Class Method Detail

def self.enchantment_registry : Array(String) #

[View source]
def self.enchantment_registry=(enchantment_registry : Array(String)) #

[View source]
def self.max_repair_cost : Int32 #

[View source]
def self.max_repair_cost=(max_repair_cost : Int32) #

[View source]
def self.read(io) : Rosegold::Slot #

[View source]
def self.read_component_patch(io) : Tuple(Hash(String, DataComponent), Set(String)) #

Reads a DataComponentPatch (add-count, remove-count, then the add/remove entries). Shared by Slot.read and read_item_stack_template, which differ only in the preceding item_id/count ordering.


[View source]
def self.read_item_stack_template(io) : Rosegold::Slot #

ItemStackTemplate (775+): item_id and count are read in the OPPOSITE order from Slot (item-then-count), but the trailing DataComponentPatch is identical. Used by recipe SlotDisplayItemStack and the sulfur_cube_content component.


[View source]

Instance Method Detail

def components_to_add : Hash(String, DataComponent) #

[View source]
def components_to_add=(components_to_add : Hash(String, DataComponent)) #

[View source]
def components_to_remove : Set(String) #

[View source]
def components_to_remove=(components_to_remove : Set(String)) #

[View source]
def count : UInt32 #

[View source]
def count=(count : UInt32) #

[View source]
def damage #

[View source]
def decrement #

[View source]
def durability #

[View source]
def edible? : Bool #

[View source]
def efficiency #

[View source]
def empty? #

[View source]
def enchanted? : Bool #

[View source]
def enchantments #

[View source]
def full? #

[View source]
def item : MCData::Item #

[View source]
def item_id_int : UInt32 #

[View source]
def item_id_int=(value : UInt32) #

[View source]
def make_empty #

[View source]
def matches?(item_id_int : UInt32) #

[View source]
def matches?(name : String) #

[View source]
def matches?(spec : Rosegold::Slot -> _) #

[View source]
def matches?(&) #

[View source]
def max_durability #

[View source]
def max_stack_size #

[View source]
def name : String #

[View source]
def needs_repair? : Bool #

[View source]
def present? #

[View source]
def repair_cost : Int32 #

[View source]
def swap_with(other) #

[View source]
def to_s(io) #

[View source]
def tool_component : DataComponents::Tool | Nil #

[View source]
def tool_speed_for_tag(tag : String) : Float32 | Nil #

Get the mining speed from the tool component for a given block tag


[View source]
def worth_repairing? : Bool #

[View source]
def write(io) #

[View source]
def write_item_stack_template(io) : Nil #

[View source]