@jsprismarine/prismarine
Version:
Dedicated Minecraft Bedrock Edition server written in TypeScript
190 lines • 5.77 kB
TypeScript
import { default as BinaryStream } from '../../../jsbinaryutils/src/index.ts';
export declare enum MetadataFlag {
INDEX = 0,
HEALTH = 1,
VARIANT = 2,
COLOR = 3,
NAMETAG = 4,
OWNER_ENTITY_ID = 5,
TARGET_ENTITY_ID = 6,
AIR = 7,
POTION_COLOR = 8,
AMBIENT = 9,
HURT_TIME = 10,
HURT_DIRECTION = 11,
PADDLE_TIME_LEFT = 12,
PADDLE_TIME_RIGHT = 13,
EXPERIENCE_VALUE = 14,
PLAYER_INDEX = 27,
ENTITY_LEAD_HOLDER_ID = 37,
SCALE = 38,
MAX_AIR = 42,
SPRINTING = 3,
CAN_CLIMB = 19,
CAN_FLY = 21,
HAS_COLLISION = 48,
AFFECTED_BY_GRAVITY = 49,
BOUNDINGBOX_WIDTH = 53,
BOUNDINGBOX_HEIGHT = 54
}
export declare enum FlagType {
BYTE = 0,
SHORT = 1,
INT = 2,
FLOAT = 3,
STRING = 4,
ITEM = 5,
POSITION = 6,
LONG = 7,
VECTOR = 8
}
export type MetadataContainer = Map<number, [number, bigint | number | boolean | string]>;
export declare class MetadataWriter {
private readonly metadata;
getPropertyValue(key: number): bigint | number | boolean | string | null;
setPropertyValue(key: number, type: number, value: bigint | number | boolean | string): void;
setLong(key: number, value: bigint): void;
setShort(key: number, value: number): void;
/**
* Set the property value as a string.
* @param {number} key - The property id.
* @param {string} value - The property value.
*/
setString(key: number, value: string): void;
/**
* Get the property value as a string.
* @param {number} key - The property id.
* @returns {string} The property value.
*/
getString(key: number): string;
/**
* Set the property value as a float.
* @param {number} key - The property id.
* @param {number} value - The property value.
*/
setFloat(key: number, value: number): void;
/**
* Get the property value as a float.
* @param {number} key - The property id.
* @returns {number}
*/
getFloat(key: number): number;
/**
* Set a flag value.
* @param {number} propertyId - The property id.
* @param {number} flagId - The flag id.
* @param {boolean} [value=true] - The flag value.
* @param {FlagType} [propertyType=FlagType.LONG] - The property type.
*/
setDataFlag(propertyId: number, flagId: number, value?: boolean, propertyType?: FlagType): void;
/**
* Get the property value as a boolean.
* @param {number} propertyId - The property id.
* @param {bigint} flagId - The flag id.
* @returns {boolean} The flag value.
*/
getDataFlag(propertyId: number, flagId: bigint): boolean;
/**
* @param {number} flagId - The flag id.
* @param {boolean} [value=true] - The flag value.
*/
setGenericFlag(flagId: number, value?: boolean): void;
/**
* Get the property value as a boolean.
* @returns {typeof metadata} The metadata object.
*/
getData(): MetadataContainer;
networkSerialize(stream: BinaryStream): void;
}
/**
* Represents the metadata of an entity.
*/
export declare class Metadata extends MetadataWriter {
/**
* Create a new metadata object.
* @param {boolean} [setDefaults=true]
* @returns {Metadata} the metadata object.
*/
constructor(setDefaults?: boolean);
/**
* Set the default metadata values.
* @remarks This method is called when the metadata object is created.
* @TODO: Add missing functions.
*/
protected setDefaults(): void;
/**
* Set the entity's name tag.
* @param {string} name - The name tag.
* @example
* ```typescript
* entity.setNameTag('Steve');
* ```
*/
setNameTag(name: string): void;
/**
* Get the entity's name tag.
* @returns {string} The entity's name tag.
*/
get nameTag(): string;
/**
* Set the entity's scale.
* @param {number} [scale=1] - The entity's scale.
*/
setScale(scale?: number): void;
/**
* Get the entity's scale.
* @returns {number} The entity's scale.
*/
getScale(): number;
/**
* Set if the entity should be affected by gravity.
* @param {boolean} [affected=true] - if the entity should be affected by gravity.
*/
setAffectedByGravity(affected?: boolean): void;
/**
* Get if the entity is affected by gravity.
* @returns {boolean} if the entity is affected by gravity.
*/
get affectedByGravity(): boolean;
/**
* Set if the entity should be collidable.
* @param {boolean} [collidable=true] - if the entity should be collidable.
*/
setCollidable(collidable?: boolean): void;
/**
* Get entity's collidable state.
* @returns {boolean} if the entity is collidable.
*/
get collidable(): boolean;
/**
* Set the entity's sprinting state.
* @param {boolean} [sprinting=true] - if the entity is sprinting.
*/
setSprinting(sprinting?: boolean): void;
/**
* Get entity's sprinting state.
* @returns {boolean} if the entity is sprinting.
*/
get sprinting(): boolean;
/**
* Set the entity's can fly state.
* @param {boolean} [canFly=true] - if the entity can fly.
*/
setCanFly(canFly?: boolean): void;
/**
* Get entity's can fly state.
* @returns {boolean} if the entity can fly.
*/
get canFly(): boolean;
/**
* Set the entity's can climb state.
* @param {boolean} [canClimb=true] - if the entity can climb.
*/
setCanClimb(canClimb?: boolean): void;
/**
* Get entity's can climb state.
* @returns {boolean} if the entity can climb.
*/
get canClimb(): boolean;
}
//# sourceMappingURL=Metadata.d.ts.map