function addTab(name: string, skin: skin, players: players, uuid: string = "") :: string: set {_packet} to new play_server_player_info packet set "PlayerInfoAction" penum 0 of {_packet} to "ADD_PLAYER" set {_a::gamemode} to creative set {_a::gameprofile::name} to {_name} set {_a::gameprofile::skin} to {_skin} set {_a::latency} to 0 set {_uuid} to ({_uuid} === "" ? new uuid : {_uuid}) set {_a::gameprofile::uuid} to {_uuid} set "PlayerInfoData" array pjson 0 of {_packet} to json of listvar {_a::*} loop {_players::*}: send loop-value packet {_packet} return {_uuid} function skin(i: int = 0) :: skin: return skin with value "eyJ0aW1lc3RhbXAiOjE0OTkwMDg3MTU3MzQsInByb2ZpbGVJZCI6IjQzNTg3MjhkZGQ1NDQ5NDM4ZGYwZWRlMTkzODJmYmQ2IiwicHJvZmlsZU5hbWUiOiJ1bW1vYmVhciIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7Im1ldGFkYXRhIjp7Im1vZGVsIjoic2xpbSJ9LCJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2FiYmYxZmY5YTdjMmIwMTRmMzI2YWQxZDg0ZDZmNzlkZThkYWYzNjk1NzIxOTg4MTNlZmI1Yzc2MDcxZTM2MCJ9fX0=" signature "YAzwJkE8Px8LPWmrNJBRH7QZbf2TlxuxfIzlJEiLM2pb19Hp6/osKO97Enxz1fdNFpFQ4nda/Q6IaOI5M0vj6zPjF1X+JEf5LVobYeuiLQsbP1i7EURegYH8fcQr4rZhWcSS3L3VzlXKxR3XqHEeWA0Cq/73k8NTlS4uh9syGTx44uqprZHKTH+Tj865mSkVF9J4E4AQx71m+jadBSAVVTmfAqTauHFTFLOw7oSoPHCa8WkhsgCqmWxxQvSKJAgfVsHGFd5W20fAYCGuce7381TpYLpKQlGELcEsLs1wQO16tSWGe77/lQzXhfmsCC7nKPFhgIT5fiRNQ8VFGIztS4UMe661DUIEMUYrYIT4qh/bZfmFyj1tVR054I6InhEth6rQ0h/wT6/8iPW8VWNR1K4jxW/wmvCq5ssoLyjHmwg8rMyOYf0vryli4fP1iMv3Gv3CTtCtZDriYsFMPhCLd8pxekWpitkysviEn6szJZKNAwyGbdcy/KECG10UqKdppudix0KJ+Df6i0TG2dF1jYwjbywGgIlf7Z2+4gZbWb7sReQsaUsYbbjIikDfjwOfRjTJVNezfRJ7FIfwFPU2KAH6I9nIwdascvelzJL4eFf3rZMWo397AljTa6wYIyxr0iDMZQLeZBGfodLbF2SXNxMlC04ifY1f+Y6jEUNymIs==" function newUUID(i: int = 0) :: string: return "%a random integer between 10000000 and 99999999%-%a random integer between 1000 and 9999%-%a random integer between 1000 and 9999%-%a random integer between 1000 and 9999%-%a random integer between 100000000000 and 999999999999%" on packet event play_server_named_entity_spawn: set {metadata} to "DataWatcherModifier" pinfo 0 of event-packet function spawnNPC(name: string, skin: skin, location: location, players: players, item: itemtype, uuid: string = ""): set {_npcspawn} to new play_server_named_entity_spawn packet set int pnum 0 of {_npcspawn} to a random integer from 5000 to 10000 set "uuid" pinfo 0 of {_npcspawn} to ({_uuid} === "" ? addTab({_name}, {_skin}, {_players::*}) : addTab({_name}, {_skin}, {_players::*}, {_uuid})) set int pnum 1 of {_npcspawn} to x-loc of {_location} * 32 set int pnum 2 of {_npcspawn} to y-loc of {_location} * 32 set int pnum 3 of {_npcspawn} to z-loc of {_location} * 32 set byte pnum 0 of {_npcspawn} to 0 set byte pnum 1 of {_npcspawn} to 0 set "DataWatcherModifier" pinfo 0 of {_npcspawn} to {metadata} set short pnum 0 of {_npcspawn} to 1 loop {_players::*}: send loop-value packet {_npcspawn} function typeId(entity: string) :: object: #I have to use string here because the entitytype type is... weird, and not all of them match up with wiki.vg switch {_entity}: #everything is here except things marked as blue on wiki.vg case "Item": return 2 case "AreaEffectCloud": return 3 case "ElderGuardian": return 4 case "WitherSkeleton": return 5 case "Stray": return 6 case "ThrownEgg": return 62 case "LeashKnot": return 77 case "Arrow": return 60 case "Snowball": return 61 case "Fireball": return 63 case "SmallFireball": return 64 case "ThrownEnderpearl": return 14 case "EyeOfEnderSignal": return 72 case "ThrownPotion": return 73 case "ThrownExpBottle": return 75 case "ItemFrame": return 71 case "WitherSkull": return 66 case "PrimedTnt": return 50 case "FallingSand": return 70 case "FireworksRocketEntity": return 76 case "Husk": return 23 case "SpectralArrow": return 91 case "ShulkerBullet": return 67 case "DragonFireball": return 93 case "ZombieVillager": return 27 case "SkeletonHorse": return 28 case "ZombieHorse": return 29 case "ArmorStand": return 30 #careful, this will crash your game if you don't send it right case "Donkey": return 31 case "Mule": return 32 case "EvocationFangs": return 79 case "EvocationIllager": return 34 case "Vex": return 35 case "VindicationIllager": return 36 case "IllusionIllager": return 37 case "MinecartCommandBlock": return 10 case "Boat": return 1 case "MinecartRideable": return 10 case "MinecartChest": return 10 case "MinecartTNT": return 10 case "MinecartHopper": return 10 case "MinecartSpawner": return 10 case "Creeper": return 50 case "Skeleton": return 51 case "Spider": return 52 case "Giant": return 53 case "Zombie": return 54 case "Slime": return 55 case "Ghast": return 56 case "PigZombie": return 57 case "Enderman": return 58 case "CaveSpider": return 59 case "Silverfish": return 60 case "Blaze": return 61 case "LavaSlime": return 62 case "EnderDragon": return 63 case "WitherBoss": return 64 case "Bat": return 65 case "Witch": return 66 case "Endermite": return 67 case "Guardian": return 68 case "Shulker": return 69 case "Pig": return 90 case "Sheep": return 91 case "Cow": return 92 case "Chicken": return 93 case "Squid": return 94 case "Wolf": return 95 case "MushroomCow": return 96 case "SnowMan": return 97 case "Ozelot": return 98 case "VillagerGolem": return 99 case "Horse": return 100 case "EntityHorse": return 100 case "Rabbit": return 101 case "PolarBear": return 102 case "Llama": return 103 case "LlamaSpit": return 68 case "Parrot": return 105 case "Villager": return 120 case "EnderCrystal": return 51 return false function spawnClientMob(entity: string, location: location, viewers: players, entityid: int = 69420) :: object: if typeId({_entity}) is false: #if the given entity isn't in the typeId() function, stop the function by returning false so that the calling code can detect there was an issue if it chooses to return false set {_packet} to new play_server_spawn_entity_living packet if {_entityid} is 69420: #if a custom id wasn't specified set int pnum 0 of {_packet} to a random integer from 50000 to 100000 #set the entity id to a number that won't realitically ever cause problems else: #if a custom id WAS specified set int pnum 0 of {_packet} to {_entityid} #set the entity id to the given id set int pnum 1 of {_packet} to "%typeId({_entity})%" parsed as a number #get the type id used to identify the given mob in packets, has to be parsed as a number because the function returns object #set the coordinates set int pnum 2 of {_packet} to {_location}'s x-loc * 32 set int pnum 3 of {_packet} to {_location}'s y-loc * 32 set int pnum 4 of {_packet} to {_location}'s z-loc * 32 #set the pitch/yaw loop 5 and 6: set int pnum loop-value of {_packet} to 0 #set the velocity loop 7, 8 and 9 : set int pnum loop-value of {_packet} to 0 #send all the players that should see the mob the packet loop {_viewers::*}: send loop-value packet {_packet} return "%int pnum 0 of {_packet}%" parsed as an int #if we've gotten this far, return the entity id in case the calling code needs to use it to manipulate the spawned mob function clientBlock(location: location, type: item, viewers: players): set {_packet} to new play_server_block_change packet set location pinfo 0 of {_packet} to {_location} set "BlockData" pinfo 0 of {_packet} to {_type} # as seen on packetwrapper, this uses the blockdata pinfo loop {_viewers::*}: #show peeps the new block send loop-value packet {_packet} function returnItem(i: item) :: item: return {_i}