Пример #1
0
 static private bool initPlayerAPI(MCCSAPI api)
 {
     if (!playerApiInited)
     {
         if (api != null)
         {
             pgetHotbarContainer = api.ConvertComponentFunc <AGET>(PLAYER_GET_HOTBAR_CONTAINER);
             pgetUuid            = api.ConvertComponentFunc <AGET>(PLAYER_GET_UUID);
             pgetIPPort          = api.ConvertComponentFunc <AGET>(PLAYER_GET_IPPORT);
             paddLevel           = api.ConvertComponentFunc <PADDLEVEL>(PLAYER_ADD_LEVEL);
             pgetScoreboardId    = api.ConvertComponentFunc <PGETSCOREID>(PLAYER_GET_SCOREID);
             pcreateScoreboardId = api.ConvertComponentFunc <PGETSCOREID>(PLAYER_CREATE_SCOREID);
             pgetplFromAABB      = api.ConvertComponentFunc <AGETSFROMAABB>(LEVEL_GETPLFROM_AABB);
             if (api.COMMERCIAL)
             {   // 非社区内容
                 pgetServerStorageID = api.ConvertComponentFunc <AGET>(PLAYER_GET_STORAGEID);
             }
             playerApiInited = true;
         }
         else
         {
             return(false);
         }
     }
     return(true);
 }
Пример #2
0
 static protected bool initEntityAPI(MCCSAPI api)
 {
     if (!entityApiInited)
     {
         if (api != null)
         {
             egetArmorContainer     = api.ConvertComponentFunc <AGET>(ENTITY_GET_ARMOR_CONTAINER);
             egetAttack             = api.ConvertComponentFunc <AGET>(ENTITY_GET_ATTACK);
             esetAttack             = api.ConvertComponentFunc <ASET>(ENTITY_SET_ATTACK);
             egetCollisionBox       = api.ConvertComponentFunc <AGET>(ENTITY_GET_COLLISION_BOX);
             esetCollisionBox       = api.ConvertComponentFunc <ASET>(ENTITY_SET_COLLISION_BOX);
             egetHandContainer      = api.ConvertComponentFunc <AGET>(ENTITY_GET_HAND_CONTAINER);
             egetHealth             = api.ConvertComponentFunc <AGET>(ENTITY_GET_HEALTH);
             esetHealth             = api.ConvertComponentFunc <ASET>(ENTITY_SET_HEALTH);
             egetInventoryContainer = api.ConvertComponentFunc <AGET>(ENTITY_GET_INVENTORY_CONTAINER);
             egetName        = api.ConvertComponentFunc <AGET>(ENTITY_GET_NAME);
             esetName        = api.ConvertComponentFunc <ASETNAME>(ENTITY_SET_NAME);
             egetPosition    = api.ConvertComponentFunc <AGET>(ENTITY_GET_POSITION);
             esetPosition    = api.ConvertComponentFunc <ASET>(ENTITY_SET_POSITION);
             egetRotation    = api.ConvertComponentFunc <AGET>(ENTITY_GET_ROTATION);
             esetRotation    = api.ConvertComponentFunc <ASET>(ENTITY_SET_ROTATION);
             egetDimensionId = api.ConvertComponentFunc <AGETDIMENSIONID>(ENTITY_GET_DIMENSIONID);
             egetTypeId      = api.ConvertComponentFunc <AGETDIMENSIONID>(ENTITY_GET_TYPEID);
             egetUniqueId    = api.ConvertComponentFunc <AGETUNIQUEID>(ENTITY_GET_UNIQUEID);
             eremove         = api.ConvertComponentFunc <AREMOVE>(ENTITY_REMOVE);
             ehurt           = api.ConvertComponentFunc <AHURT>(ENTITY_HURT);
             if (api.COMMERCIAL)
             {   // 非社区内容
                 egetAbilities     = api.ConvertComponentFunc <AGET>(ENTITY_GET_ABILITIES);
                 esetAbilities     = api.ConvertComponentFunc <ASET>(ENTITY_SET_ABILITIES);
                 egetAttributes    = api.ConvertComponentFunc <AGET>(ENTITY_GET_ATTRIBUTES);
                 esetAttributes    = api.ConvertComponentFunc <ASET>(ENTITY_SET_ATTRIBUTES);
                 egetMaxAttributes = api.ConvertComponentFunc <AGET>(ENTITY_GET_MAXATTRIBUTES);
                 esetMaxAttributes = api.ConvertComponentFunc <ASET>(ENTITY_SET_MAXATTRIBUTES);
                 egetEffects       = api.ConvertComponentFunc <AGET>(ENTITY_GET_EFFECTS);
                 esetEffects       = api.ConvertComponentFunc <ASET>(ENTITY_SET_EFFECTS);
             }
             egetFromUniqueId = api.ConvertComponentFunc <AGETFROMUNIQUEID>(LEVEL_GETFROM_UNIQUEID);
             egetsFromAABB    = api.ConvertComponentFunc <AGETSFROMAABB>(LEVEL_GETSFROM_AABB);
             entityApiInited  = true;
         }
         else
         {
             return(false);
         }
     }
     return(true);
 }