class McBlocky::DSL::Container

Attributes

block_data[R]
block_kind[R]
nbt[R]
x[R]
y[R]
z[R]

Public Class Methods

new(x, y, z, kind, data=0, nbt={}) click to toggle source
# File lib/mcblocky/dsl/container.rb, line 4
def initialize(x, y, z, kind, data=0, nbt={})
  @x = x
  @y = y
  @z = z
  @block_kind = kind
  @block_data = data
  @nbt = nbt
  @last_slot = -1
end

Public Instance Methods

item(kind, count=1, damage=0, tag={}) click to toggle source
# File lib/mcblocky/dsl/container.rb, line 20
def item(kind, count=1, damage=0, tag={})
  item_in_slot(@last_slot+1, kind, count, damage, tag)
end
item_in_slot(slot, kind, count=1, damage=0, tag={}) click to toggle source
# File lib/mcblocky/dsl/container.rb, line 14
def item_in_slot(slot, kind, count=1, damage=0, tag={})
  nbt['Items'] ||= []
  nbt['Items'] << {'Slot'=>slot, 'id'=>kind, 'Count'=>count, 'Damage'=>damage, 'tag'=>tag}
  @last_slot = slot if slot > @last_slot
end