luftballon.txt 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. event.load("entity_click");
  2. event.load("block_click");
  3. event.load("entity_join");
  4. Fun_Block = "minecraft:red_wool";
  5. Wool_loc = loc.new(games, -459, 164, -65);
  6. tag = text.concat("{BlockState:{Name:\"", Fun_Block, "\"},Time:1,Motion:[0.0,0.5,0.0],DropItem:1,HurtEntities:0}");
  7. msg("dev", "§bLuftballon §rloaded.");
  8. @Luftballon_loop
  9. msg("dev", event);
  10. wait();
  11. if(event == "block_click" ){
  12. if(inRegion(block_loc) && block_type == Fun_Block){
  13. block.set(block_loc, "minecraft:air");
  14. block_loc = loc.new(loc.getWorld(block_loc),loc.getX(block_loc)+0.5,loc.getY(block_loc),loc.getZ(block_loc)+0.5);
  15. falling_block_entity = entity.spawn("falling_block", block_loc, tag);
  16. }
  17. goto("Luftballon_loop");
  18. }
  19. if(event == "entity_click"){
  20. if(inRegion(entity.getLocation(entity)) && entity.getType(entity) == "falling_block"){
  21. throw(player, falling_block_entity);
  22. }
  23. goto("Luftballon_loop");
  24. }
  25. if(event == "entity_join"){
  26. e = entity.getType(entity);
  27. msg("dev",e);
  28. msg("dev", "ja");
  29. /*if(item.entity.get(entity) == "red_wool" && inRegion(entity.getLocation(entity))){
  30. cancel = true;
  31. block.set(Wool_loc, "minecraft:red_wool");
  32. }*/
  33. }
  34. goto("Luftballon_loop");
  35. function inRegion(temp_loc){
  36. temp_x = loc.getX(temp_loc);
  37. temp_y = loc.getY(temp_loc);
  38. temp_z = loc.getZ(temp_loc);
  39. if(-450 > temp_x && temp_x > -467 && 162 < temp_y && temp_y < 173 && -59 > temp_z && temp_z > -70){
  40. return(true);
  41. }
  42. return(false);
  43. }
  44. function throw(p, entity_to_throw){
  45. array = entity.getLook(p);
  46. x = array[0]*0.225 + math.random(0,0.25) - math.random(0,0.25);
  47. y = math.abs(array[1])*0.25 + math.random(0.75,0.95) + 0.5;
  48. z = array[2]*0.225 + math.random(0,0.25) - math.random(0,0.25);
  49. entity.throw(entity_to_throw, x, y, z);
  50. }