worldedit.txt 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588
  1. list.new("items");
  2. list.add($items, "portal");
  3. list.add($items, "carrots");
  4. list.add($items, "potatoes");
  5. list.add($items, "air");
  6. list.add($items, "water");
  7. list.add($items, "lava");
  8. list.add($items, "stone");
  9. list.add($items, "stone:1");
  10. list.add($items, "stone:2");
  11. list.add($items, "stone:3");
  12. list.add($items, "stone:4");
  13. list.add($items, "stone:5");
  14. list.add($items, "stone:6");
  15. list.add($items, "dirt");
  16. list.add($items, "dirt:1");
  17. list.add($items, "dirt:2");
  18. list.add($items, "cobblestone");
  19. list.add($items, "planks");
  20. list.add($items, "planks:1");
  21. list.add($items, "planks:2");
  22. list.add($items, "planks:3");
  23. list.add($items, "planks:4");
  24. list.add($items, "planks:5");
  25. list.add($items, "sapling");
  26. list.add($items, "sapling:1");
  27. list.add($items, "sapling:2");
  28. list.add($items, "sapling:3");
  29. list.add($items, "sapling:4");
  30. list.add($items, "sapling:5");
  31. list.add($items, "sand");
  32. list.add($items, "sand:1");
  33. list.add($items, "gravel");
  34. list.add($items, "gold_ore");
  35. list.add($items, "iron_ore");
  36. list.add($items, "log");
  37. list.add($items, "log:1");
  38. list.add($items, "log:2");
  39. list.add($items, "log:3");
  40. list.add($items, "log:4");
  41. list.add($items, "log:5");
  42. list.add($items, "leaves");
  43. list.add($items, "leaves:1");
  44. list.add($items, "leaves:2");
  45. list.add($items, "leaves:3");
  46. list.add($items, "sponge");
  47. list.add($items, "sponge:1");
  48. list.add($items, "glass");
  49. list.add($items, "lapis_block");
  50. list.add($items, "dispenser");
  51. list.add($items, "sandstone");
  52. list.add($items, "sandstone:1");
  53. list.add($items, "sandstone:2");
  54. list.add($items, "noteblock");
  55. list.add($items, "golden_rail");
  56. list.add($items, "detector_rail");
  57. list.add($items, "tallgrass:1");
  58. list.add($items, "tallgrass:2");
  59. list.add($items, "deadbush");
  60. list.add($items, "piston");
  61. list.add($items, "wool");
  62. list.add($items, "wool:1");
  63. list.add($items, "wool:2");
  64. list.add($items, "wool:3");
  65. list.add($items, "wool:4");
  66. list.add($items, "wool:6");
  67. list.add($items, "wool:7");
  68. list.add($items, "wool:9");
  69. list.add($items, "wool:10");
  70. list.add($items, "wool:11");
  71. list.add($items, "wool:12");
  72. list.add($items, "wool:13");
  73. list.add($items, "wool:14");
  74. list.add($items, "yellow_flower");
  75. list.add($items, "red_flower");
  76. list.add($items, "red_flower:1");
  77. list.add($items, "red_flower:2");
  78. list.add($items, "red_flower:3");
  79. list.add($items, "red_flower:4");
  80. list.add($items, "red_flower:5");
  81. list.add($items, "red_flower:6");
  82. list.add($items, "red_flower:7");
  83. list.add($items, "red_flower:8");
  84. list.add($items, "brown_mushroom");
  85. list.add($items, "red_mushroom");
  86. list.add($items, "gold_block");
  87. list.add($items, "iron_block");
  88. list.add($items, "stone_slab");
  89. list.add($items, "stone_slab:1");
  90. list.add($items, "stone_slab:3");
  91. list.add($items, "stone_slab:4");
  92. list.add($items, "stone_slab:5");
  93. list.add($items, "stone_slab:6");
  94. list.add($items, "stone_slab:7");
  95. list.add($items, "brick_block");
  96. list.add($items, "quartz_block");
  97. list.add($items, "quartz_block:1");
  98. list.add($items, "mossy_cobblestone");
  99. list.add($items, "obsidian");
  100. list.add($items, "torch");
  101. list.add($items, "oak_stairs");
  102. list.add($items, "chest");
  103. list.add($items, "diamond_block");
  104. list.add($items, "crafting_table");
  105. list.add($items, "furnace");
  106. list.add($items, "ladder");
  107. list.add($items, "rail");
  108. list.add($items, "stone_stairs");
  109. list.add($items, "lever");
  110. list.add($items, "stone_pressure_plate");
  111. list.add($items, "wooden_pressure_plate");
  112. list.add($items, "redstone_torch");
  113. list.add($items, "stone_button");
  114. list.add($items, "snow_layer");
  115. list.add($items, "snow");
  116. list.add($items, "cactus");
  117. list.add($items, "clay");
  118. list.add($items, "jukebox");
  119. list.add($items, "fence");
  120. list.add($items, "pumpkin");
  121. list.add($items, "lit_pumpkin");
  122. list.add($items, "stained_glass:1");
  123. list.add($items, "stained_glass:2");
  124. list.add($items, "stained_glass:3");
  125. list.add($items, "stained_glass:4");
  126. list.add($items, "stained_glass:6");
  127. list.add($items, "stained_glass:7");
  128. list.add($items, "stained_glass:9");
  129. list.add($items, "stained_glass:10");
  130. list.add($items, "stained_glass:11");
  131. list.add($items, "stained_glass:12");
  132. list.add($items, "stained_glass:13");
  133. list.add($items, "stained_glass:14");
  134. list.add($items, "trapdoor");
  135. list.add($items, "stonebrick");
  136. list.add($items, "stonebrick:1");
  137. list.add($items, "stonebrick:2");
  138. list.add($items, "iron_bars");
  139. list.add($items, "glass_pane");
  140. list.add($items, "melon_block");
  141. list.add($items, "vine");
  142. list.add($items, "fence_gate");
  143. list.add($items, "brick_stairs");
  144. list.add($items, "stone_brick_stairs");
  145. list.add($items, "waterlily");
  146. list.add($items, "double_wooden_slab:4");
  147. list.add($items, "double_wooden_slab:5");
  148. list.add($items, "wooden_slab");
  149. list.add($items, "wooden_slab:1");
  150. list.add($items, "wooden_slab:2");
  151. list.add($items, "wooden_slab:3");
  152. list.add($items, "wooden_slab:4");
  153. list.add($items, "wooden_slab:5");
  154. list.add($items, "sandstone_stairs");
  155. list.add($items, "tripwire_hook");
  156. list.add($items, "emerald_block");
  157. list.add($items, "spruce_stairs");
  158. list.add($items, "birch_stairs");
  159. list.add($items, "jungle_stairs");
  160. list.add($items, "cobblestone_wall");
  161. list.add($items, "cobblestone_wall:1");
  162. list.add($items, "wooden_button");
  163. list.add($items, "anvil");
  164. list.add($items, "anvil:1");
  165. list.add($items, "anvil:2");
  166. list.add($items, "trapped_chest");
  167. list.add($items, "light_weighted_pressure_plate");
  168. list.add($items, "heavy_weighted_pressure_plate");
  169. list.add($items, "redstone_block");
  170. list.add($items, "hopper");
  171. list.add($items, "activator_rail");
  172. list.add($items, "dropper");
  173. list.add($items, "stained_hardened_clay:1");
  174. list.add($items, "stained_hardened_clay:2");
  175. list.add($items, "stained_hardened_clay:3");
  176. list.add($items, "stained_hardened_clay:4");
  177. list.add($items, "stained_hardened_clay:6");
  178. list.add($items, "stained_hardened_clay:7");
  179. list.add($items, "stained_hardened_clay:9");
  180. list.add($items, "stained_hardened_clay:10");
  181. list.add($items, "stained_hardened_clay:11");
  182. list.add($items, "stained_hardened_clay:12");
  183. list.add($items, "stained_hardened_clay:13");
  184. list.add($items, "stained_hardened_clay:14");
  185. list.add($items, "stained_glass_pane:1");
  186. list.add($items, "stained_glass_pane:2");
  187. list.add($items, "stained_glass_pane:3");
  188. list.add($items, "stained_glass_pane:4");
  189. list.add($items, "stained_glass_pane:6");
  190. list.add($items, "stained_glass_pane:7");
  191. list.add($items, "stained_glass_pane:9");
  192. list.add($items, "stained_glass_pane:10");
  193. list.add($items, "stained_glass_pane:11");
  194. list.add($items, "stained_glass_pane:12");
  195. list.add($items, "stained_glass_pane:13");
  196. list.add($items, "stained_glass_pane:14");
  197. list.add($items, "leaves2");
  198. list.add($items, "leaves2:1");
  199. list.add($items, "log2");
  200. list.add($items, "log2:1");
  201. list.add($items, "acacia_stairs");
  202. list.add($items, "dark_oak_stairs");
  203. list.add($items, "iron_trapdoor");
  204. list.add($items, "carpet");
  205. list.add($items, "carpet:1");
  206. list.add($items, "carpet:2");
  207. list.add($items, "carpet:3");
  208. list.add($items, "carpet:4");
  209. list.add($items, "carpet:6");
  210. list.add($items, "carpet:7");
  211. list.add($items, "carpet:9");
  212. list.add($items, "carpet:10");
  213. list.add($items, "carpet:11");
  214. list.add($items, "carpet:12");
  215. list.add($items, "carpet:13");
  216. list.add($items, "carpet:14");
  217. list.add($items, "hardened_clay");
  218. list.add($items, "coal_block");
  219. list.add($items, "packed_ice");
  220. list.add($items, "double_plant");
  221. list.add($items, "double_plant:1");
  222. list.add($items, "double_plant:2");
  223. list.add($items, "double_plant:3");
  224. list.add($items, "double_plant:4");
  225. list.add($items, "double_plant:5");
  226. list.add($items, "end_stone");
  227. list.add($items, "red_sandstone");
  228. list.add($items, "red_sandstone:1");
  229. list.add($items, "red_sandstone:2");
  230. list.add($items, "red_sandstone_stairs");
  231. list.add($items, "stone_slab2");
  232. list.add($items, "spruce_fence_gate");
  233. list.add($items, "birch_fence_gate");
  234. list.add($items, "jungle_fence_gate");
  235. list.add($items, "dark_oak_fence_gate");
  236. list.add($items, "acacia_fence_gate");
  237. list.add($items, "spruce_fence");
  238. list.add($items, "birch_fence");
  239. list.add($items, "jungle_fence");
  240. list.add($items, "dark_oak_fence");
  241. list.add($items, "acacia_fence");
  242. list.add($items, "grass_path");
  243. list.add($items, "coal_ore");
  244. list.add($items, "diamond_ore");
  245. list.add($items, "iron_ore");
  246. list.add($items, "gold_ore");
  247. list.add($items, "string");
  248. list.add($items, "wheat");
  249. list.add($items, "painting");
  250. list.add($items, "wall_sign");
  251. list.add($items, "standing_sign");
  252. list.add($items, "wooden_door");
  253. list.add($items, "iron_door");
  254. list.add($items, "redstone_ore");
  255. list.add($items, "reeds");
  256. list.add($items, "bed");
  257. list.add($items, "repeater");
  258. list.add($items, "cauldron");
  259. list.add($items, "emerald_ore");
  260. list.add($items, "flower_pot");
  261. list.add($items, "banner:1");
  262. list.add($items, "banner:2");
  263. list.add($items, "banner:3");
  264. list.add($items, "banner:4");
  265. list.add($items, "banner:6");
  266. list.add($items, "banner:7");
  267. list.add($items, "banner:9");
  268. list.add($items, "banner:10");
  269. list.add($items, "banner:11");
  270. list.add($items, "banner:12");
  271. list.add($items, "banner:13");
  272. list.add($items, "banner:14");
  273. list.add($items, "spruce_door");
  274. list.add($items, "birch_door");
  275. list.add($items, "jungle_door");
  276. list.add($items, "acacia_door");
  277. list.add($items, "dark_oak_door");
  278. list.add($items, "beetroot");
  279. list.add($items, "beetroot_seeds");
  280. list.add($items, "beetroot_soup");
  281. list.add($items, "shield");
  282. list.new("undotype");
  283. list.new("undodata");
  284. list.new("undoloc");
  285. no_join = true;
  286. event.load("custom_command");
  287. event.load("block_click");
  288. event.load("block_break");
  289. event.load("player_leave");
  290. event.load("player_giveup");
  291. command.add("set");
  292. command.add("pos1");
  293. command.add("pos2");
  294. command.add("undo");
  295. command.add("replace");
  296. command.add("copy");
  297. command.add("paste");
  298. if(player == null) {
  299. term();
  300. }
  301. player.speak(player, "§dWorldedit", "§rDu hast nun Worldedit");
  302. @wait
  303. wait();
  304. if(event == "player_leave" || event == "player_giveup") {
  305. term();
  306. }
  307. if(event == "custom_command") {
  308. if(command == "pos1") {
  309. temploc = entity.getLocation(player);
  310. goto("setloc1");
  311. }
  312. if(command == "pos2") {
  313. temploc = entity.getLocation(player);
  314. goto("setloc2");
  315. }
  316. if(wepos1 == null || wepos2 == null) {
  317. player.speak(player, "§dWorldedit", "§rWähle zuerst einen Bereich aus!");
  318. goto("wait");
  319. }
  320. if(command == "undo") {
  321. p = player;
  322. i = -1;
  323. while(inc("i") < list.getSize(undotype)) {
  324. block.set(list.getIndex(undoloc, i), read.item(concat(list.getIndex(undotype, i), ":", text.number(list.getIndex(undodata, i)))));
  325. reset();
  326. }
  327. player.speak(p, "§dWorldedit", "§rÄnderungen rückgängig gemacht");
  328. goto("wait");
  329. }
  330. if(command == "copy") {
  331. world1 = loc.getCoord(wepos1, "w");
  332. world2 = loc.getCoord(wepos2, "w");
  333. if(world1 != world2) {
  334. player.speak(player, "§dWorldedit", "§rDie Welten der Koordinaten stimmen nicht überein!");
  335. goto("wait");
  336. }
  337. gosub("correctcoords");
  338. copystartloc1 = read.location(concat(world1, ":", x1, ":", y1, ":", z1));
  339. xcopyedgedistance = x2 - x1;
  340. ycopyedgedistance = y2 - y1;
  341. zcopyedgedistance = z2 - z1;
  342. playertoedgex = x1 - loc.getCoord(entity.getLocation(player), "bx");
  343. playertoedgey = y1 - loc.getCoord(entity.getLocation(player), "by");
  344. playertoedgez = z1 - loc.getCoord(entity.getLocation(player), "bz");
  345. player.speak(player, "§dWorldedit", "§rBereit zum Kopieren");
  346. goto("wait");
  347. }
  348. if(command == "paste") {
  349. p = player;
  350. counter = 0;
  351. list.clear(undotype);
  352. list.clear(undodata);
  353. list.clear(undoloc);
  354. pastestartloc1 = loc.mod(entity.getLocation(player), playertoedgex, playertoedgey, playertoedgez);
  355. x = 0;
  356. @startpaste_x
  357. y = 0;
  358. @startpaste_y
  359. z = 0;
  360. @startpaste_z
  361. relloc1 = loc.mod(copystartloc1, x, y, z);
  362. relloc2 = loc.mod(pastestartloc1, x, y, z);
  363. list.add(undotype, block.getType(relloc2));
  364. list.add(undodata, block.getData(relloc2));
  365. list.add(undoloc, relloc2);
  366. block.clone(relloc1, relloc2);
  367. if(inc("counter") == 1500) {
  368. gosub("waitfor");
  369. }
  370. reset();
  371. if(inc("z") <= zcopyedgedistance) {
  372. goto("startpaste_z");
  373. }
  374. if(inc("y") <= ycopyedgedistance) {
  375. goto("startpaste_y");
  376. }
  377. if(inc("x") <= xcopyedgedistance) {
  378. goto("startpaste_x");
  379. }
  380. player.speak(p, "§dWorldedit", "§rBlöcke kopiert");
  381. goto("wait");
  382. }
  383. if(command == "replace") {
  384. p = player;
  385. if(list.getSize(args) != 2) {
  386. player.speak(player, "§dWorldedit", "§r/replace <old> <new>");
  387. goto("wait");
  388. }
  389. if(invert(list.contains(items, toLowerCase(list.getIndex(args, 0)))) || invert(list.contains(items, toLowerCase(list.getIndex(args, 1))))) {
  390. player.speak(player, "§dWorldedit", "§rUngültiger Block");
  391. goto("wait");
  392. }
  393. item1 = read.item(toLowerCase(list.getIndex(args, 0)));
  394. item2 = read.item(toLowerCase(list.getIndex(args, 1)));
  395. world1 = loc.getCoord(wepos1, "w");
  396. world2 = loc.getCoord(wepos2, "w");
  397. if(world1 != world2) {
  398. player.speak(player, "§dWorldedit", "§rDie Welten der Koordinaten stimmen nicht überein!");
  399. goto("wait");
  400. }
  401. list.clear(undotype);
  402. list.clear(undodata);
  403. list.clear(undoloc);
  404. gosub("correctcoords");
  405. counter = 0;
  406. counter2 = 0;
  407. startloc1 = read.location(concat(world1, ":", x1, ":", y1, ":", z1));
  408. startloc2 = read.location(concat(world2, ":", x2, ":", y2, ":", z2));
  409. xedgedistance = x2 - x1;
  410. yedgedistance = y2 - y1;
  411. zedgedistance = z2 - z1;
  412. x = 0;
  413. @startreplace_x
  414. y = 0;
  415. @startreplace_y
  416. z = 0;
  417. @startreplace_z
  418. relloc = loc.mod(startloc1, x, y, z);
  419. if(block.getType(relloc) == item.getType(item1) && block.getData(relloc) == item.getData(item1)) {
  420. list.add(undotype, block.getType(relloc));
  421. list.add(undodata, block.getData(relloc));
  422. list.add(undoloc, relloc);
  423. block.set(relloc, item2);
  424. inc("counter2");
  425. }
  426. if(inc("counter") == 1500) {
  427. gosub("waitfor");
  428. }
  429. reset();
  430. if(inc("z") <= zedgedistance) {
  431. goto("startreplace_z");
  432. }
  433. if(inc("y") <= yedgedistance) {
  434. goto("startreplace_y");
  435. }
  436. if(inc("x") <= xedgedistance) {
  437. goto("startreplace_x");
  438. }
  439. player.speak(p, "§dWorldedit", "§r", counter2, " Blöcke ersetzt");
  440. goto("wait");
  441. }
  442. if(command == "set") {
  443. p = player;
  444. if(list.getSize(args) != 1) {
  445. player.speak(player, "§dWorldedit", "§r/set <block>");
  446. goto("wait");
  447. }
  448. if(list.contains(items, toLowerCase(list.getIndex(args, 0)))) {
  449. item = read.item(toLowerCase(list.getIndex(args, 0)));
  450. world1 = loc.getCoord(wepos1, "w");
  451. world2 = loc.getCoord(wepos2, "w");
  452. if(world1 != world2) {
  453. player.speak(player, "§dWorldedit", "§rDie Welten der Koordinaten stimmen nicht überein!");
  454. goto("wait");
  455. }
  456. list.clear(undotype);
  457. list.clear(undodata);
  458. list.clear(undoloc);
  459. gosub("correctcoords");
  460. counter = 0;
  461. startloc1 = read.location(concat(world1, ":", x1, ":", y1, ":", z1));
  462. startloc2 = read.location(concat(world2, ":", x2, ":", y2, ":", z2));
  463. xedgedistance = x2 - x1;
  464. yedgedistance = y2 - y1;
  465. zedgedistance = z2 - z1;
  466. x = 0;
  467. @startset_x
  468. y = 0;
  469. @startset_y
  470. z = 0;
  471. @startset_z
  472. relloc = loc.mod(startloc1, x, y, z);
  473. list.add(undotype, block.getType(relloc));
  474. list.add(undodata, block.getData(relloc));
  475. list.add(undoloc, relloc);
  476. block.set(relloc, item);
  477. if(inc("counter") == 1500) {
  478. gosub("waitfor");
  479. }
  480. reset();
  481. if(inc("z") <= zedgedistance) {
  482. goto("startset_z");
  483. }
  484. if(inc("y") <= yedgedistance) {
  485. goto("startset_y");
  486. }
  487. if(inc("x") <= xedgedistance) {
  488. goto("startset_x");
  489. }
  490. player.speak(p, "§dWorldedit", "§rBlöcke gesetzt");
  491. goto("wait");
  492. } else {
  493. player.speak(player, "§dWorldedit", "§rUnkorrekter Block-Type");
  494. goto("wait");
  495. }
  496. }
  497. }
  498. player_item_type = item.getType(entity.getEquip(player, "hand"));
  499. if(player_item_type != "minecraft:golden_axe") {
  500. goto("wait");
  501. }
  502. if(event == "block_break") {
  503. cancel = true;
  504. goto("wait");
  505. }
  506. if(event == "block_click") {
  507. if(action == "left") {
  508. temploc = block_loc;
  509. goto("setloc1");
  510. }
  511. if(action == "right") {
  512. temploc = block_loc;
  513. goto("setloc2");
  514. }
  515. }
  516. goto("wait");
  517. @setloc1
  518. wepos1 = temploc;
  519. player.speak(player, "§dWorldedit", "§dPos1: §r", text.location(temploc));
  520. removeVar("temploc");
  521. goto("wait");
  522. @setloc2
  523. wepos2 = temploc;
  524. player.speak(player, "§dWorldedit", "§dPos2: §r", temploc);
  525. removeVar("temploc");
  526. goto("wait");
  527. @waitfor
  528. waitfor(1);
  529. return();
  530. @correctcoords
  531. x1 = loc.getCoord(wepos1, "bx");
  532. y1 = loc.getCoord(wepos1, "by");
  533. z1 = loc.getCoord(wepos1, "bz");
  534. x2 = loc.getCoord(wepos2, "bx");
  535. y2 = loc.getCoord(wepos2, "by");
  536. z2 = loc.getCoord(wepos2, "bz");
  537. if(x1 > x2) {
  538. helper = x2;
  539. x2 = x1;
  540. x1 = helper;
  541. }
  542. if(y1 > y2) {
  543. helper = y2;
  544. y2 = y1;
  545. y1 = helper;
  546. }
  547. if(z1 > z2) {
  548. helper = z2;
  549. z2 = z1;
  550. z1 = helper;
  551. }
  552. removeVar("helper");
  553. return();