@nxg-org/mineflayer-physics-util
Version:
Provides functionality for more accurate entity and projectile tracking.
81 lines (80 loc) • 3.16 kB
TypeScript
import { Entity } from "prismarine-entity";
import { EPhysicsCtx } from "../physics/settings";
import { AABB } from "@nxg-org/mineflayer-util-plugin";
import md from "minecraft-data";
import { PlayerState } from "../physics/states";
import { Vec3 } from "vec3";
import { IPhysics } from "../physics/engines";
import { Bot } from "mineflayer";
export declare function makeSupportFeature(mcData: md.IndexedData): (feature: string) => boolean;
type SupportFeature = ReturnType<typeof makeSupportFeature>;
export declare const DefaultPlayer: md.Entity;
export declare function applyMdToNewEntity(ctx: typeof EPhysicsCtx, entityType?: md.Entity, options?: Partial<Entity>): Entity;
export declare enum CheapEffects {
JUMP_BOOST = 0,
SPEED = 1,
SLOWNESS = 2,
DOLPHINS_GRACE = 3,
SLOW_FALLING = 4,
LEVITATION = 5,
BLINDNESS = 6
}
export declare enum CheapEnchantments {
DEPTH_STRIDER = 0,
SWIFT_SNEAK = 1,
SOUL_SPEED = 2
}
export declare function isEntityUsingItem(entity: Entity, supportFeature: SupportFeature): boolean;
export declare function whichHandIsEntityUsing(entity: Entity, supportFeature: SupportFeature): "hand" | "off-hand";
export declare function whichHandIsEntityUsingBoolean(entity: Entity, supportFeature: SupportFeature): boolean;
export declare function isUsableElytraItem(item: {
name?: string;
durabilityUsed?: number;
maxDurability?: number;
} | null): boolean;
export declare function getStatusEffectNamesForVersion(supportFeature: SupportFeature): {
jumpBoostEffectName: string;
speedEffectName: string;
slownessEffectName: string;
dolphinsGraceEffectName: string;
slowFallingEffectName: string;
levitationEffectName: string;
blindnessEffectName: string;
};
export declare function getEnchantmentNamesForVersion(supportFeature: ReturnType<typeof makeSupportFeature>): {
depthStriderEnchantmentName: string;
swiftSneakEnchantmentName: string;
soulSpeedEnchantmentName: string;
};
export declare function getBetweenRectangle(src: AABB, dest: AABB): AABB;
export declare function getLookingVector(entity: {
yaw: number;
pitch: number;
}): {
yaw: number;
pitch: number;
sinYaw: number;
cosYaw: number;
sinPitch: number;
cosPitch: number;
lookX: number;
lookY: number;
lookZ: number;
lookDir: Vec3;
};
/**
* Converts an old PlayerState object into the new PlayerState class format.
* * @param bot The current Mineflayer bot instance.
* @param oldState The old PlayerState object to migrate.
* @param ctx The IPhysics context required by the new PlayerState constructor.
* @returns A newly formatted PlayerState instance.
*/
export declare function convertPlayerState(bot: Bot, oldState: any, ctx: IPhysics): PlayerState;
/**
* Applies the values of the new PlayerState class back onto an old PlayerState object.
* This updates the oldState in-place.
* * @param newState The current, updated instance of the new PlayerState class.
* @param oldState The old PlayerState object to be overwritten.
*/
export declare function applyToPlayerState(newState: PlayerState, oldState: any): void;
export {};