diamond-lang 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3075c30a0c08b540e5bfacab36b24805454376ff
4
- data.tar.gz: df3af1c137c9ecb555391eeb2633caa64d588d05
3
+ metadata.gz: a90e675e31c6f081f99a84e7a2c724a2e6f5b9fc
4
+ data.tar.gz: e0343396fc5788d8f40607fc4281e007df655aac
5
5
  SHA512:
6
- metadata.gz: d08ee782327aff9f96a183d80a04f4edb4ddcaa2400b3beddec5f43f11814d146936e6d849a7d8ae4064d35a230eeef3a73a9ddd59217ffc5ef1893137f2e21f
7
- data.tar.gz: 7bb9541370b490cebfc9a6fba68ea2bb9310e2587db284d120f5c870c07ab0f4587f16ffee309130f309ef524f747501faecfb251047a6efd0fca1737c93e8e6
6
+ metadata.gz: 0c3a4993ec8c5a693d5f092e181f116ed611ff743d7ef807c6a999d4286d2a5ac8e0ca0c6e6698e7d8a68fa63559c38e1e722bee46108a7cbb1e5b462b2d7272
7
+ data.tar.gz: 78251e3c4a1e8b516efc5a4a36c42f824f9a8abf522e73902a583c432d291c6d0781cc22bb0d027c2eb9d6acfaedd25eee68b947996dc6123f39579b36ecbd01
data/README.md CHANGED
@@ -173,12 +173,6 @@ c.test_for close_players do |c|
173
173
  end #=> @a[r=10]
174
174
  ~~~
175
175
 
176
- hashes instead of arrays (we flatten the command arguments)
177
-
178
- ~~~rb
179
- c.tell penne12: 'something' #=> tell penne12 something
180
- ~~~
181
-
182
176
  string interpolation:
183
177
 
184
178
  ~~~rb
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.0
1
+ 1.2.1
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: diamond-lang 1.2.0 ruby lib
5
+ # stub: diamond-lang 1.2.1 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "diamond-lang"
9
- s.version = "1.2.0"
9
+ s.version = "1.2.1"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Ben (@penne12_)"]
14
- s.date = "2016-01-01"
14
+ s.date = "2016-01-02"
15
15
  s.description = "Making Minecraft 1 Command Creations with ruby. It's as easy as `c.say 123`"
16
16
  s.email = "ben@bensites.com"
17
17
  s.extra_rdoc_files = [
@@ -28,8 +28,13 @@ Gem::Specification.new do |s|
28
28
  "VERSION",
29
29
  "diamond-lang.gemspec",
30
30
  "examples/conveyor.rb",
31
+ "examples/conveyor.txt",
31
32
  "examples/custom_crafting.rb",
33
+ "examples/custom_crafting.txt",
32
34
  "examples/hello_world.rb",
35
+ "examples/hello_world.txt",
36
+ "examples/jetpack.rb",
37
+ "examples/jetpack.txt",
33
38
  "lib/diamond-lang.rb",
34
39
  "lib/diamond-lang/command_chain.rb",
35
40
  "lib/diamond-lang/helpers/block.rb",
@@ -0,0 +1 @@
1
+ summon FallingSand ~0 ~1 ~0 {Block:"redstone_block",Time:1,Data:0,Passengers:[{Block:"activator_rail",Time:1,Data:0,Passengers:[{Command:"gamerule commandBlockOutput false",id:"MinecartCommandBlock"},{Command:"fill ~2 ~2 ~0 ~8 ~7 ~5 stained_hardened_clay 13 hollow",id:"MinecartCommandBlock"},{Command:"title @a subtitle {\"text\":\"command by Ben from bensites.com\"}",id:"MinecartCommandBlock"},{Command:"title @a title {\"text\":\"Conveyor Belts\"}",id:"MinecartCommandBlock"},{Command:"setblock ~3 ~3 ~1 repeating_command_block 5 replace {Command:\"execute @e ~0 ~0 ~0 detect ~0 ~0 ~0 carpet 15 execute @e[r=0,c=1] ~0 ~0 ~0 detect ~0 ~-1 ~0 piston 2 tp @e[r=0,c=1] ~ ~ ~-.2\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~4 ~3 ~1 chain_command_block 5 replace {Command:\"execute @e ~0 ~0 ~0 detect ~0 ~0 ~0 carpet 15 execute @e[r=0,c=1] ~0 ~0 ~0 detect ~0 ~-1 ~0 piston 3 tp @e[r=0,c=1] ~ ~ ~.2\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~5 ~3 ~1 chain_command_block 5 replace {Command:\"execute @e ~0 ~0 ~0 detect ~0 ~0 ~0 carpet 15 execute @e[r=0,c=1] ~0 ~0 ~0 detect ~0 ~-1 ~0 piston 4 tp @e[r=0,c=1] ~-.2 ~ ~\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~6 ~3 ~1 chain_command_block 1 replace {Command:\"execute @e ~0 ~0 ~0 detect ~0 ~0 ~0 carpet 15 execute @e[r=0,c=1] ~0 ~0 ~0 detect ~0 ~-1 ~0 piston 5 tp @e[r=0,c=1] ~.2 ~ ~\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~ ~ ~1 command_block 0 replace {Command:fill ~ ~-1 ~-1 ~ ~ ~ air}",id:"MinecartCommandBlock"},{Command:"setblock ~ ~-1 ~1 redstone_block",id:"MinecartCommandBlock"},{Command:"kill @e[r=1,type=MinecartCommandBlock]",id:"MinecartCommandBlock"}],id:"FallingSand"}]}
@@ -3,7 +3,7 @@ require 'diamond-lang'
3
3
  class CustomCrafting < DiamondLang::OneCommand
4
4
  def setup(c)
5
5
  c.title s(:a), :subtitle, {"text " => "command by Ben from bensites.com"}.to_json
6
- c.title s(:a), :title, {"text " => "Custom"}.to_json
6
+ c.title s(:a), :title, {"text " => "Custom Crafting"}.to_json
7
7
  add_crafting([
8
8
  {
9
9
  pattern: " s"+
@@ -12,9 +12,9 @@ class CustomCrafting < DiamondLang::OneCommand
12
12
  result: " "+
13
13
  " n "+
14
14
  " ",
15
- n: "id:\"minecraft:name_tag\",Count:1b",
16
- s: "id:\"minecraft:string\",Count:1b",
17
- p: "id:\"minecraft:paper\",Count:1b"
15
+ n: 'id:"minecraft:name_tag",Count:1b',
16
+ s: 'id:"minecraft:string",Count:1b',
17
+ p: 'id:"minecraft:paper",Count:1b'
18
18
  },
19
19
  {
20
20
  pattern: "bbb"+
@@ -22,9 +22,9 @@ class CustomCrafting < DiamondLang::OneCommand
22
22
  "bbb",
23
23
  result: " "+
24
24
  " s ",
25
- b: "id:\"minecraft:iron_bars\",Count:1b",
26
- p: "id:\"minecraft:porkchop\",Count:64b",
27
- s: "id:\"minecraft:mob_spawner\",Count:1b"
25
+ b: 'id:"minecraft:iron_bars",Count:1b',
26
+ p: 'id:"minecraft:porkchop",Count:64b',
27
+ s: 'id:"minecraft:mob_spawner",Count:1b'
28
28
  }
29
29
  ])
30
30
  end
@@ -0,0 +1 @@
1
+ summon FallingSand ~0 ~1 ~0 {Block:"redstone_block",Time:1,Data:0,Passengers:[{Block:"activator_rail",Time:1,Data:0,Passengers:[{Command:"gamerule commandBlockOutput false",id:"MinecartCommandBlock"},{Command:"fill ~2 ~2 ~0 ~8 ~7 ~5 stained_hardened_clay 13 hollow",id:"MinecartCommandBlock"},{Command:"title @a subtitle {\"text\":\"command by Ben from bensites.com\"}",id:"MinecartCommandBlock"},{Command:"title @a title {\"text\":\"Custom Crafting\"}",id:"MinecartCommandBlock"},{Command:"scoreboard objectives add ask_table dummy Asked to Create A Table",id:"MinecartCommandBlock"},{Command:"scoreboard objectives add craft_table trigger Creating a Crafting Table",id:"MinecartCommandBlock"},{Command:"scoreboard objectives add on_table trigger Players on a crafting table",id:"MinecartCommandBlock"},{Command:"scoreboard objectives add ct_has_block dummy Crafting Table with block?",id:"MinecartCommandBlock"},{Command:"scoreboard objectives add craft_success dummy Crafting Success:",id:"MinecartCommandBlock"},{Command:"setblock ~3 ~3 ~1 repeating_command_block 5 replace {Command:\"call\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~4 ~3 ~1 chain_command_block 5 replace {Command:\"scoreboard players enable @a on_table\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~5 ~3 ~1 chain_command_block 5 replace {Command:\"execute @a ~0 ~0 ~0 detect ~0 ~-1 ~0 crafting_table 0 execute @p ~0 ~0 ~0 detect ~-1 ~-1 ~0 crafting_table 0 execute @p ~0 ~0 ~0 detect ~1 ~-1 ~0 crafting_table 0 execute @p ~0 ~0 ~0 detect ~1 ~-1 ~1 stone 0 execute @p ~0 ~0 ~0 detect ~1 ~-1 ~-1 stone 0 execute @p ~0 ~0 ~0 detect ~-1 ~-1 ~-1 stone 0 execute @p ~0 ~0 ~0 detect ~-1 ~-1 ~1 stone 0 execute @p ~0 ~0 ~0 detect ~0 ~-1 ~1 crafting_table 0 execute @p ~0 ~0 ~0 detect ~0 ~-1 ~-1 crafting_table 0 trigger on_table set 1\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~6 ~3 ~1 chain_command_block 5 replace {Command:\"scoreboard players set @a[score_on_table=0] ask_table 0\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~7 ~3 ~1 chain_command_block 3 replace {Command:\"scoreboard players enable @a[score_on_table_min=1,score_ask_table=0] craft_table\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~3 ~3 ~2 chain_command_block 3 replace {Command:\"tellraw @a[score_craft_table_min=1,score_on_table_min=1,c=1] {\\\"text\\\":\\\"Now building a \\\",\\\"extra\\\":[{\\\"text\\\":\\\"Crafting Table\\\",\\\"color\\\":\\\"yellow\\\"},{\\\"text\\\":\\\". Please hold still for a moment...\\\"}]}\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~4 ~3 ~2 chain_command_block 4 replace {Command:\"scoreboard players set @a[score_on_table_min=1,score_ask_table=0] ask_table 1\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~5 ~3 ~2 chain_command_block 4 replace {Command:\"scoreboard players set @a[score_craft_table_min=1,score_on_table=0] craft_table 0\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~6 ~3 ~2 chain_command_block 4 replace {Command:\"tellraw @a[score_craft_table_min=1,score_on_table=0] {\\\"text\\\":\\\"Please stand on the \\\",\\\"extra\\\":[{\\\"text\\\":\\\"Crafting Table Pattern\\\",\\\"color\\\":\\\"yellow\\\"},{\\\"text\\\":\\\" in order to build the \\\"},{\\\"text\\\":\\\"Crafting Table\\\",\\\"color\\\":\\\"yellow\\\"},{\\\"text\\\":\\\".\\\"}]}\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~7 ~3 ~2 chain_command_block 4 replace {Command:\"tellraw @a[score_on_table_min=1,score_ask_table=0] {\\\"text\\\":\\\"Build a \\\",\\\"extra\\\":[{\\\"text\\\":\\\"Crafting Table\\\",\\\"color\\\":\\\"yellow\\\",\\\"underlined\\\":true,\\\"clickEvent\\\":{\\\"action\\\":\\\"run_command\\\",\\\"value\\\":\\\"/trigger craft_table set 1\\\"}},{\\\"text\\\":\\\"?\\\"}]}\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~3 ~3 ~3 chain_command_block 5 replace {Command:\"testfor @a[score_craft_table_min=1,score_on_table_min=1,c=1]\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~4 ~3 ~3 chain_command_block 13 replace {Command:\"summon ArmorStand ~0 ~0 ~0 {CustomName:\\\"CraftingCreator\\\",Invisible:1b,Invulnerable:1b,PersistenceRequired:1b,NoGravity:1b,Small:1b}\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~5 ~3 ~3 chain_command_block 5 replace {Command:\"tp @e[name=CraftingCreator,type=ArmorStand] @a[score_craft_table_min=1,score_on_table_min=1,c=1]\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~6 ~3 ~3 chain_command_block 5 replace {Command:\"tp @e[name=CraftingCreator,type=ArmorStand] ~ ~-1 ~\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~7 ~3 ~3 chain_command_block 3 replace {Command:\"execute @e[name=CraftingCreator,type=ArmorStand] ~0 ~0 ~0 fill ~-1 ~ ~-1 ~1 ~ ~1 air 0 replace\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~3 ~3 ~4 chain_command_block 1 replace {Command:\"scoreboard players set @a on_table 0\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~4 ~3 ~4 chain_command_block 4 replace {Command:\"scoreboard players reset @a[score_craft_table_min=1,score_on_table_min=1,c=1] craft_table\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~5 ~3 ~4 chain_command_block 4 replace {Command:\"execute @e[name=CraftingCreator,type=ArmorStand] ~0 ~0 ~0 summon ItemFrame ~ ~ ~1 {Facing:4,Item:{id:\\\"crafting_table\\\"}}\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~6 ~3 ~4 chain_command_block 4 replace {Command:\"execute @e[name=CraftingCreator,type=ArmorStand] ~0 ~0 ~0 summon ItemFrame ~ ~ ~-1 {Facing:2,Item:{id:\\\"crafting_table\\\"}}\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~7 ~3 ~4 chain_command_block 4 replace {Command:\"execute @e[name=CraftingCreator,type=ArmorStand] ~0 ~0 ~0 setblock ~0 ~0 ~0 dropper 0 replace {CustomName:Crafting Table}\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~3 ~4 ~2 chain_command_block 5 replace {Command:\"stats entity @e[name=CraftingTable,type=ArmorStand] set SuccessCount @e[r=0,c=1] craft_success\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~4 ~4 ~2 chain_command_block 5 replace {Command:\"execute @e[name=CraftingTable,type=ArmorStand] ~0 ~0 ~0 testforblock ~0 ~0 ~0 dropper 0 {Items:[{id:\\\"minecraft:iron_bars\\\",Count:1b,Slot:0b},{id:\\\"minecraft:iron_bars\\\",Count:1b,Slot:1b},{id:\\\"minecraft:iron_bars\\\",Count:1b,Slot:2b},{id:\\\"minecraft:iron_bars\\\",Count:1b,Slot:3b},{id:\\\"minecraft:porkchop\\\",Count:64b,Slot:4b},{id:\\\"minecraft:iron_bars\\\",Count:1b,Slot:5b},{id:\\\"minecraft:iron_bars\\\",Count:1b,Slot:6b},{id:\\\"minecraft:iron_bars\\\",Count:1b,Slot:7b},{id:\\\"minecraft:iron_bars\\\",Count:1b,Slot:8b}],CustomName:\\\"Crafting Table\\\"}\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~5 ~4 ~2 chain_command_block 5 replace {Command:\"execute @e[name=CraftingTable,type=ArmorStand,score_craft_success_min=1] ~0 ~0 ~0 blockdata ~0 ~0 ~0 {Items:[{id:\\\"minecraft:mob_spawner\\\",Count:1b,Slot:4b}],CustomName:\\\"Crafting Table\\\"}\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~6 ~4 ~2 chain_command_block 5 replace {Command:\"stats entity @e[name=CraftingTable,type=ArmorStand] clear SuccessCount\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~7 ~4 ~2 chain_command_block 1 replace {Command:\"entitydata @e[name=CraftingCreator,type=ArmorStand] {CustomName:CraftingTable}\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~3 ~4 ~3 chain_command_block 2 replace {Command:\"scoreboard players set @e[name=CraftingTable,type=ArmorStand] craft_success 0\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~4 ~4 ~3 chain_command_block 4 replace {Command:\"stats entity @e[name=CraftingTable,type=ArmorStand] clear SuccessCount\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~5 ~4 ~3 chain_command_block 4 replace {Command:\"execute @e[name=CraftingTable,type=ArmorStand,score_craft_success_min=1] ~0 ~0 ~0 blockdata ~0 ~0 ~0 {Items:[{id:\\\"minecraft:name_tag\\\",Count:1b,Slot:4b}],CustomName:\\\"Crafting Table\\\"}\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~6 ~4 ~3 chain_command_block 4 replace {Command:\"execute @e[name=CraftingTable,type=ArmorStand] ~0 ~0 ~0 testforblock ~0 ~0 ~0 dropper 0 {Items:[{id:\\\"minecraft:string\\\",Count:1b,Slot:2b},{id:\\\"minecraft:paper\\\",Count:1b,Slot:4b},{id:\\\"minecraft:paper\\\",Count:1b,Slot:6b}],CustomName:\\\"Crafting Table\\\"}\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~7 ~4 ~3 chain_command_block 4 replace {Command:\"stats entity @e[name=CraftingTable,type=ArmorStand] set SuccessCount @e[r=0,c=1] craft_success\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~3 ~4 ~4 chain_command_block 5 replace {Command:\"scoreboard players set @e[name=CraftingTable,type=ArmorStand] ct_has_block 0\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~4 ~4 ~4 chain_command_block 5 replace {Command:\"execute @e[name=CraftingTable,type=ArmorStand] ~0 ~0 ~0 detect ~0 ~0 ~0 dropper 0 scoreboard players set @e[name=CraftingTable,type=ArmorStand,c=1,r=0] ct_has_block 1\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~5 ~4 ~4 chain_command_block 5 replace {Command:\"execute @e[name=CraftingTable,type=ArmorStand,score_ct_has_block=0] ~0 ~0 ~0 tellraw @a[r=5] {\\\"text\\\":\\\"You destroyed the \\\",\\\"extra\\\":[{\\\"text\\\":\\\"Crafting Table\\\",\\\"color\\\":\\\"yellow\\\"},{\\\"text\\\":\\\".\\\"}]}\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~6 ~4 ~4 chain_command_block 5 replace {Command:\"kill @e[name=CraftingTable,type=ArmorStand,score_ct_has_block=0]\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~7 ~4 ~4 chain_command_block 2 replace {Command:\"scoreboard players set @e[name=CraftingTable,type=ArmorStand] craft_success 0\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~ ~ ~1 command_block 0 replace {Command:fill ~ ~-1 ~-1 ~ ~ ~ air}",id:"MinecartCommandBlock"},{Command:"setblock ~ ~-1 ~1 redstone_block",id:"MinecartCommandBlock"},{Command:"kill @e[r=1,type=MinecartCommandBlock]",id:"MinecartCommandBlock"}],id:"FallingSand"}]}
@@ -1,61 +1,3 @@
1
- =begin
2
- /summon FallingSand ~ ~1 ~
3
- {
4
- Block:stone,
5
- Time:1, Passengers:[
6
- {
7
- id:FallingSand,
8
- Block:redstone_block,
9
- Time:1,
10
- Passengers:[
11
- {
12
- id:FallingSand,
13
- Block:activator_rail,
14
- Time:1,
15
- Passengers:[
16
- {
17
- id:MinecartCommandBlock,
18
- Command: gamerule commandBlockOutput false
19
- },
20
- {
21
- id:MinecartCommandBlock,
22
- Command: "fill ~2 ~-3 ~-1 ~4 ~-1 ~1 stained_hardened_clay 13 hollow"
23
- },
24
- {
25
- id:MinecartCommandBlock,
26
- Command:"fill ~2 ~-2 ~-1 ~4 ~-2 ~1 stained_glass 12 replace stained_hardened_clay"
27
- },
28
- {
29
- id:MinecartCommandBlock,
30
- Command:"scoreboard objectives add IqWApo_I dummy"
31
- },
32
- {
33
- id:MinecartCommandBlock,
34
- Command:setblock ~3 ~-2 ~ repeating_command_block 5 replace {
35
- auto:1,Command:"say Hello World"
36
- }
37
- },
38
- {
39
- id:MinecartCommandBlock,
40
- Command:setblock ~ ~ ~1 command_block 0 replace {
41
- Command:fill ~ ~-3 ~-1 ~ ~ ~ air
42
- }
43
- },
44
- {
45
- id:MinecartCommandBlock,
46
- Command:setblock ~ ~-1 ~1 redstone_block
47
- },
48
- {
49
- id:MinecartCommandBlock,
50
- Command:kill @e[type=MinecartCommandBlock,r=1]
51
- }
52
- ]
53
- }
54
- ]
55
- }
56
- ]
57
- }
58
- =end
59
1
  require 'diamond-lang'
60
2
 
61
3
  class HelloWorld < DiamondLang::OneCommand
@@ -0,0 +1 @@
1
+ summon FallingSand ~0 ~1 ~0 {Block:"redstone_block",Time:1,Data:0,Passengers:[{Block:"activator_rail",Time:1,Data:0,Passengers:[{Command:"gamerule commandBlockOutput false",id:"MinecartCommandBlock"},{Command:"fill ~2 ~2 ~0 ~8 ~7 ~5 stained_hardened_clay 13 hollow",id:"MinecartCommandBlock"},{Command:"say Hello World",id:"MinecartCommandBlock"},{Command:"setblock ~3 ~3 ~1 repeating_command_block 5 replace {Command:\"say Hello World! I can count to 10:\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~4 ~3 ~1 chain_command_block 5 replace {Command:\"say 1\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~5 ~3 ~1 chain_command_block 5 replace {Command:\"say 2\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~6 ~3 ~1 chain_command_block 5 replace {Command:\"say 3\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~7 ~3 ~1 chain_command_block 3 replace {Command:\"say 4\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~3 ~3 ~2 chain_command_block 3 replace {Command:\"say 9\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~4 ~3 ~2 chain_command_block 4 replace {Command:\"say 8\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~5 ~3 ~2 chain_command_block 4 replace {Command:\"say 7\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~6 ~3 ~2 chain_command_block 4 replace {Command:\"say 6\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~7 ~3 ~2 chain_command_block 4 replace {Command:\"say 5\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~3 ~3 ~3 chain_command_block 1 replace {Command:\"say 10\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~ ~ ~1 command_block 0 replace {Command:fill ~ ~-1 ~-1 ~ ~ ~ air}",id:"MinecartCommandBlock"},{Command:"setblock ~ ~-1 ~1 redstone_block",id:"MinecartCommandBlock"},{Command:"kill @e[r=1,type=MinecartCommandBlock]",id:"MinecartCommandBlock"}],id:"FallingSand"}]}
@@ -0,0 +1,32 @@
1
+ require 'diamond-lang'
2
+
3
+ class CustomCrafting < DiamondLang::OneCommand
4
+ def setup(c)
5
+ c.title s(:a), :subtitle, {"text " => "command by Ben from bensites.com"}.to_json
6
+ c.title s(:a), :title, {"text " => "Jetpack"}.to_json
7
+ @jetpack = 'id:"minecraft:elytra",Count:1b,tag:{display:{Name:Jetpack,Lore:[A jetpack that,lets you fly!]}}'
8
+ add_crafting([
9
+ {
10
+ pattern: "rrr"+
11
+ "rer"+
12
+ "fff",
13
+ result: " "+
14
+ " j "+
15
+ " ",
16
+ r: 'id:"minecraft:redstone",Count:1b',
17
+ e: 'id:"minecraft:elytra",Count:1b',
18
+ f: 'id:"minecraft:fire_charge",Count:1b',
19
+ j: @jetpack
20
+ }
21
+ ])
22
+ c.scoreboard :objectives, :add, :jetpack, :dummy, "Is holding a jetpack."
23
+ end
24
+
25
+ def tick(c)
26
+ c.scoreboard :players, :set, s(:a), :jetpack, 0
27
+ c.scoreboard :players, :set, s(:a), :jetpack, 1, "{SelectedItem:{#{@jetpack}}}"
28
+ c.effect s(:a, {score_jetpack_min: 1}), "minecraft:levitation", 1, 10
29
+ end
30
+ end
31
+
32
+ CustomCrafting.create
@@ -0,0 +1 @@
1
+ summon FallingSand ~0 ~1 ~0 {Block:"redstone_block",Time:1,Data:0,Passengers:[{Block:"activator_rail",Time:1,Data:0,Passengers:[{Command:"gamerule commandBlockOutput false",id:"MinecartCommandBlock"},{Command:"fill ~2 ~2 ~0 ~8 ~7 ~5 stained_hardened_clay 13 hollow",id:"MinecartCommandBlock"},{Command:"title @a subtitle {\"text\":\"command by Ben from bensites.com\"}",id:"MinecartCommandBlock"},{Command:"title @a title {\"text\":\"Jetpack\"}",id:"MinecartCommandBlock"},{Command:"scoreboard objectives add jetpack dummy Is holding a jetpack.",id:"MinecartCommandBlock"},{Command:"scoreboard objectives add ask_table dummy Asked to Create A Table",id:"MinecartCommandBlock"},{Command:"scoreboard objectives add craft_table trigger Creating a Crafting Table",id:"MinecartCommandBlock"},{Command:"scoreboard objectives add on_table trigger Players on a crafting table",id:"MinecartCommandBlock"},{Command:"scoreboard objectives add ct_has_block dummy Crafting Table with block?",id:"MinecartCommandBlock"},{Command:"scoreboard objectives add craft_success dummy Crafting Success:",id:"MinecartCommandBlock"},{Command:"setblock ~3 ~3 ~1 repeating_command_block 5 replace {Command:\"call\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~4 ~3 ~1 chain_command_block 5 replace {Command:\"scoreboard players enable @a on_table\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~5 ~3 ~1 chain_command_block 5 replace {Command:\"execute @a ~0 ~0 ~0 detect ~0 ~-1 ~0 crafting_table 0 execute @p ~0 ~0 ~0 detect ~-1 ~-1 ~0 crafting_table 0 execute @p ~0 ~0 ~0 detect ~1 ~-1 ~0 crafting_table 0 execute @p ~0 ~0 ~0 detect ~1 ~-1 ~1 stone 0 execute @p ~0 ~0 ~0 detect ~1 ~-1 ~-1 stone 0 execute @p ~0 ~0 ~0 detect ~-1 ~-1 ~-1 stone 0 execute @p ~0 ~0 ~0 detect ~-1 ~-1 ~1 stone 0 execute @p ~0 ~0 ~0 detect ~0 ~-1 ~1 crafting_table 0 execute @p ~0 ~0 ~0 detect ~0 ~-1 ~-1 crafting_table 0 trigger on_table set 1\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~6 ~3 ~1 chain_command_block 5 replace {Command:\"scoreboard players set @a[score_on_table=0] ask_table 0\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~7 ~3 ~1 chain_command_block 3 replace {Command:\"scoreboard players enable @a[score_on_table_min=1,score_ask_table=0] craft_table\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~3 ~3 ~2 chain_command_block 3 replace {Command:\"tellraw @a[score_craft_table_min=1,score_on_table_min=1,c=1] {\\\"text\\\":\\\"Now building a \\\",\\\"extra\\\":[{\\\"text\\\":\\\"Crafting Table\\\",\\\"color\\\":\\\"yellow\\\"},{\\\"text\\\":\\\". Please hold still for a moment...\\\"}]}\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~4 ~3 ~2 chain_command_block 4 replace {Command:\"scoreboard players set @a[score_on_table_min=1,score_ask_table=0] ask_table 1\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~5 ~3 ~2 chain_command_block 4 replace {Command:\"scoreboard players set @a[score_craft_table_min=1,score_on_table=0] craft_table 0\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~6 ~3 ~2 chain_command_block 4 replace {Command:\"tellraw @a[score_craft_table_min=1,score_on_table=0] {\\\"text\\\":\\\"Please stand on the \\\",\\\"extra\\\":[{\\\"text\\\":\\\"Crafting Table Pattern\\\",\\\"color\\\":\\\"yellow\\\"},{\\\"text\\\":\\\" in order to build the \\\"},{\\\"text\\\":\\\"Crafting Table\\\",\\\"color\\\":\\\"yellow\\\"},{\\\"text\\\":\\\".\\\"}]}\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~7 ~3 ~2 chain_command_block 4 replace {Command:\"tellraw @a[score_on_table_min=1,score_ask_table=0] {\\\"text\\\":\\\"Build a \\\",\\\"extra\\\":[{\\\"text\\\":\\\"Crafting Table\\\",\\\"color\\\":\\\"yellow\\\",\\\"underlined\\\":true,\\\"clickEvent\\\":{\\\"action\\\":\\\"run_command\\\",\\\"value\\\":\\\"/trigger craft_table set 1\\\"}},{\\\"text\\\":\\\"?\\\"}]}\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~3 ~3 ~3 chain_command_block 5 replace {Command:\"testfor @a[score_craft_table_min=1,score_on_table_min=1,c=1]\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~4 ~3 ~3 chain_command_block 13 replace {Command:\"summon ArmorStand ~0 ~0 ~0 {CustomName:\\\"CraftingCreator\\\",Invisible:1b,Invulnerable:1b,PersistenceRequired:1b,NoGravity:1b,Small:1b}\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~5 ~3 ~3 chain_command_block 5 replace {Command:\"tp @e[name=CraftingCreator,type=ArmorStand] @a[score_craft_table_min=1,score_on_table_min=1,c=1]\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~6 ~3 ~3 chain_command_block 5 replace {Command:\"tp @e[name=CraftingCreator,type=ArmorStand] ~ ~-1 ~\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~7 ~3 ~3 chain_command_block 3 replace {Command:\"execute @e[name=CraftingCreator,type=ArmorStand] ~0 ~0 ~0 fill ~-1 ~ ~-1 ~1 ~ ~1 air 0 replace\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~3 ~3 ~4 chain_command_block 1 replace {Command:\"scoreboard players set @a on_table 0\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~4 ~3 ~4 chain_command_block 4 replace {Command:\"scoreboard players reset @a[score_craft_table_min=1,score_on_table_min=1,c=1] craft_table\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~5 ~3 ~4 chain_command_block 4 replace {Command:\"execute @e[name=CraftingCreator,type=ArmorStand] ~0 ~0 ~0 summon ItemFrame ~ ~ ~1 {Facing:4,Item:{id:\\\"crafting_table\\\"}}\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~6 ~3 ~4 chain_command_block 4 replace {Command:\"execute @e[name=CraftingCreator,type=ArmorStand] ~0 ~0 ~0 summon ItemFrame ~ ~ ~-1 {Facing:2,Item:{id:\\\"crafting_table\\\"}}\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~7 ~3 ~4 chain_command_block 4 replace {Command:\"execute @e[name=CraftingCreator,type=ArmorStand] ~0 ~0 ~0 setblock ~0 ~0 ~0 dropper 0 replace {CustomName:Crafting Table}\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~3 ~4 ~2 chain_command_block 5 replace {Command:\"scoreboard players set @a jetpack 0\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~4 ~4 ~2 chain_command_block 5 replace {Command:\"scoreboard players set @a jetpack 1 {SelectedItem:{id:\\\"minecraft:elytra\\\",Count:1b,tag:{display:{Name:Jetpack,Lore:[A jetpack that,lets you fly!]}}}}\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~5 ~4 ~2 chain_command_block 1 replace {Command:\"effect @a[score_jetpack_min=1] minecraft:levitation 1 10\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~3 ~4 ~3 chain_command_block 2 replace {Command:\"entitydata @e[name=CraftingCreator,type=ArmorStand] {CustomName:CraftingTable}\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~4 ~4 ~3 chain_command_block 4 replace {Command:\"stats entity @e[name=CraftingTable,type=ArmorStand] clear SuccessCount\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~5 ~4 ~3 chain_command_block 4 replace {Command:\"execute @e[name=CraftingTable,type=ArmorStand,score_craft_success_min=1] ~0 ~0 ~0 blockdata ~0 ~0 ~0 {Items:[{id:\\\"minecraft:elytra\\\",Count:1b,tag:{display:{Name:Jetpack,Lore:[A jetpack that,lets you fly!]}},Slot:4b}],CustomName:\\\"Crafting Table\\\"}\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~6 ~4 ~3 chain_command_block 4 replace {Command:\"execute @e[name=CraftingTable,type=ArmorStand] ~0 ~0 ~0 testforblock ~0 ~0 ~0 dropper 0 {Items:[{id:\\\"minecraft:redstone\\\",Count:1b,Slot:0b},{id:\\\"minecraft:redstone\\\",Count:1b,Slot:1b},{id:\\\"minecraft:redstone\\\",Count:1b,Slot:2b},{id:\\\"minecraft:redstone\\\",Count:1b,Slot:3b},{id:\\\"minecraft:elytra\\\",Count:1b,Slot:4b},{id:\\\"minecraft:redstone\\\",Count:1b,Slot:5b},{id:\\\"minecraft:fire_charge\\\",Count:1b,Slot:6b},{id:\\\"minecraft:fire_charge\\\",Count:1b,Slot:7b},{id:\\\"minecraft:fire_charge\\\",Count:1b,Slot:8b}],CustomName:\\\"Crafting Table\\\"}\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~7 ~4 ~3 chain_command_block 4 replace {Command:\"stats entity @e[name=CraftingTable,type=ArmorStand] set SuccessCount @e[r=0,c=1] craft_success\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~3 ~4 ~4 chain_command_block 5 replace {Command:\"scoreboard players set @e[name=CraftingTable,type=ArmorStand] ct_has_block 0\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~4 ~4 ~4 chain_command_block 5 replace {Command:\"execute @e[name=CraftingTable,type=ArmorStand] ~0 ~0 ~0 detect ~0 ~0 ~0 dropper 0 scoreboard players set @e[name=CraftingTable,type=ArmorStand,c=1,r=0] ct_has_block 1\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~5 ~4 ~4 chain_command_block 5 replace {Command:\"execute @e[name=CraftingTable,type=ArmorStand,score_ct_has_block=0] ~0 ~0 ~0 tellraw @a[r=5] {\\\"text\\\":\\\"You destroyed the \\\",\\\"extra\\\":[{\\\"text\\\":\\\"Crafting Table\\\",\\\"color\\\":\\\"yellow\\\"},{\\\"text\\\":\\\".\\\"}]}\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~6 ~4 ~4 chain_command_block 5 replace {Command:\"kill @e[name=CraftingTable,type=ArmorStand,score_ct_has_block=0]\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~7 ~4 ~4 chain_command_block 2 replace {Command:\"scoreboard players set @e[name=CraftingTable,type=ArmorStand] craft_success 0\",auto:true}",id:"MinecartCommandBlock"},{Command:"setblock ~ ~ ~1 command_block 0 replace {Command:fill ~ ~-1 ~-1 ~ ~ ~ air}",id:"MinecartCommandBlock"},{Command:"setblock ~ ~-1 ~1 redstone_block",id:"MinecartCommandBlock"},{Command:"kill @e[r=1,type=MinecartCommandBlock]",id:"MinecartCommandBlock"}],id:"FallingSand"}]}
@@ -36,7 +36,7 @@ module DiamondLang
36
36
  c.scoreboard :objectives, :add, :craft_success, :dummy, "Crafting Success:"
37
37
  end
38
38
  def tick(c)
39
- #Blocks
39
+ c.()
40
40
  crafting_table = b('crafting_table')
41
41
  stone = b('stone')
42
42
 
@@ -50,7 +50,7 @@ module DiamondLang
50
50
  :execute, sp, relative, :detect, coords('~1', '~-1', '~1'), stone,
51
51
  :execute, sp, relative, :detect, coords('~1', '~-1', '~-1'), stone,
52
52
  :execute, sp, relative, :detect, coords('~-1', '~-1', '~-1'), stone,
53
- :execute, sp, relative, :detect, coords('~-1', '~-1', '~-1'), stone,
53
+ :execute, sp, relative, :detect, coords('~-1', '~-1', '~1'), stone,
54
54
  :execute, sp, relative, :detect, coords('~', '~-1', '~1'), crafting_table,
55
55
  :execute, sp, relative, :detect, coords('~', '~-1', '~-1'), crafting_table,
56
56
  :trigger, :on_table, :set, 1
@@ -76,11 +76,21 @@ module DiamondLang
76
76
  }
77
77
  ]}.to_json
78
78
 
79
+ invalid_players = s(:a, {score_craft_table_min: 1, score_on_table: 0})
80
+
81
+ c.tellraw invalid_players, {text: "Please stand on the ", extra: [
82
+ {text: "Crafting Table Pattern", color: "yellow"},
83
+ {text: " in order to build the "},
84
+ {text: "Crafting Table", color: "yellow"},
85
+ {text: "."}
86
+ ]}.to_json
87
+ c.scoreboard :players, :set, invalid_players, :craft_table, 0
88
+
79
89
  #Mark all players who have been asked
80
90
  c.scoreboard :players, :set, ask_players, :ask_table, 1
81
91
 
82
92
  #Get a player that is crafting a table
83
- player = s(:a, {score_craft_table_min: 1})
93
+ player = s(:a, {score_craft_table_min: 1, score_on_table_min: 1, c: 1})
84
94
 
85
95
  #Tell the player that it is now building the crafting table
86
96
  c.tellraw player, {text: "Now building a ", extra: [
@@ -88,11 +98,8 @@ module DiamondLang
88
98
  {text: ". Please hold still for a moment..."}
89
99
  ]}.to_json
90
100
 
91
- player << {c: 1}
92
-
93
- #Create the armorstand
94
101
  c.testfor player do |c|
95
- c.summon 'ArmorStand', relative, "{CustomName:CraftingCreator,Invisible:true}"
102
+ c.summon 'ArmorStand', relative, "{CustomName:\"CraftingCreator\",Invisible:1b,Invulnerable:1b,PersistenceRequired:1b,NoGravity:1b,Small:1b}"
96
103
  end
97
104
 
98
105
  #Teleport the armorstand one block below the player
@@ -110,16 +117,25 @@ module DiamondLang
110
117
 
111
118
  #Reset scores for creating crafting table
112
119
  c.scoreboard :players, :reset, player, :craft_table
120
+
113
121
  c.scoreboard :players, :set, s(:a), :on_table, 0
114
122
 
115
123
  #Find Stale Crafting Tables
116
124
  crafting_tables = s(:e, {name: "CraftingTable", type: "ArmorStand"})
117
125
  c.scoreboard :players, :set, crafting_tables, :ct_has_block, 0
118
126
  c.execute crafting_tables, relative, :detect, relative, b("dropper"),
119
- :scoreboard, :players, :set, s_self, :ct_has_block, 1
120
-
121
- #Kill Stale Crafting Tables
122
- c.kill s(:e, {score_ct_has_block: 0})
127
+ :scoreboard, :players, :set, s(:e, {name: "CraftingTable", type: "ArmorStand", c: 1, r: 0}), :ct_has_block, 1
128
+
129
+ stale_crafting_tables = s(:e, {name: "CraftingTable", type: "ArmorStand", score_ct_has_block: 0})
130
+ c.execute stale_crafting_tables, relative, :tellraw, s(:a, {r: 5}), {
131
+ text: "You destroyed the ", extra: [
132
+ {text: "Crafting Table", color: "yellow"},
133
+ {text: "."}
134
+ ]
135
+ }.to_json
136
+ c.kill stale_crafting_tables
137
+
138
+ #Add Recipes
123
139
  @crafting_recipes.map do |recipe|
124
140
  blockItems, resultItems = [recipe[:pattern], recipe[:result]].map do |str|
125
141
  str.split('').each_with_index.map do |letter, i|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diamond-lang
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben (@penne12_)
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-01 00:00:00.000000000 Z
11
+ date: 2016-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: require_all
@@ -154,8 +154,13 @@ files:
154
154
  - VERSION
155
155
  - diamond-lang.gemspec
156
156
  - examples/conveyor.rb
157
+ - examples/conveyor.txt
157
158
  - examples/custom_crafting.rb
159
+ - examples/custom_crafting.txt
158
160
  - examples/hello_world.rb
161
+ - examples/hello_world.txt
162
+ - examples/jetpack.rb
163
+ - examples/jetpack.txt
159
164
  - lib/diamond-lang.rb
160
165
  - lib/diamond-lang/command_chain.rb
161
166
  - lib/diamond-lang/helpers/block.rb