mcblocky 0.1.0.pre.alpha.pre.7 → 0.1.0.pre.alpha.pre.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OWE1ZWFiMzY3MDg5Yzk4YWE2YTRjYTgwYjViYWE4MTAwM2Y5YjUzNQ==
4
+ ZjhiZTU3YzYzM2JkMDViNTQzMDY3OGI4YzY1NzVhODI1NmIzNDFhZA==
5
5
  data.tar.gz: !binary |-
6
- ZjVjMWY0MjIzNDNiMTMxMTM4ZTk1NzA4YWJkNmNmN2Q4MDI3YTc1OQ==
6
+ OGZjNjQxMjdhOGU5OTU0MTM4NTEzMzI1YTAyZmM5YWZlOTk1OTAxMg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OTljNzRmNjY3NzUzOGI5NWY0ZjM0ZmFhNDNhYzVlNjJmYTc3NWMzZTc4ODkx
10
- MjA5NjUwYzIyMWEzMmQ1NjA5MzA2MmZhMDQ2OTY5YWE5ODE5YTU0YWJmNzYy
11
- YTZiNTg4YzMyY2E4Y2UxMTU2ZWI2ZWRiNzFkYTAyOWI1ZDEyOTY=
9
+ MzM1OGZiM2FjZjQxNGJiN2YzNjAwMGE0NTI5YTE3YTA3YzMwODU4NTg5NGY4
10
+ YzdjYWE4MWY1YWRjMTMxMDBjMmI1NTM0ZjhiOTllMjIzMTI0M2YzOTM1N2M1
11
+ MzUyOGE1ODJjMTFmNDZmZTkyNjcyOGQyNjdjNWQxNzk3MGYzM2M=
12
12
  data.tar.gz: !binary |-
13
- ZjNkMTM0MmI3ZGUzOTViYzg1YWY4ZDhlNTY5ODlhZjVhZDE2MDM2MDIyOWVh
14
- ZTY3MmVlYmNkZGZkNzRmMjlhNDliMDVjNDdkNThkNWQ3NjMxYzEwNjcyZDA2
15
- ZmQ2Y2JiZTZkZjIxYjE4MWM4YWJiM2IwNDIxZjllN2RkZTQ5YTE=
13
+ MDFlZmUwOTBmMmZlNGYzYzM5ODA0NTNmMWFkOGMyOWU4YjczNDJmNWQ1Mzkw
14
+ NmFlZjI1ZGU4N2RlY2RhOTM4MDVlYmJkYjZjMDc0Yzg3ZDM5OWIxOTZiMTY4
15
+ OWEzOTQ5MDk3MzAzM2UyNGI3NzMzMGFmMDZiNTAwZGRjYjlmMjQ=
data/.gitignore CHANGED
@@ -3,7 +3,6 @@
3
3
  /Gemfile.lock
4
4
  /_yardoc/
5
5
  /coverage/
6
- /doc/
7
6
  /pkg/
8
7
  /spec/reports/
9
8
  /tmp/
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  McBlocky is a Ruby DSL for creating Minecraft command block contraptions and
4
4
  maps.
5
5
 
