12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- event.load("player_toss");
- event.load("entity_click");
- event.load("block_click");
- Fun_Block = "minecraft:red_wool";
- tag = text.concat("{BlockState:{Name:\"", Fun_Block, "\"},Time:1,Motion:[0.0,0.5,0.0],DropItem:1,HurtEntities:0}");
- @checkgame
- wait();
- if(perm.has(player, "isVIP") || perm.has(player, "isTeam")){
- ignoreGoto(event);
- }
- goto("checkgame");
- @player_toss
- if(item.getType(entity.getEquip(player, "hand")) == Fun_Block) {
- cancel = true;
- falling_block_entity = entity.spawn("falling_block", entity.getLocation(player), tag);
- throw(player, falling_block_entity);
- }
- goto("checkgame");
- @entity_click
- if(entity.getType(entity) == "falling_block"){
- throw(player, falling_block_entity);
- }
- goto("checkgame");
- @block_click
- if(block_type == Fun_Block){
- block.set(block_loc, "minecraft:air");
- falling_block_entity = entity.spawn("falling_block", block_loc, tag);
- }
- goto("checkgame");
- function throw(p, entity_to_throw){
- array = entity.getLook(p);
- array2 = entity.getMotion(p);
- x = array[0]*0.225 + array2[0]*0.25;
- y = math.abs(array[1]*0.75) + math.abs(array2[1])*0.5;
- z = array[2]*0.225 + array2[2]*0.25;
- entity.throw(entity_to_throw, x, y, z);
- }
|