Entity updates and json fix

This commit is contained in:
JavaProphet 2017-01-23 09:03:55 -08:00
parent eed6f37bb3
commit d8aa2d4d0e
3 changed files with 254 additions and 165 deletions

View File

@ -13,165 +13,250 @@
#include <stdlib.h>
#include "world.h"
/*
#define ENT_PLAYER 0
#define ENT_ITEM 1
#define ENT_XP_ORB 2
#define ENT_AREA_EFFECT_CLOUD 3
#define ENT_ELDER_GUARDIAN 4
#define ENT_WITHER_SKELETON 5
#define ENT_STRAY 6
#define ENT_EGG 7
#define ENT_LEASH_KNOT 8
#define ENT_PAINTING 9
#define ENT_ARROW 10
#define ENT_SNOWBALL 11
#define ENT_FIREBALL 12
#define ENT_SMALL_FIREBALL 13
#define ENT_ENDER_PEARL 14
#define ENT_EYE_OF_ENDER_SIGNAL 15
#define ENT_POTION 16
#define ENT_XP_BOTTLE 17
#define ENT_ITEM_FRAME 18
#define ENT_WITHER_SKULL 19
#define ENT_TNT 20
#define ENT_FALLING_BLOCK 21
#define ENT_FIREWORKS_ROCKET 22
#define ENT_HUSK 23
#define ENT_SPECTRAL_ARROW 24
#define ENT_SHULKER_BULLET 25
#define ENT_DRAGON_FIREBALL 26
#define ENT_ZOMBIE_VILLAGER 27
#define ENT_SKELETON_HORSE 28
#define ENT_ZOMBIE_HORSE 29
#define ENT_ARMOR_STAND 30
#define ENT_DONKEY 31
#define ENT_MULE 32
#define ENT_EVOCATION_FANGS 33
#define ENT_EVOCATION_ILLAGER 34
#define ENT_VEX 35
#define ENT_VINDICATION_ILLAGER 36
#define ENT_COMMANDBLOCK_MINECART 40
#define ENT_BOAT 41
#define ENT_MINECART 42
#define ENT_CHEST_MINECART 43
#define ENT_FURNACE_MINECART 44
#define ENT_TNT_MINECART 45
#define ENT_HOPPER_MINECART 46
#define ENT_SPAWNER_MINECART 47
#define ENT_CREEPER 50
#define ENT_SKELETON 51
#define ENT_SPIDER 52
#define ENT_GIANT 53
#define ENT_ZOMBIE 54
#define ENT_SLIME 55
#define ENT_GHAST 56
#define ENT_ZOMBIE_PIGMAN 57
#define ENT_ENDERMAN 58
#define ENT_CAVE_SPIDER 59
#define ENT_SILVERFISH 60
#define ENT_BLAZE 61
#define ENT_MAGMA_CUBE 62
#define ENT_ENDER_DRAGON 63
#define ENT_WITHER 64
#define ENT_BAT 65
#define ENT_WITCH 66
#define ENT_ENDERMITE 67
#define ENT_GUARDIAN 68
#define ENT_SHULKER 69
#define ENT_PIG 90
#define ENT_SHEEP 91
#define ENT_COW 92
#define ENT_CHICKEN 93
#define ENT_SQUID 94
#define ENT_WOLF 95
#define ENT_MOOSHROOM 96
#define ENT_SNOWMAN 97
#define ENT_OCELOT 98
#define ENT_VILLAGER_GOLEM 99
#define ENT_HORSE 100
#define ENT_RABBIT 101
#define ENT_POLAR_BEAR 102
#define ENT_LLAMA 103
#define ENT_LLAMA_SPIT 104
#define ENT_VILLAGER 120
#define ENT_ENDER_CRYSTAL 200
*/
#define ENT_UNDEFINED 1
#define ENT_PLAYER 2
#define ENT_CREEPER 3
#define ENT_SKELETON 4
#define ENT_SPIDER 5
#define ENT_GIANT 6
#define ENT_ZOMBIE 7
#define ENT_SLIME 8
#define ENT_GHAST 9
#define ENT_ZPIGMAN 10
#define ENT_ENDERMAN 11
#define ENT_CAVESPIDER 12
#define ENT_SILVERFISH 13
#define ENT_BLAZE 14
#define ENT_MAGMACUBE 15
#define ENT_ENDERDRAGON 16
#define ENT_WITHER 17
#define ENT_BAT 18
#define ENT_WITCH 19
#define ENT_ENDERMITE 20
#define ENT_GUARDIAN 21
#define ENT_SHULKER 22
#define ENT_PIG 23
#define ENT_SHEEP 24
#define ENT_COW 25
#define ENT_CHICKEN 26
#define ENT_SQUID 27
#define ENT_WOLF 28
#define ENT_MOOSHROOM 29
#define ENT_SNOWMAN 30
#define ENT_OCELOT 31
#define ENT_IRONGOLEM 32
#define ENT_HORSE 33
#define ENT_RABBIT 34
#define ENT_VILLAGER 35
#define ENT_BOAT 36
#define ENT_ITEMSTACK 37
#define ENT_AREAEFFECT 38
#define ENT_MINECART 39
#define ENT_TNT 40
#define ENT_ENDERCRYSTAL 41
#define ENT_ARROW 42
#define ENT_SNOWBALL 43
#define ENT_EGG 44
#define ENT_FIREBALL 45
#define ENT_FIRECHARGE 46
#define ENT_ENDERPEARL 47
#define ENT_WITHERSKULL 48
#define ENT_SHULKERBULLET 49
#define ENT_FALLINGBLOCK 50
#define ENT_ITEMFRAME 51
#define ENT_EYEENDER 52
#define ENT_THROWNPOTION 53
#define ENT_HUSK 54
#define ENT_EXPBOTTLE 55
#define ENT_FIREWORK 56
#define ENT_LEASHKNOT 57
#define ENT_ARMORSTAND 58
#define ENT_FISHINGFLOAT 59
#define ENT_EVOCATIONFANGS 60
#define ENT_ELDERGUARDIAN 61
#define ENT_DRAGONFIREBALL 62
#define ENT_EXPERIENCEORB 63
#define ENT_POLARBEAR 64
#define ENT_LLAMA 65
#define ENT_LLAMASPIT 66
#define ENT_STRAY 67
#define ENT_PAINTING 68
#define ENT_EVOCATIONILLAGER 69
#define ENT_VEX 70
#define ENT_VINDICATIONILLAGER 71
#define ENT_PLAYER 0
#define ENT_ITEM 1
#define ENT_XPORB 2
#define ENT_AREAEFFECTCLOUD 3
#define ENT_ELDERGUARDIAN 4
#define ENT_WITHERSKELETON 5
#define ENT_STRAY 6
#define ENT_THROWNEGG 7
#define ENT_LEASHKNOT 8
#define ENT_PAINTING 9
#define ENT_ARROW 10
#define ENT_SNOWBALL 11
#define ENT_FIREBALL 12
#define ENT_SMALLFIREBALL 13
#define ENT_THROWNENDERPEARL 14
#define ENT_EYEOFENDERSIGNAL 15
#define ENT_THROWNPOTION 16
#define ENT_THROWNEXPBOTTLE 17
#define ENT_ITEMFRAME 18
#define ENT_WITHERSKULL 19
#define ENT_PRIMEDTNT 20
#define ENT_FALLINGSAND 21
#define ENT_FIREWORKSROCKETENTITY 22
#define ENT_HUSK 23
#define ENT_SPECTRALARROW 24
#define ENT_SHULKERBULLET 25
#define ENT_DRAGONFIREBALL 26
#define ENT_ZOMBIEVILLAGER 27
#define ENT_SKELETONHORSE 28
#define ENT_ZOMBIEHORSE 29
#define ENT_ARMORSTAND 30
#define ENT_DONKEY 31
#define ENT_MULE 32
#define ENT_EVOCATIONFANGS 33
#define ENT_EVOCATIONILLAGER 34
#define ENT_VEX 35
#define ENT_VINDICATIONILLAGER 36
#define ENT_MINECARTCOMMANDBLOCK 40
#define ENT_BOAT 41
#define ENT_MINECARTRIDEABLE 42
#define ENT_MINECARTCHEST 43
#define ENT_MINECARTFURNACE 44
#define ENT_MINECARTTNT 45
#define ENT_MINECARTHOPPER 46
#define ENT_MINECARTSPAWNER 47
#define ENT_CREEPER 50
#define ENT_SKELETON 51
#define ENT_SPIDER 52
#define ENT_GIANT 53
#define ENT_ZOMBIE 54
#define ENT_SLIME 55
#define ENT_GHAST 56
#define ENT_PIGZOMBIE 57
#define ENT_ENDERMAN 58
#define ENT_CAVESPIDER 59
#define ENT_SILVERFISH 60
#define ENT_BLAZE 61
#define ENT_LAVASLIME 62
#define ENT_ENDERDRAGON 63
#define ENT_WITHERBOSS 64
#define ENT_BAT 65
#define ENT_WITCH 66
#define ENT_ENDERMITE 67
#define ENT_GUARDIAN 68
#define ENT_SHULKER 69
#define ENT_PIG 90
#define ENT_SHEEP 91
#define ENT_COW 92
#define ENT_CHICKEN 93
#define ENT_SQUID 94
#define ENT_WOLF 95
#define ENT_MUSHROOMCOW 96
#define ENT_SNOWMAN 97
#define ENT_OZELOT 98
#define ENT_VILLAGERGOLEM 99
#define ENT_HORSE 100
#define ENT_RABBIT 101
#define ENT_POLARBEAR 102
#define ENT_LLAMA 103
#define ENT_LLAMASPIT 104
#define ENT_VILLAGER 120
#define ENT_ENDERCRYSTAL 200
#define ENT_ITEM 1
#define ENT_XPORB 2
#define ENT_AREAEFFECTCLOUD 3
#define ENT_ELDERGUARDIAN 4
#define ENT_WITHERSKELETON 5
#define ENT_STRAY 6
#define ENT_THROWNEGG 7
#define ENT_LEASHKNOT 8
#define ENT_PAINTING 9
#define ENT_ARROW 10
#define ENT_SNOWBALL 11
#define ENT_FIREBALL 12
#define ENT_SMALLFIREBALL 13
#define ENT_THROWNENDERPEARL 14
#define ENT_EYEOFENDERSIGNAL 15
#define ENT_THROWNPOTION 16
#define ENT_THROWNEXPBOTTLE 17
#define ENT_ITEMFRAME 18
#define ENT_WITHERSKULL 19
#define ENT_PRIMEDTNT 20
#define ENT_FALLINGSAND 21
#define ENT_FIREWORKSROCKETENTITY 22
#define ENT_HUSK 23
#define ENT_SPECTRALARROW 24
#define ENT_SHULKERBULLET 25
#define ENT_DRAGONFIREBALL 26
#define ENT_ZOMBIEVILLAGER 27
#define ENT_SKELETONHORSE 28
#define ENT_ZOMBIEHORSE 29
#define ENT_ARMORSTAND 30
#define ENT_DONKEY 31
#define ENT_MULE 32
#define ENT_EVOCATIONFANGS 33
#define ENT_EVOCATIONILLAGER 34
#define ENT_VEX 35
#define ENT_VINDICATIONILLAGER 36
#define ENT_MINECARTCOMMANDBLOCK 40
#define ENT_BOAT 41
#define ENT_MINECARTRIDEABLE 42
#define ENT_MINECARTCHEST 43
#define ENT_MINECARTFURNACE 44
#define ENT_MINECARTTNT 45
#define ENT_MINECARTHOPPER 46
#define ENT_MINECARTSPAWNER 47
#define ENT_CREEPER 50
#define ENT_SKELETON 51
#define ENT_SPIDER 52
#define ENT_GIANT 53
#define ENT_ZOMBIE 54
#define ENT_SLIME 55
#define ENT_GHAST 56
#define ENT_PIGZOMBIE 57
#define ENT_ENDERMAN 58
#define ENT_CAVESPIDER 59
#define ENT_SILVERFISH 60
#define ENT_BLAZE 61
#define ENT_LAVASLIME 62
#define ENT_ENDERDRAGON 63
#define ENT_WITHERBOSS 64
#define ENT_BAT 65
#define ENT_WITCH 66
#define ENT_ENDERMITE 67
#define ENT_GUARDIAN 68
#define ENT_SHULKER 69
#define ENT_PIG 90
#define ENT_SHEEP 91
#define ENT_COW 92
#define ENT_CHICKEN 93
#define ENT_SQUID 94
#define ENT_WOLF 95
#define ENT_MUSHROOMCOW 96
#define ENT_SNOWMAN 97
#define ENT_OZELOT 98
#define ENT_VILLAGERGOLEM 99
#define ENT_HORSE 100
#define ENT_RABBIT 101
#define ENT_POLARBEAR 102
#define ENT_LLAMA 103
#define ENT_LLAMASPIT 104
#define ENT_VILLAGER 120
#define ENT_ENDERCRYSTAL 200
#define ENT_ITEM 1
#define ENT_XPORB 2
#define ENT_AREAEFFECTCLOUD 3
#define ENT_ELDERGUARDIAN 4
#define ENT_WITHERSKELETON 5
#define ENT_STRAY 6
#define ENT_THROWNEGG 7
#define ENT_LEASHKNOT 8
#define ENT_PAINTING 9
#define ENT_ARROW 10
#define ENT_SNOWBALL 11
#define ENT_FIREBALL 12
#define ENT_SMALLFIREBALL 13
#define ENT_THROWNENDERPEARL 14
#define ENT_EYEOFENDERSIGNAL 15
#define ENT_THROWNPOTION 16
#define ENT_THROWNEXPBOTTLE 17
#define ENT_ITEMFRAME 18
#define ENT_WITHERSKULL 19
#define ENT_PRIMEDTNT 20
#define ENT_FALLINGSAND 21
#define ENT_FIREWORKSROCKETENTITY 22
#define ENT_HUSK 23
#define ENT_SPECTRALARROW 24
#define ENT_SHULKERBULLET 25
#define ENT_DRAGONFIREBALL 26
#define ENT_ZOMBIEVILLAGER 27
#define ENT_SKELETONHORSE 28
#define ENT_ZOMBIEHORSE 29
#define ENT_ARMORSTAND 30
#define ENT_DONKEY 31
#define ENT_MULE 32
#define ENT_EVOCATIONFANGS 33
#define ENT_EVOCATIONILLAGER 34
#define ENT_VEX 35
#define ENT_VINDICATIONILLAGER 36
#define ENT_MINECARTCOMMANDBLOCK 40
#define ENT_BOAT 41
#define ENT_MINECARTRIDEABLE 42
#define ENT_MINECARTCHEST 43
#define ENT_MINECARTFURNACE 44
#define ENT_MINECARTTNT 45
#define ENT_MINECARTHOPPER 46
#define ENT_MINECARTSPAWNER 47
#define ENT_CREEPER 50
#define ENT_SKELETON 51
#define ENT_SPIDER 52
#define ENT_GIANT 53
#define ENT_ZOMBIE 54
#define ENT_SLIME 55
#define ENT_GHAST 56
#define ENT_PIGZOMBIE 57
#define ENT_ENDERMAN 58
#define ENT_CAVESPIDER 59
#define ENT_SILVERFISH 60
#define ENT_BLAZE 61
#define ENT_LAVASLIME 62
#define ENT_ENDERDRAGON 63
#define ENT_WITHERBOSS 64
#define ENT_BAT 65
#define ENT_WITCH 66
#define ENT_ENDERMITE 67
#define ENT_GUARDIAN 68
#define ENT_SHULKER 69
#define ENT_PIG 90
#define ENT_SHEEP 91
#define ENT_COW 92
#define ENT_CHICKEN 93
#define ENT_SQUID 94
#define ENT_WOLF 95
#define ENT_MUSHROOMCOW 96
#define ENT_SNOWMAN 97
#define ENT_OZELOT 98
#define ENT_VILLAGERGOLEM 99
#define ENT_HORSE 100
#define ENT_RABBIT 101
#define ENT_POLARBEAR 102
#define ENT_LLAMA 103
#define ENT_LLAMASPIT 104
#define ENT_VILLAGER 120
#define ENT_ENDERCRYSTAL 200
int entNetworkConvert(int type, int id);
int networkEntConvert(int type, int id);

View File

@ -23,6 +23,10 @@ char* __readJSONString(char* json, size_t* i) {
} else if (cs == 1) {
if (json[*i] == '\"') {
errno = 0;
if (ret == NULL) {
ret = smalloc(1);
rs = 0;
}
ret[rs] = 0;
return ret;
} else if (json[*i] == '\\') {

View File

@ -922,7 +922,7 @@ int light_floodfill(struct world* world, struct chunk* chunk, struct world_light
uint8_t pl = getRawLightWorld_guess(world, chunk, lp->x, lp->y, lp->z, !skylight);
if (pl == maxl) return sslf;
setLightWorld_guess(world, chunk, maxl, lp->x, lp->y, lp->z, !skylight);
if (ks) return sslf;
if (ks) return 1;
if (subtract ? (maxl < 15) : (maxl > 0)) {
if (subtract ? xpl > maxl : xpl < maxl) {
@ -1138,11 +1138,11 @@ void setBlockWorld_guess(struct world* world, struct chunk* chunk, block blk, in
lp.y = y;
lp.z = z;
light_floodfill(world, chunk, &lp, 0, bi->lightEmission, nup); // todo remove nup duplicates
/*BEGIN_HASHMAP_ITERATION (nup)
struct world_lightpos* nlp = value;
light_floodfill(world, chunk, nlp, 0, 0, 0);
xfree (value);
END_HASHMAP_ITERATION (nup)*/
BEGIN_HASHMAP_ITERATION (nup)
struct world_lightpos* nlp = value;
light_floodfill(world, chunk, nlp, 0, 0, 0);
xfree (value);
END_HASHMAP_ITERATION (nup)
del_hashmap(nup);
//light_floodfill(world, chunk, &lp, 1, 0, 0);
/*for (int32_t lx = x - 16; lx <= x + 16; lx++) {