jantest5.txt 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. event.load("player_toss");
  2. event.load("entity_click");
  3. event.load("block_click");
  4. Fun_Block = "minecraft:red_wool";
  5. tag = text.concat("{BlockState:{Name:\"", Fun_Block, "\"},Time:1,Motion:[0.0,0.5,0.0],DropItem:1,HurtEntities:0}");
  6. @checkgame
  7. wait();
  8. if(perm.has(player, "isVIP") || perm.has(player, "isTeam")){
  9. ignoreGoto(event);
  10. }
  11. goto("checkgame");
  12. @player_toss
  13. if(item.getType(entity.getEquip(player, "hand")) == Fun_Block) {
  14. cancel = true;
  15. falling_block_entity = entity.spawn("falling_block", entity.getLocation(player), tag);
  16. throw(player, falling_block_entity);
  17. }
  18. goto("checkgame");
  19. @entity_click
  20. if(entity.getType(entity) == "falling_block"){
  21. throw(player, falling_block_entity);
  22. }
  23. goto("checkgame");
  24. @block_click
  25. if(block_type == Fun_Block){
  26. block.set(block_loc, "minecraft:air");
  27. falling_block_entity = entity.spawn("falling_block", block_loc, tag);
  28. }
  29. goto("checkgame");
  30. function throw(p, entity_to_throw){
  31. array = entity.getLook(p);
  32. array2 = entity.getMotion(p);
  33. x = array[0]*0.225 + array2[0]*0.25;
  34. y = math.abs(array[1]*0.75) + math.abs(array2[1])*0.5;
  35. z = array[2]*0.225 + array2[2]*0.25;
  36. entity.throw(entity_to_throw, x, y, z);
  37. }