Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- global_target = l('L');
- global_test = 5;
- __on_player_attacks_entity(player, entity) -> (
- holds = query(player, 'holds', 'mainhand');
- if (holds,
- l(what, count, nbt) = holds;
- if (what == 'emerald' && nbt ~ 'Player Tracker' && query(entity, 'type') == 'player',
- //If the item in the player's hand is a compass named “Player Tracker” and
- //the entity is a player, then the entity becomes the player's global_target.
- replaceList(global_target,entity,0);
- print('Now tracking: '+global_target:0);
- //global_test = global_test + 1;
- //print('Now tracking: '+global_test);
- )
- )
- );
- replaceList(list, what, index) -> (
- put(list, index, what, 'replace');
- );
- __on_tick() -> (
- print(global_target:0);
- //11.25 degrees per texture
- tX = query(player(global_target), 'x');
- uX = query(player(),'x');
- tZ = query(player(global_target), 'z');
- uZ = query(player(),'z');
- uYaw = query(player(), 'yaw');
- //texture = (round(((uYaw - atan(abs((tX-uX)/(tZ-uZ))))-5.625)/11.25));
- //print('hi '+global_target);
- //print(texture);
- //variable texture will give the number of which texture should be displayed
- //i.e. if global_target is directly in front of tracker, texture 0 will be displayed
- //if global_target is directly behind tracker, texture 16 will be displayed
- slot = 0;
- for(l('mainhand', 'offhand'),
- holds = query(player(), 'holds', _);
- if (holds == 0,
- l(what, count, nbt) = holds;
- if (what == 'emerald',
- if (nbt ~ 'display:{Name:`{"text":"Player Tracker"}`}',
- inventory_set(player(), slot, count, what, '{CustomModelData:'+texture+'}');
- slot = slot - 1;
- )
- )
- )
- )
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement