
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
RubyCraft is a simple library for manipulating Minecraft region files. Installation is as simple as:
$ gem install rubycraft
Region files are files with the mcr extension on the region folder of a save folder. The save folders are located below the saves folder of the minecraft data folder (for instance, on Linux it is ~/.minecraft/saves/$SAVENAME/region, and on mac it is ~/Library/Application Support/minecraft/$SAVENAME/region). More about save folders here.
filename = " ~/.minecraft/saves/$SAVENAME/region/r.0.0.mcr"
r = Region.fromFile(filename)
r.chunk(0, 0).block_map { :gold }
r.exportToFile filename
For more examples, check the examples folder.
When getting many chunks from Region#chunk method, don't forget to invoke Region#unloadChunk(z, x). This way the chunk will not occupy memory.
Alternatively you can use the Region#cube method. Example
r = Region.fromFile(filename)
c = r.cube(0, 0, 0, :width => 50, :length => 50, :height => 128)
c.each do |block, z, x, y|
block.name = :wool
block.color = :orange
end
It receives the z, x, y of the origin point of the cube, and its respective width, length and height. The chunk load/unload is abstracted way on this interface. The cube can receive a block, or it will return an Enumerable that iterates over the blocks of the cube. The proc receives four arguments: the block, and its relative coordinates to the cube's origin point.
Chunks are both enumerable and indexable:
chunk[0, 0, 0].name = :gold
chunk.each { |block| block.name = :gold }
Note that chunks have size 16x16x128 (width, length, height). Usually you don't create chunks directly, but get them through Region#chunk method.
Blocks have 3 attributes: block_type, pos and data. Block type tells the name, id and transparency (boolean) of the block. The pos attribute indicates the position of the block inside its chunk, and data is the integer data value.
Id is not usually accessed directly, as the name attribute provides a more friendly interface. For wool blocks, changing the color directly is also possible in a more friendly way.
block.name = :wool
block.color = :purple
p block.color
Created by Daniel Ribeiro
Released under the MIT License: http://www.opensource.org/licenses/mit-license.php
FAQs
Unknown package
We found that rubycraft demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
Research
/Security News
A malicious Go module posing as an SSH brute forcer exfiltrates stolen credentials to a Telegram bot controlled by a Russian-speaking threat actor.