6
- [![Build Status](https://travis-ci.org/DeltaWhy/mcblocky.svg?branch=master)](https://travis-ci.org/DeltaWhy/mcblocky)
6
+ [![Build Status](https://travis-ci.org/DeltaWhy/mcblocky.svg?branch=master)](https://travis-ci.org/DeltaWhy/mcblocky)[![Gem Version](https://badge.fury.io/rb/mcblocky.svg)](https://badge.fury.io/rb/mcblocky)
7
7
  <!-- START doctoc generated TOC please keep comment here to allow auto update -->
8
8
  <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
9
9
 
data/doc/Helpers.md ADDED
@@ -0,0 +1,15 @@
1
+ # Helpers
2
+ You can define helpers for frequently used commands to make them easier to run. Helpers are triggered by sending `!name` in the chat, and are executed in the server console.
3
+
4
+ Currently the DSL commands are not available inside a helper block -- instead use `server.command` to send the command as a string, or `server.say` to send a console message.
5
+
6
+ A helper block receives two arguments: the first is an array of words that were given after the helper name, the second is the username of the player who triggered the helper.
7
+
8
+ ## Examples
9
+ ```ruby
10
+ helper 'blue' do |args, user|
11
+ # filter out any color codes from the username
12
+ user = user.gsub(/[^A-Za-z0-9_]./, '')
13
+ server.command "scoreboard teams join Blue #{user}"
14
+ end
15
+ ```
data/doc/Introduction.md CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  # McBlocky
3
2
  McBlocky is a Ruby DSL for creating Minecraft command block contraptions and maps. It allows you to write Ruby code that gets translated into commands and command blocks in the Minecraft world. Because it does everything by executing commands in the server console, you can see the results of your changes in-game almost immediately after you hit 'Save' in your editor -- no need to restart the server to run MCEdit.
4
3
 
@@ -137,7 +136,7 @@ end
137
136
  ```
138
137
 
139
138
  ## Next steps
140
- Check out the [examples folder](../examples) for some longer examples. Then try making one of your own! Also have a look at the rest of the [documentation](../doc) *(coming soon)*.
139
+ Check out the [examples folder](../examples) for some longer examples. Then try making one of your own! Also have a look at the rest of the [documentation](../doc).
141
140
 
142
141
  Please report bugs and feature requests on the [issue tracker](https://github.com/DeltaWhy/mcblocky/issues). I will also accept pull requests for the code, documentation, and examples.
143
142
 
data/doc/Selectors.md ADDED
@@ -0,0 +1,19 @@
1
+ # Selectors
2
+ Many Minecraft commands accept an entity selector -- something like `@e[type=ArmorStand,x=1,y=2,z=3,r=1]`. McBlocky also understands selectors, which look slightly different in Ruby:
3
+ ```ruby
4
+ @e[type: 'ArmorStand', x: 1, y: 2, z: 3, r: 1]
5
+ ```
6
+
7
+ You can also save a partial selector to a variable and add more arguments to it later:
8
+ ```ruby
9
+ foo = @a[x: 1, y: 2, z: 3, r: 1]
10
+ foo[team: 'Red'] # "@a[x=1,y=2,z=3,r=1,team=Red]"
11
+ foo[team: 'Blue'] # "@a[x=1,y=2,z=3,r=1,team=Blue]"
12
+ foo # "@a[x=1,y=2,z=3,r=1]"
13
+ ```
14
+
15
+ As a shorthand, you can pass a `Location` object instead of the x, y, and z arguments.
16
+ ```ruby
17
+ l = Location.new(1, 2, 3)
18
+ @a[loc: l] # "@a[x=1,y=2,z=3]"
19
+ ```
data/doc/Syntax.md ADDED
@@ -0,0 +1,194 @@
1
+ # Syntax
2
+ McBlocky syntax is, first and foremost, Ruby syntax. If you're not familiar with Ruby you should check out [Ruby in Twenty Minutes](https://www.ruby-lang.org/en/documentation/quickstart/) first, as it's a bit different from most other programming languages.
3
+
4
+ To do anything useful with McBlocky you'll need to call its functions. Several top-level functions are available, most of which take a Ruby block. More commands are available inside these blocks depending on what the function is.
5
+
6
+ <!-- START doctoc generated TOC please keep comment here to allow auto update -->
7
+ <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
8
+
9
+
10
+ - [Top level functions](#top-level-functions)
11
+ - [require and require_relative](#require-and-require_relative)
12
+ - [helper](#helper)
13
+ - [initial](#initial)
14
+ - [cleanup](#cleanup)
15
+ - [after](#after)
16
+ - [setblock](#setblock)
17
+ - [fill](#fill)
18
+ - [at](#at)
19
+ - [repeat](#repeat)
20
+ - [chest](#chest)
21
+ - [trapped_chest](#trapped_chest)
22
+ - [dispenser](#dispenser)
23
+ - [dropper](#dropper)
24
+ - [furnace](#furnace)
25
+ - [Command context](#command-context)
26
+ - [execute](#execute)
27
+ - [detect](#detect)
28
+ - [gamerule](#gamerule)
29
+ - [scoreboard](#scoreboard)
30
+ - [Container context](#container-context)
31
+ - [item](#item)
32
+ - [item_in_slot](#item_in_slot)
33
+ - [NBT and JSON](#nbt-and-json)
34
+
35
+ <!-- END doctoc generated TOC please keep comment here to allow auto update -->
36
+
37
+ ## Top level functions
38
+ ### require and require_relative
39
+ These are actually Ruby functions, but it's worth mentioning that they work in McBlocky. `require` given a relative path will evaluate it relative to the root of your project (the location of your `config.yml`). `require_relative` evaluates relative to the *current file*.
40
+
41
+ ### helper
42
+ ```ruby
43
+ helper name do |args, user|
44
+ # helper context
45
+ end
46
+ ```
47
+ See [Helpers.md].
48
+
49
+ ### initial
50
+ ```ruby
51
+ initial do
52
+ # command context
53
+ end
54
+ ```
55
+ Commands to be executed before setting any blocks.
56
+
57
+ ### cleanup
58
+ ```ruby
59
+ cleanup do
60
+ # command context
61
+ end
62
+ ```
63
+ Commands to be executed before reloading the file.
64
+
65
+ ### after
66
+ ```ruby
67
+ after do
68
+ # command context
69
+ end
70
+ ```
71
+ Commands to be executed after setting all blocks.
72
+
73
+ ### setblock
74
+ ```ruby
75
+ setblock x, y, z, kind, data, replacemode, nbt
76
+ # does not take a block
77
+ ```
78
+ Set a specific block in the world. The top level `setblock` is smart when reloading, so you should use it instead of `setblock` inside an `initial` context.
79
+
80
+ ### fill
81
+ ```ruby
82
+ fill x1, y1, z1, x2, y2, z2, kind, data
83
+ ```
84
+ Fill an area in the world. Be careful with this one as a typo can be very destructive.
85
+
86
+ ### at
87
+ ```ruby
88
+ at x, y, z, data, kind, nbt do
89
+ # command context
90
+ end
91
+ ```
92
+ Place a command block with the command given. `kind` can be `:normal`, `:chain`, or `:repeating`. Note that you can only have one command inside the block.
93
+
94
+ ### repeat
95
+ ```ruby
96
+ repeat x1, y1, z1, x2, y2, z2 do
97
+ # command context
98
+ end
99
+ ```
100
+ Place a repeating command block chain within an area. Commands within this block will execute in order every tick. Ordering between different blocks depends on their world position.
101
+
102
+ ### chest
103
+ ```ruby
104
+ chest x, y, z, data do
105
+ # container context
106
+ end
107
+ ```
108
+ Place a chest in the world with the given contents.
109
+
110
+ ### trapped_chest
111
+ ```ruby
112
+ chest x, y, z, data do
113
+ # container context
114
+ end
115
+ ```
116
+ Place a trapped chest in the world with the given contents.
117
+
118
+ ### dispenser
119
+ ```ruby
120
+ chest x, y, z, data do
121
+ # container context
122
+ end
123
+ ```
124
+ Place a dispenser in the world with the given contents.
125
+
126
+ ### dropper
127
+ ```ruby
128
+ chest x, y, z, data do
129
+ # container context
130
+ end
131
+ ```
132
+ Place a dropper in the world with the given contents.
133
+
134
+ ### furnace
135
+ ```ruby
136
+ chest x, y, z, data do
137
+ # container context
138
+ end
139
+ ```
140
+ Place a furnace in the world with the given contents.
141
+
142
+
143
+ ## Command context
144
+ All Minecraft commands are available within a command context. The following shorthands are also available:
145
+
146
+ ### execute
147
+ ```ruby
148
+ execute selector ... do
149
+ # command context
150
+ end
151
+ ```
152
+ Commands inside the block are prefixed by the given `execute` fragment. If you do not specify any arguments after the selector, it will add the `~ ~ ~` for you.
153
+
154
+ ### detect
155
+ ```ruby
156
+ detect selector ... do
157
+ # command context
158
+ end
159
+ ```
160
+ Shorthand for `execute selector, '~ ~ ~', :detect ...`. If you do not specify any arguments after the selector, it will add `~ ~ ~` for you.
161
+
162
+ ### gamerule
163
+ ```ruby
164
+ gamerule do
165
+ rule value
166
+ rule value
167
+ ...
168
+ end
169
+ ```
170
+ Commands inside the block are treated as names of gamerules to set.
171
+
172
+ ### scoreboard
173
+ ```ruby
174
+ scoreboard ... do
175
+ ...
176
+ end
177
+ ```
178
+ Commands inside the block are prefixed with the arguments given.
179
+
180
+ ## Container context
181
+ ### item
182
+ ```ruby
183
+ item kind, count, damage, nbt
184
+ ```
185
+ Add an item to the next available slot in this container.
186
+
187
+ ### item_in_slot
188
+ ```ruby
189
+ item_in_slot slot, kind, count, damage, nbt
190
+ ```
191
+ Add an item to a specific slot in this container.
192
+
193
+ ## NBT and JSON
194
+ Ruby hashes can usually be automatically converted to an NBT or JSON string (whichever is appropriate for a given command). If this conversion doesn't happen, you can use `to_nbt` or `to_json`, available in any context.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mcblocky
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre.alpha.pre.7
4
+ version: 0.1.0.pre.alpha.pre.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Limiero
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-03-29 00:00:00.000000000 Z
11
+ date: 2016-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -98,7 +98,10 @@ files:
98
98
  - bin/console
99
99
  - bin/setup
100
100
  - bin/workon.cmd
101
+ - doc/Helpers.md
101
102
  - doc/Introduction.md
103
+ - doc/Selectors.md
104
+ - doc/Syntax.md
102
105
  - examples/ctf/arena.rb
103
106
  - examples/ctf/config.example.yml
104
107
  - examples/ctf/ctf.rb