luftballon.txt 1.4 KB

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