Skip to content

Instantly share code, notes, and snippets.

@nicholasrobertm
Created May 24, 2021 05:10
Show Gist options
  • Save nicholasrobertm/8df7f7c83a2023ca55a6c8a3d76ac5b3 to your computer and use it in GitHub Desktop.
Save nicholasrobertm/8df7f7c83a2023ca55a6c8a3d76ac5b3 to your computer and use it in GitHub Desktop.
An example minecraft mod in ruby
# frozen_string_literal: true
class Example
def pre_init
@block = Block.new(:wood)
@block.set_unlocalized_name('bigboi')
@block.set_registry_name('test:bigboiblock')
@itemBlock = ItemBlock.new(@block)
@itemBlock.set_registry_name('test:bigboiblock')
@item = Item.new
@item.set_unlocalized_name('item')
@item.set_registry_name('test:bigboiitem')
#@tab = QuickTab.new('Tab', @item)
@item.set_creative_tab(CreativeTabs.tabCombat)
@block.set_creative_tab(CreativeTabs.tabBlock)
end
java_annotation 'SubscribeEvent'
def register_blocks(event)
puts "Registering event #{event.to_s}"
event.getRegistry().register(@block)
puts "Block registered #{@block.to_s}"
end
java_annotation 'SubscribeEvent'
def register_items(event)
puts "Registering event #{event.to_s}"
event.getRegistry().register(@itemBlock)
puts "Block registered #{@itemBlock.to_s}"
end
end
add_mod(Example, 'Example', '0.1')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment