2012-12-24 17:09:01 -05:00
|
|
|
|
2012-06-14 09:06:06 -04:00
|
|
|
#pragma once
|
|
|
|
|
2013-05-30 04:40:13 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
2012-06-14 09:06:06 -04:00
|
|
|
|
2015-07-31 10:49:10 -04:00
|
|
|
/** List of slot numbers, used for inventory-painting */
|
2013-05-30 04:40:13 -04:00
|
|
|
typedef std::vector<int> cSlotNums;
|
|
|
|
|
|
|
|
|
2013-05-08 05:45:07 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-09 16:49:25 -04:00
|
|
|
/** Constant to calculate ticks from seconds "ticks per second" */
|
|
|
|
constexpr inline const int TPS = 20;
|
|
|
|
// This is not added to the lua API because it broke the build
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-01-11 23:46:01 -05:00
|
|
|
// tolua_begin
|
|
|
|
|
2015-07-31 10:49:10 -04:00
|
|
|
/** Experience Orb setup */
|
2013-11-13 12:25:47 -05:00
|
|
|
enum
|
|
|
|
{
|
2014-07-17 13:13:23 -04:00
|
|
|
// Open to suggestion on naming convention here :)
|
2013-11-13 12:25:47 -05:00
|
|
|
MAX_EXPERIENCE_ORB_SIZE = 2000
|
|
|
|
} ;
|
2013-11-13 08:50:47 -05:00
|
|
|
|
2012-06-14 09:06:06 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-06-17 09:21:20 -04:00
|
|
|
/** Block face constants, used in PlayerDigging and PlayerBlockPlacement packets and bbox collision calc */
|
2013-09-01 13:05:58 -04:00
|
|
|
enum eBlockFace
|
2012-08-10 16:42:59 -04:00
|
|
|
{
|
2013-09-01 13:05:58 -04:00
|
|
|
BLOCK_FACE_NONE = -1, // Interacting with no block face - swinging the item in the air
|
2015-06-17 09:21:20 -04:00
|
|
|
BLOCK_FACE_XM = 4, // Interacting with the X- face of the block
|
|
|
|
BLOCK_FACE_XP = 5, // Interacting with the X+ face of the block
|
|
|
|
BLOCK_FACE_YM = 0, // Interacting with the Y- face of the block
|
|
|
|
BLOCK_FACE_YP = 1, // Interacting with the Y+ face of the block
|
|
|
|
BLOCK_FACE_ZM = 2, // Interacting with the Z- face of the block
|
|
|
|
BLOCK_FACE_ZP = 3, // Interacting with the Z+ face of the block
|
2014-10-11 22:39:55 -04:00
|
|
|
|
2013-09-01 13:05:58 -04:00
|
|
|
// Synonyms using the (deprecated) world directions:
|
|
|
|
BLOCK_FACE_BOTTOM = BLOCK_FACE_YM, // Interacting with the bottom face of the block
|
|
|
|
BLOCK_FACE_TOP = BLOCK_FACE_YP, // Interacting with the top face of the block
|
2013-11-16 15:58:17 -05:00
|
|
|
BLOCK_FACE_NORTH = BLOCK_FACE_ZM, // Interacting with the northern face of the block
|
|
|
|
BLOCK_FACE_SOUTH = BLOCK_FACE_ZP, // Interacting with the southern face of the block
|
|
|
|
BLOCK_FACE_WEST = BLOCK_FACE_XM, // Interacting with the western face of the block
|
|
|
|
BLOCK_FACE_EAST = BLOCK_FACE_XP, // Interacting with the eastern face of the block
|
2015-06-17 09:21:20 -04:00
|
|
|
|
|
|
|
// Bounds, used for range-checking:
|
|
|
|
BLOCK_FACE_MIN = -1,
|
|
|
|
BLOCK_FACE_MAX = 5,
|
2012-08-18 05:56:28 -04:00
|
|
|
} ;
|
|
|
|
|
2013-05-08 05:45:07 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-07-31 10:49:10 -04:00
|
|
|
/** PlayerDigging status constants */
|
2012-08-18 05:56:28 -04:00
|
|
|
enum
|
|
|
|
{
|
1.9 / 1.9.2 / 1.9.3 / 1.9.4 protocol support (#3135)
* Semistable update to 15w31a
I'm going through snapshots in a sequential order since it should make things easier, and since protocol version history is written.
* Update to 15w34b protocol
Also, fix an issue with the Entity Equipment packet from the past version. Clients are able to connect and do stuff!
* Partially update to 15w35e
Chunk data doesn't work, but the client joins. I'm waiting to do chunk data because chunk data has an incomplete format until 15w36d.
* Add '/blk' debug command
This command lets one see what block they are looking at, and makes figuring out what's supposed to be where in a highly broken chunk possible.
* Fix CRLF normalization in CheckBasicStyle.lua
Normally, this doesn't cause an issue, but when running from cygwin, it detects the CR as whitespace and creates thousands of violations for every single line. Lua, when run on windows, will normalize automatically, but when run via cygwin, it won't.
The bug was simply that gsub was returning a replaced version, but not changing the parameter, so the replaced version was ignored.
* Update to 15w40b
This includes chunk serialization. Fully functional chunk serialization for 1.9.
I'm not completely happy with the chunk serialization as-is (correct use of palettes would be great), but cuberite also doesn't skip sending empty chunks so this performance optimization should probably come later. The creation of a full buffer is suboptimal, but it's the easiest way to implement this code.
* Write long-by-long rather than creating a buffer
This is a bit faster and should be equivalent. However, the code still doesn't look too good.
* Update to 15w41a protocol
This includes the new set passengers packet, which works off of the ridden entity, not the rider. That means, among other things, that information about the previously ridden vehicle is needed when detaching. So a new method with that info was added.
* Update to 15w45a
* 15w51b protocol
* Update to 1.9.0 protocol
Closes #3067. There are still a few things that need to be worked out (picking up items, effects, particles, and most importantly inventory), but in general this should work. I'll make a few more changes tomorrow to get the rest of the protocol set up, along with 1.9.1/1.9.2 (which did make a few changes). Chunks, however, _are_ working, along with most other parts of the game (placing/breaking blocks).
* Fix item pickup packet not working
That was a silly mistake, but at least it was an easy one.
* 1.9.2 protocol support
* Fix version info found in server list ping
Thus, the client reports that it can connect rather than saying that the server is out of date. This required creating separate classes for 1.9.1 and 1.9.2, unfortunately.
* Fix build errors generated by clang
These didn't happen in MSVC.
* Add protocol19x.cpp and protocol19x.h to CMakeLists
* Ignore warnings in protocol19x that are ignored in protocol18x
* Document BLOCK_FACE and DIG_STATUS constants
* Fix BLOCK_FACE links and add separate section for DIG_STATUS
* Fix bat animation and object spawning
The causes of both of these are explained in #3135, but the gist is that both were typos.
* Implement Use Item packet
This means that buckets, bows, fishing rods, and several other similar items now work when not looking at a block.
* Handle DIG_STATUS_SWAP_ITEM_IN_HAND
* Add support for spawn eggs and potions
The items are transformed from the 1.9 version to the 1.8 version when reading and transformed back when sending.
* Remove spammy potion debug logging
* Fix wolf collar color metadata
The wrong type was being used, causing several clientside issues (including the screen going black).
* Fix 1.9 chunk sending in the nether
The nether and the end don't send skylight.
* Fix clang build errors
* Fix water bottles becoming mundane potions
This happened because the can become splash potion bit got set incorrectly. Water bottles and mundane potions are only differentiated by the fact that water bottles have a metadata of 0, so setting that bit made it a mundane potion.
Also add missing break statements to the read item NBT switch, which would otherwise break items with custom names and also cause incorrect "Unimplemented NBT data when parsing!" logging.
* Copy Protocol18x as Protocol19x
Aditionally, method and class names have been swapped to clean up other diffs. This commit is only added to make the following diffs more readable; it doesn't make any other changes (beyond class names).
* Make thrown potions use the correct appearence
This was caused by potions now using metadata.
* Add missing api doc for cSplashPotionEntity::GetItem
* Fix compile error in SplashPotionEntity.cpp
* Fix fix of cSplashPotionEntity API doc
* Temporarilly disable fall damage particles
These were causing issues in 1.9 due to the changed effect ID.
* Properly send a kick packet when connecting with an invalid version
This means that the client no longer waits on the server screen with no indication whatsoever. However, right now the server list ping isn't implemented for unknown versions, so it'll only load "Old" on the ping.
I also added a GetVarIntSize method to cByteBuffer. This helps clean up part of the code here (and I think it could clean up other parts), but it may make sense for it to be moved elsewhere (or declared in a different way).
* Handle server list pings from unrecognized versions
This isn't the cleanest way of writing it (it feels odd to use ProtocolRecognizer to send packets, and the addition of m_InPingForUnrecognizedVersion feels like the wrong technique), but it works and I can't think of a better way (apart from creating a full separate protocol class to handle only the ping... which would be worse).
* Use cPacketizer for the disconnect packet
This also should fix clang build errors.
* Add 1.9.3 / 1.9.4 support
* Fix incorrect indentation in APIDesc
2016-05-14 15:12:42 -04:00
|
|
|
DIG_STATUS_STARTED = 0,
|
|
|
|
DIG_STATUS_CANCELLED = 1,
|
|
|
|
DIG_STATUS_FINISHED = 2,
|
|
|
|
DIG_STATUS_DROP_STACK = 3,
|
|
|
|
DIG_STATUS_DROP_HELD = 4,
|
|
|
|
DIG_STATUS_SHOOT_EAT = 5,
|
|
|
|
DIG_STATUS_SWAP_ITEM_IN_HAND = 6,
|
2012-08-10 16:42:59 -04:00
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-07-31 10:49:10 -04:00
|
|
|
/** Individual actions sent in the WindowClick packet */
|
2013-05-08 05:45:07 -04:00
|
|
|
enum eClickAction
|
|
|
|
{
|
|
|
|
// Sorted by occurrence in the 1.5 protocol
|
|
|
|
caLeftClick,
|
|
|
|
caRightClick,
|
|
|
|
caShiftLeftClick,
|
|
|
|
caShiftRightClick,
|
|
|
|
caNumber1,
|
|
|
|
caNumber2,
|
|
|
|
caNumber3,
|
|
|
|
caNumber4,
|
|
|
|
caNumber5,
|
|
|
|
caNumber6,
|
|
|
|
caNumber7,
|
|
|
|
caNumber8,
|
|
|
|
caNumber9,
|
|
|
|
caMiddleClick,
|
|
|
|
caDropKey,
|
|
|
|
caCtrlDropKey,
|
|
|
|
caLeftClickOutside,
|
|
|
|
caRightClickOutside,
|
|
|
|
caLeftClickOutsideHoldNothing,
|
|
|
|
caRightClickOutsideHoldNothing,
|
|
|
|
caLeftPaintBegin,
|
|
|
|
caRightPaintBegin,
|
2017-07-13 09:43:48 -04:00
|
|
|
caMiddlePaintBegin,
|
2013-05-08 05:45:07 -04:00
|
|
|
caLeftPaintProgress,
|
|
|
|
caRightPaintProgress,
|
2017-07-13 09:43:48 -04:00
|
|
|
caMiddlePaintProgress,
|
2013-05-08 05:45:07 -04:00
|
|
|
caLeftPaintEnd,
|
|
|
|
caRightPaintEnd,
|
2017-07-13 09:43:48 -04:00
|
|
|
caMiddlePaintEnd,
|
2013-05-08 05:45:07 -04:00
|
|
|
caDblClick,
|
|
|
|
// Add new actions here
|
|
|
|
caUnknown = 255,
|
2014-10-11 22:39:55 -04:00
|
|
|
|
2013-05-08 05:45:07 -04:00
|
|
|
// Keep this list in sync with ClickActionToString() function below!
|
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enum eGameMode
|
|
|
|
{
|
|
|
|
eGameMode_NotSet = -1,
|
|
|
|
eGameMode_Survival = 0,
|
|
|
|
eGameMode_Creative = 1,
|
|
|
|
eGameMode_Adventure = 2,
|
2014-09-16 14:01:04 -04:00
|
|
|
eGameMode_Spectator = 3,
|
2014-10-11 22:39:55 -04:00
|
|
|
|
2013-05-08 05:45:07 -04:00
|
|
|
// Easier-to-use synonyms:
|
|
|
|
gmNotSet = eGameMode_NotSet,
|
|
|
|
gmSurvival = eGameMode_Survival,
|
|
|
|
gmCreative = eGameMode_Creative,
|
|
|
|
gmAdventure = eGameMode_Adventure,
|
2014-09-16 14:01:04 -04:00
|
|
|
gmSpectator = eGameMode_Spectator,
|
2014-10-11 22:39:55 -04:00
|
|
|
|
2013-07-28 16:55:09 -04:00
|
|
|
// These two are used to check GameMode for validity when converting from integers.
|
|
|
|
gmMax, // Gets automatically assigned
|
|
|
|
gmMin = 0,
|
2013-05-08 05:45:07 -04:00
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-06-02 13:59:46 -04:00
|
|
|
enum eChatType
|
|
|
|
{
|
|
|
|
ctChatBox = 0,
|
|
|
|
ctSystem = 1,
|
|
|
|
ctAboveActionBar = 2,
|
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-05-08 05:45:07 -04:00
|
|
|
enum eWeather
|
|
|
|
{
|
|
|
|
eWeather_Sunny = 0,
|
|
|
|
eWeather_Rain = 1,
|
|
|
|
eWeather_ThunderStorm = 2,
|
2014-10-11 22:39:55 -04:00
|
|
|
|
2013-05-08 05:45:07 -04:00
|
|
|
// Easier-to-use synonyms:
|
|
|
|
wSunny = eWeather_Sunny,
|
|
|
|
wRain = eWeather_Rain,
|
|
|
|
wThunderstorm = eWeather_ThunderStorm,
|
|
|
|
wStorm = wThunderstorm,
|
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-02-19 08:45:09 -05:00
|
|
|
enum eMobHeadType
|
2014-02-17 14:14:08 -05:00
|
|
|
{
|
|
|
|
SKULL_TYPE_SKELETON = 0,
|
|
|
|
SKULL_TYPE_WITHER = 1,
|
|
|
|
SKULL_TYPE_ZOMBIE = 2,
|
|
|
|
SKULL_TYPE_PLAYER = 3,
|
|
|
|
SKULL_TYPE_CREEPER = 4,
|
2017-02-14 05:13:55 -05:00
|
|
|
SKULL_TYPE_DRAGON = 5,
|
2014-02-17 14:14:08 -05:00
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-02-19 08:45:09 -05:00
|
|
|
enum eMobHeadRotation
|
2014-02-17 14:14:08 -05:00
|
|
|
{
|
|
|
|
SKULL_ROTATION_NORTH = 0,
|
|
|
|
SKULL_ROTATION_NORTH_NORTH_EAST = 1,
|
|
|
|
SKULL_ROTATION_NORTH_EAST = 2,
|
|
|
|
SKULL_ROTATION_EAST_NORTH_EAST = 3,
|
|
|
|
SKULL_ROTATION_EAST = 4,
|
|
|
|
SKULL_ROTATION_EAST_SOUTH_EAST = 5,
|
|
|
|
SKULL_ROTATION_SOUTH_EAST = 6,
|
|
|
|
SKULL_ROTATION_SOUTH_SOUTH_EAST = 7,
|
|
|
|
SKULL_ROTATION_SOUTH = 8,
|
|
|
|
SKULL_ROTATION_SOUTH_SOUTH_WEST = 9,
|
|
|
|
SKULL_ROTATION_SOUTH_WEST = 10,
|
|
|
|
SKULL_ROTATION_WEST_SOUTH_WEST = 11,
|
|
|
|
SKULL_ROTATION_WEST = 12,
|
|
|
|
SKULL_ROTATION_WEST_NORTH_WEST = 13,
|
|
|
|
SKULL_ROTATION_NORTH_WEST = 14,
|
|
|
|
SKULL_ROTATION_NORTH_NORTH_WEST = 15,
|
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-03 15:19:29 -05:00
|
|
|
enum eSkinPart
|
|
|
|
{
|
|
|
|
spCape = 0x01,
|
|
|
|
spJacket = 0x02,
|
|
|
|
spLeftSleeve = 0x04,
|
|
|
|
spRightSleeve = 0x08,
|
|
|
|
spLeftPants = 0x10,
|
|
|
|
spRightPants = 0x20,
|
|
|
|
spHat = 0x40,
|
|
|
|
spMask = 0x7F,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-04-03 02:57:01 -04:00
|
|
|
/** Dimension of a world */
|
|
|
|
enum eDimension
|
2013-05-08 05:45:07 -04:00
|
|
|
{
|
2020-04-03 02:57:01 -04:00
|
|
|
dimNether = -1,
|
|
|
|
dimOverworld = 0,
|
|
|
|
dimEnd = 1,
|
|
|
|
dimNotSet = 255, // For things that need an "indeterminate" state, such as cProtocol's LastSentDimension
|
|
|
|
} ;
|
2016-11-06 13:30:19 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-04-03 02:57:01 -04:00
|
|
|
/** Damage type, used in the TakeDamageInfo structure and related functions */
|
|
|
|
enum eDamageType
|
|
|
|
{
|
|
|
|
// Canonical names for the types (as documented in the plugin wiki):
|
|
|
|
dtAttack, // Being attacked by a mob
|
|
|
|
dtRangedAttack, // Being attacked by a projectile, possibly from a mob
|
|
|
|
dtLightning, // Hit by a lightning strike
|
|
|
|
dtFalling, // Falling down; dealt when hitting the ground
|
|
|
|
dtDrowning, // Drowning in water / lava
|
|
|
|
dtSuffocating, // Suffocating inside a block
|
|
|
|
dtStarving, // Hunger
|
|
|
|
dtCactusContact, // Contact with a cactus block
|
2020-11-25 12:56:55 -05:00
|
|
|
dtMagmaContact, // Contact with a magma block
|
2020-04-03 02:57:01 -04:00
|
|
|
dtLavaContact, // Contact with a lava block
|
|
|
|
dtPoisoning, // Having the poison effect
|
|
|
|
dtWithering, // Having the wither effect
|
|
|
|
dtOnFire, // Being on fire
|
|
|
|
dtFireContact, // Standing inside a fire block
|
|
|
|
dtInVoid, // Falling into the Void (Y < 0)
|
|
|
|
dtPotionOfHarming,
|
|
|
|
dtEnderPearl, // Thrown an ender pearl, teleported by it
|
|
|
|
dtAdmin, // Damage applied by an admin command
|
|
|
|
dtExplosion, // Damage applied by an explosion
|
2020-09-17 14:06:41 -04:00
|
|
|
dtEnvironment, // Damage dealt to mobs from environment: enderman in rain, snow golem in desert
|
2020-04-03 02:57:01 -04:00
|
|
|
|
|
|
|
// Some common synonyms:
|
|
|
|
dtPawnAttack = dtAttack,
|
|
|
|
dtEntityAttack = dtAttack,
|
|
|
|
dtMob = dtAttack,
|
|
|
|
dtMobAttack = dtAttack,
|
|
|
|
dtArrowAttack = dtRangedAttack,
|
|
|
|
dtArrow = dtRangedAttack,
|
|
|
|
dtProjectile = dtRangedAttack,
|
|
|
|
dtFall = dtFalling,
|
|
|
|
dtDrown = dtDrowning,
|
|
|
|
dtSuffocation = dtSuffocating,
|
|
|
|
dtStarvation = dtStarving,
|
|
|
|
dtHunger = dtStarving,
|
|
|
|
dtCactus = dtCactusContact,
|
|
|
|
dtCactuses = dtCactusContact,
|
|
|
|
dtCacti = dtCactusContact,
|
2020-11-25 12:56:55 -05:00
|
|
|
dtMagma = dtMagmaContact,
|
2020-04-03 02:57:01 -04:00
|
|
|
dtLava = dtLavaContact,
|
|
|
|
dtPoison = dtPoisoning,
|
|
|
|
dtWither = dtWithering,
|
|
|
|
dtBurning = dtOnFire,
|
|
|
|
dtInFire = dtFireContact,
|
|
|
|
dtPlugin = dtAdmin,
|
|
|
|
} ;
|
2016-11-06 13:30:19 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-04-03 02:57:01 -04:00
|
|
|
/** The source of an explosion.
|
|
|
|
Also dictates the type of the additional data passed to the explosion handlers:
|
|
|
|
| esBed | Vector3i * | Bed exploding in the Nether or in the End
|
|
|
|
| esEnderCrystal | cEnderCrystal * |
|
|
|
|
| esGhastFireball | cGhastFireballEntity * |
|
|
|
|
| esMonster | cMonster * |
|
|
|
|
| esOther | nullptr | Any other explosion unaccounted for
|
|
|
|
| esPlugin | nullptr | Explosion primarily attributed to a plugin
|
|
|
|
| esPrimedTNT | cTNTEntity * |
|
|
|
|
| esWitherBirth | cMonster * |
|
|
|
|
| esWitherSkull | cProjectileEntity * |
|
|
|
|
*/
|
|
|
|
enum eExplosionSource
|
|
|
|
{
|
|
|
|
esBed,
|
|
|
|
esEnderCrystal,
|
|
|
|
esGhastFireball,
|
|
|
|
esMonster,
|
|
|
|
esOther,
|
|
|
|
esPlugin,
|
|
|
|
esPrimedTNT,
|
|
|
|
esWitherBirth,
|
|
|
|
esWitherSkull,
|
|
|
|
esMax,
|
|
|
|
} ;
|
2016-11-06 13:30:19 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-04-03 02:57:01 -04:00
|
|
|
enum eShrapnelLevel
|
2016-11-06 13:30:19 -05:00
|
|
|
{
|
2020-04-03 02:57:01 -04:00
|
|
|
slNone,
|
|
|
|
slGravityAffectedOnly,
|
|
|
|
slAll
|
|
|
|
} ;
|
2016-11-06 13:30:19 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-04-03 02:57:01 -04:00
|
|
|
enum eSpreadSource
|
2016-11-06 13:30:19 -05:00
|
|
|
{
|
2020-04-03 02:57:01 -04:00
|
|
|
ssFireSpread,
|
|
|
|
ssGrassSpread,
|
|
|
|
ssMushroomSpread,
|
|
|
|
ssMycelSpread,
|
|
|
|
ssVineSpread,
|
|
|
|
} ;
|
2016-11-06 13:30:19 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-04-03 02:57:01 -04:00
|
|
|
enum eMessageType
|
2016-11-06 13:30:19 -05:00
|
|
|
{
|
2020-04-03 02:57:01 -04:00
|
|
|
// https://forum.cuberite.org/thread-1212.html
|
|
|
|
// MessageType...
|
2016-11-06 13:30:19 -05:00
|
|
|
|
2020-04-03 02:57:01 -04:00
|
|
|
mtCustom, // Send raw data without any processing
|
|
|
|
mtFailure, // Something could not be done (i.e. command not executed due to insufficient privilege)
|
|
|
|
mtInformation, // Informational message (i.e. command usage)
|
|
|
|
mtSuccess, // Something executed successfully
|
|
|
|
mtWarning, // Something concerning (i.e. reload) is about to happen
|
|
|
|
mtFatal, // Something catastrophic occured (i.e. plugin crash)
|
|
|
|
mtDeath, // Denotes death of player
|
|
|
|
mtPrivateMessage, // Player to player messaging identifier
|
|
|
|
mtJoin, // A player has joined the server
|
|
|
|
mtLeave, // A player has left the server
|
|
|
|
mtMaxPlusOne, // The first invalid type, used for checking on LuaAPI boundaries
|
2016-11-06 13:30:19 -05:00
|
|
|
|
2020-04-03 02:57:01 -04:00
|
|
|
// Common aliases:
|
|
|
|
mtFail = mtFailure,
|
|
|
|
mtError = mtFailure,
|
|
|
|
mtInfo = mtInformation,
|
|
|
|
mtPM = mtPrivateMessage,
|
|
|
|
};
|
2016-11-06 13:30:19 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-03-05 10:08:30 -05:00
|
|
|
|
2021-03-14 22:47:55 -04:00
|
|
|
enum class BannerPattern
|
|
|
|
{
|
|
|
|
BottomStripe,
|
|
|
|
TopStripe,
|
|
|
|
LeftStripe,
|
|
|
|
RightStripe,
|
|
|
|
CenterStripeVertical,
|
|
|
|
MiddleStripeHorizontal,
|
|
|
|
DownRightStripe,
|
|
|
|
DownLeftStripe,
|
|
|
|
SmallVerticalStripes,
|
|
|
|
DiagonalCross,
|
|
|
|
SquareCross,
|
|
|
|
LeftOfDiagonal,
|
|
|
|
RightOfUpsideDownDiagonal,
|
|
|
|
LeftOfUpsideDownDiagonal,
|
|
|
|
RightOfDiagonal,
|
|
|
|
VerticalHalfLeft,
|
|
|
|
VerticalHalfRight,
|
|
|
|
HorizontalHalfTop,
|
|
|
|
HorizontalHalfBottom,
|
|
|
|
BottomLeftCorner,
|
|
|
|
BottomRightCorner,
|
|
|
|
TopLeftCorner,
|
|
|
|
TopRightCorner,
|
|
|
|
BottomTriangle,
|
|
|
|
TopTriangle,
|
|
|
|
BottomTriangleSawtooth,
|
|
|
|
TopTriangleSawtooth,
|
|
|
|
MiddleCircle,
|
|
|
|
MiddleRhombus,
|
|
|
|
Border,
|
|
|
|
CurlyBorder,
|
|
|
|
Brick,
|
|
|
|
Gradient,
|
|
|
|
GradientUpsideDown,
|
|
|
|
Creeper,
|
|
|
|
Skull,
|
|
|
|
Flower,
|
|
|
|
Mojang,
|
|
|
|
Globe,
|
|
|
|
Piglin
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-03-05 10:08:30 -05:00
|
|
|
enum class BossBarColor
|
|
|
|
{
|
|
|
|
Pink,
|
|
|
|
Blue,
|
|
|
|
Red,
|
|
|
|
Green,
|
|
|
|
Yellow,
|
|
|
|
Purple,
|
|
|
|
White
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enum class BossBarDivisionType
|
|
|
|
{
|
|
|
|
None,
|
|
|
|
SixNotches,
|
|
|
|
TenNotches,
|
|
|
|
TwelveNotches,
|
|
|
|
TwentyNotches
|
|
|
|
};
|
|
|
|
|
2021-04-09 18:17:01 -04:00
|
|
|
// tolua_end
|
2021-03-05 10:08:30 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-04-09 18:17:01 -04:00
|
|
|
|
|
|
|
enum class EntityAnimation
|
|
|
|
{
|
|
|
|
AnimalFallsInLove,
|
|
|
|
ArmorStandGetsHit,
|
|
|
|
ArrowTipSparkles,
|
|
|
|
DolphinShowsHappiness,
|
|
|
|
EggCracks,
|
|
|
|
EntityGetsCriticalHit,
|
|
|
|
EntityGetsMagicalCriticalHit,
|
|
|
|
EntityTrailsHoney,
|
|
|
|
EvokerFangsAttacks,
|
|
|
|
FireworkRocketExplodes,
|
|
|
|
// FishingHookReels,
|
|
|
|
FoxChews,
|
|
|
|
GuardianAttacks,
|
|
|
|
HoglinAttacks,
|
|
|
|
HorseTamingFails,
|
|
|
|
HorseTamingSucceeds,
|
|
|
|
IronGolemAttacks,
|
|
|
|
IronGolemOffersGift,
|
|
|
|
IronGolemStashesGift,
|
|
|
|
MinecartSpawnerDelayResets,
|
|
|
|
MinecartTNTIgnites,
|
|
|
|
MobSpawns,
|
|
|
|
OcelotTrusts,
|
|
|
|
OcelotDistrusts,
|
|
|
|
PawnBerryBushPricks,
|
|
|
|
PawnBurns,
|
|
|
|
PawnChestEquipmentBreaks,
|
|
|
|
PawnDies,
|
|
|
|
PawnDrowns,
|
|
|
|
PawnFeetEquipmentBreaks,
|
|
|
|
PawnHandItemSwaps,
|
|
|
|
PawnHeadEquipmentBreaks,
|
|
|
|
PawnHurts,
|
|
|
|
PawnLegsEquipmentBreaks,
|
|
|
|
PawnMainHandEquipmentBreaks,
|
|
|
|
PawnOffHandEquipmentBreaks,
|
|
|
|
PawnShieldBlocks,
|
|
|
|
PawnShieldBreaks,
|
|
|
|
PawnTeleports,
|
|
|
|
PawnThornsPricks,
|
|
|
|
PawnTotemActivates,
|
|
|
|
PlayerBadOmenActivates,
|
|
|
|
PlayerEntersBed,
|
|
|
|
PlayerFinishesEating,
|
|
|
|
PlayerLeavesBed,
|
|
|
|
PlayerMainHandSwings,
|
|
|
|
// PlayerReducedDebugScreenDisables,
|
|
|
|
// PlayerReducedDebugScreenEnables,
|
|
|
|
// PlayerSetsOperatorLevelFour,
|
|
|
|
// PlayerSetsOperatorLevelOne,
|
|
|
|
// PlayerSetsOperatorLevelThree,
|
|
|
|
// PlayerSetsOperatorLevelTwo,
|
|
|
|
// PlayerSetsOperatorLevelZero,
|
|
|
|
PlayerOffHandSwings,
|
|
|
|
RabbitJumps,
|
|
|
|
RavagerAttacks,
|
|
|
|
RavagerBecomesStunned,
|
|
|
|
SheepEatsGrass,
|
|
|
|
SnowballPoofs,
|
|
|
|
// SquidResetsRotation,
|
|
|
|
VillagerKisses,
|
|
|
|
VillagerShowsAnger,
|
|
|
|
VillagerShowsHappiness,
|
|
|
|
VillagerSweats,
|
|
|
|
WitchMagicks,
|
|
|
|
WolfShakesWater,
|
|
|
|
WolfTamingFails,
|
|
|
|
WolfTamingSucceeds,
|
|
|
|
ZoglinAttacks,
|
|
|
|
ZombieVillagerCureFinishes
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// tolua_begin
|
|
|
|
|
2020-04-03 02:57:01 -04:00
|
|
|
/** Returns a textual representation of the click action. */
|
|
|
|
const char * ClickActionToString(int a_ClickAction);
|
2016-11-06 13:30:19 -05:00
|
|
|
|
2020-04-03 02:57:01 -04:00
|
|
|
/** Returns a blockface mirrored around the Y axis (doesn't change up / down). */
|
|
|
|
eBlockFace MirrorBlockFaceY(eBlockFace a_BlockFace);
|
2016-11-06 13:30:19 -05:00
|
|
|
|
2020-04-03 02:57:01 -04:00
|
|
|
/** Returns a blockface rotated around the Y axis counter-clockwise. */
|
|
|
|
eBlockFace RotateBlockFaceCCW(eBlockFace a_BlockFace);
|
2016-11-06 13:30:19 -05:00
|
|
|
|
2020-04-03 02:57:01 -04:00
|
|
|
/** Returns a blockface rotated around the Y axis clockwise. */
|
|
|
|
eBlockFace RotateBlockFaceCW(eBlockFace a_BlockFace);
|
2016-11-06 13:30:19 -05:00
|
|
|
|
2020-04-03 02:57:01 -04:00
|
|
|
/** Returns a blockface opposite to the one specified. */
|
|
|
|
eBlockFace ReverseBlockFace(eBlockFace a_BlockFace);
|
2016-11-06 13:30:19 -05:00
|
|
|
|
2020-04-03 02:57:01 -04:00
|
|
|
/** Returns the textual representation of the BlockFace constant. */
|
|
|
|
AString BlockFaceToString(eBlockFace a_BlockFace);
|
2016-11-06 13:30:19 -05:00
|
|
|
|
2020-04-03 02:57:01 -04:00
|
|
|
/** Returns true if the specified block type is valid (known). */
|
|
|
|
bool IsValidBlock(int a_BlockType);
|
2016-11-06 13:30:19 -05:00
|
|
|
|
2020-04-03 02:57:01 -04:00
|
|
|
/** Returns true if the specified item type is valid (known). */
|
|
|
|
bool IsValidItem(int a_ItemType);
|
2016-11-06 13:30:19 -05:00
|
|
|
|
2020-04-03 02:57:01 -04:00
|
|
|
/** Translates a dimension string to dimension enum. Takes either a number or a dimension alias (built-in). Returns dimOverworld on failure */
|
|
|
|
extern eDimension StringToDimension(const AString & a_DimensionString);
|
2012-06-14 09:06:06 -04:00
|
|
|
|
2020-04-03 02:57:01 -04:00
|
|
|
/** Translates a dimension enum to dimension string.
|
|
|
|
Takes an eDimension enum value and returns "Overworld" on failure. */
|
|
|
|
extern AString DimensionToString(eDimension a_Dimension);
|
2012-06-14 09:06:06 -04:00
|
|
|
|
2020-04-03 02:57:01 -04:00
|
|
|
/** Translates damage type constant to a string representation (built-in). */
|
|
|
|
extern AString DamageTypeToString(eDamageType a_DamageType);
|
2012-06-14 09:06:06 -04:00
|
|
|
|
2020-04-03 02:57:01 -04:00
|
|
|
/** Translates a damage type string to damage type. Takes either a number or a damage type alias (built-in). Returns -1 on failure */
|
|
|
|
extern eDamageType StringToDamageType(const AString & a_DamageString);
|
2012-06-14 09:06:06 -04:00
|
|
|
|
2020-04-03 02:57:01 -04:00
|
|
|
/** Modifies the specified coords so that they point to the block adjacent to the one specified through its specified face.
|
|
|
|
If a_Inverse is true, the opposite direction is used instead. */
|
|
|
|
void AddFaceDirection(int & a_BlockX, int & a_BlockY, int & a_BlockZ, eBlockFace a_BlockFace, bool a_bInverse = false);
|
2012-06-14 09:06:06 -04:00
|
|
|
|
2020-04-18 05:44:35 -04:00
|
|
|
/** Returns the coords of a block that is neighboring the specified position through its specified face.
|
|
|
|
If a_IsInverse is true, the opposite direction is used instead. */
|
|
|
|
inline Vector3i AddFaceDirection(Vector3i a_Pos, eBlockFace a_BlockFace, bool a_bInverse = false)
|
|
|
|
{
|
|
|
|
AddFaceDirection(a_Pos.x, a_Pos.y, a_Pos.z, a_BlockFace, a_bInverse);
|
|
|
|
return a_Pos;
|
|
|
|
}
|
|
|
|
|
2020-04-03 02:57:01 -04:00
|
|
|
// tolua_end
|
2012-06-14 09:06:06 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-20 16:55:07 -04:00
|
|
|
|
2013-05-08 05:45:07 -04:00
|
|
|
|
2013-03-09 09:35:43 -05:00
|
|
|
inline void EulerToVector(double a_Pan, double a_Pitch, double & a_X, double & a_Y, double & a_Z)
|
2012-06-14 09:06:06 -04:00
|
|
|
{
|
2014-07-21 09:19:48 -04:00
|
|
|
// a_X = sinf ( a_Pan / 180 * PI) * cosf ( a_Pitch / 180 * PI);
|
|
|
|
// a_Y = -sinf ( a_Pitch / 180 * PI);
|
|
|
|
// a_Z = -cosf ( a_Pan / 180 * PI) * cosf ( a_Pitch / 180 * PI);
|
2014-10-20 16:55:07 -04:00
|
|
|
a_X = cos(a_Pan / 180 * M_PI) * cos(a_Pitch / 180 * M_PI);
|
|
|
|
a_Y = sin(a_Pan / 180 * M_PI) * cos(a_Pitch / 180 * M_PI);
|
|
|
|
a_Z = sin(a_Pitch / 180 * M_PI);
|
2012-06-14 09:06:06 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-03-09 09:35:43 -05:00
|
|
|
inline void VectorToEuler(double a_X, double a_Y, double a_Z, double & a_Pan, double & a_Pitch)
|
2012-06-14 09:06:06 -04:00
|
|
|
{
|
2014-04-17 01:35:26 -04:00
|
|
|
double r = sqrt((a_X * a_X) + (a_Z * a_Z));
|
|
|
|
if (r < std::numeric_limits<double>::epsilon())
|
2013-03-09 09:35:43 -05:00
|
|
|
{
|
2014-04-17 01:35:26 -04:00
|
|
|
a_Pan = 0;
|
2013-03-09 09:35:43 -05:00
|
|
|
}
|
2012-06-14 09:06:06 -04:00
|
|
|
else
|
2013-03-09 09:35:43 -05:00
|
|
|
{
|
2014-10-20 16:55:07 -04:00
|
|
|
a_Pan = atan2(a_Z, a_X) * 180 / M_PI - 90;
|
2013-03-09 09:35:43 -05:00
|
|
|
}
|
2014-04-17 01:35:26 -04:00
|
|
|
|
2014-10-20 16:55:07 -04:00
|
|
|
a_Pitch = atan2(a_Y, r) * 180 / M_PI;
|
2012-06-14 09:06:06 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-12-23 17:39:53 -05:00
|
|
|
template <class T>
|
2020-10-05 08:09:42 -04:00
|
|
|
inline T Diff(T a_Val1, T a_Val2)
|
2014-05-09 17:43:00 -04:00
|
|
|
{
|
|
|
|
return std::abs(a_Val1 - a_Val2);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-02-15 17:16:44 -05:00
|
|
|
// tolua_begin
|
|
|
|
|
2014-02-07 13:58:52 -05:00
|
|
|
/** Normalizes an angle in degrees to the [-180, +180) range: */
|
2013-12-08 07:08:56 -05:00
|
|
|
inline double NormalizeAngleDegrees(const double a_Degrees)
|
|
|
|
{
|
|
|
|
double Norm = fmod(a_Degrees + 180, 360);
|
|
|
|
if (Norm < 0)
|
|
|
|
{
|
|
|
|
Norm += 360;
|
|
|
|
}
|
|
|
|
return Norm - 180;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-06-14 09:06:06 -04:00
|
|
|
namespace ItemCategory
|
|
|
|
{
|
2020-04-03 02:57:01 -04:00
|
|
|
bool IsPickaxe(short a_ItemType);
|
2012-06-14 09:06:06 -04:00
|
|
|
|
2020-04-03 02:57:01 -04:00
|
|
|
bool IsAxe(short a_ItemType);
|
2012-06-14 09:06:06 -04:00
|
|
|
|
2020-04-03 02:57:01 -04:00
|
|
|
bool IsSword(short a_ItemType);
|
2012-06-14 09:06:06 -04:00
|
|
|
|
2020-04-03 02:57:01 -04:00
|
|
|
bool IsHoe(short a_ItemType);
|
2012-06-14 09:06:06 -04:00
|
|
|
|
2020-04-03 02:57:01 -04:00
|
|
|
bool IsShovel(short a_ItemType);
|
2012-06-14 09:06:06 -04:00
|
|
|
|
2020-04-03 02:57:01 -04:00
|
|
|
bool IsTool(short a_ItemType);
|
2012-06-14 09:06:06 -04:00
|
|
|
|
2020-04-03 02:57:01 -04:00
|
|
|
bool IsHelmet(short a_ItemType);
|
2012-06-14 09:06:06 -04:00
|
|
|
|
2020-04-03 02:57:01 -04:00
|
|
|
bool IsChestPlate(short a_ItemType);
|
2012-06-14 09:06:06 -04:00
|
|
|
|
2020-04-03 02:57:01 -04:00
|
|
|
bool IsLeggings(short a_ItemType);
|
2014-10-11 22:39:55 -04:00
|
|
|
|
2020-04-03 02:57:01 -04:00
|
|
|
bool IsBoots(short a_ItemType);
|
2014-10-11 22:39:55 -04:00
|
|
|
|
2020-04-03 02:57:01 -04:00
|
|
|
bool IsMinecart(short a_ItemType);
|
2014-10-11 22:39:55 -04:00
|
|
|
|
2020-04-03 02:57:01 -04:00
|
|
|
bool IsArmor(short a_ItemType);
|
2012-06-14 09:06:06 -04:00
|
|
|
|
2020-04-03 02:57:01 -04:00
|
|
|
bool IsHorseArmor(short a_ItemType);
|
2012-06-14 09:06:06 -04:00
|
|
|
}
|
2013-11-30 09:57:56 -05:00
|
|
|
|
2013-01-11 23:46:01 -05:00
|
|
|
// tolua_end
|