@hylithiumjs.com/core 1.3.5 → 1.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -31,6 +31,12 @@ export declare const ReputationGroup: any;
31
31
  export declare const ReputationRequirement: any;
32
32
  export declare const ReputationDataResource: any;
33
33
  export declare const BlockModule: any;
34
+ import type { ChunkUtilStatic as ChunkUtilStaticType, SimpleItemContainerConstructor, ItemContainerState as ItemContainerStateType, ChestHelper as ChestHelperType } from "./types";
35
+ export declare const ChunkUtil: ChunkUtilStaticType;
36
+ export declare const SimpleItemContainer: SimpleItemContainerConstructor;
37
+ export declare const ItemContainerState: ItemContainerStateType;
38
+ export declare const chestHelper: ChestHelperType;
39
+ export type { ChestHelper } from "./types";
34
40
  export declare const handlers: EventHandler[];
35
41
  export declare function EventListener(eventType: EventType): (target: unknown, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
36
42
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,OAAO,KAAK,EACV,YAAY,EACZ,SAAS,EACT,cAAc,IAAI,kBAAkB,EACpC,YAAY,IAAI,gBAAgB,EAChC,uBAAuB,EACxB,MAAM,SAAS,CAAC;AAGjB,eAAO,MAAM,cAAc,EAAyC,kBAAkB,CAAC;AAGvF,eAAO,MAAM,KAAK,EAAuC,gBAAgB,CAAC;AAC1E,eAAO,MAAM,YAAY,EAAuC,uBAAuB,CAAC;AAGxF,OAAO,EAAE,gBAAgB,EAAE,cAAc,IAAI,kBAAkB,EAAE,eAAe,IAAI,mBAAmB,EAAE,gBAAgB,IAAI,oBAAoB,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,SAAS,CAAC;AACjM,eAAO,MAAM,SAAS,EAAoC,gBAAgB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AAO,MAAM,WAAW,KAAkC,CAAC;AAG3D,OAAO,KAAK,EACV,eAAe,IAAI,mBAAmB,EACtC,8BAA8B,EAC9B,kBAAkB,IAAI,sBAAsB,EAC5C,WAAW,IAAI,eAAe,EAC/B,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,SAAS,EAAoC,mBAAmB,CAAC;AAC9E,eAAO,MAAM,mBAAmB,EAA8C,8BAA8B,CAAC;AAC7G,eAAO,MAAM,kBAAkB,EAA6C,sBAAsB,CAAC;AAGnG,eAAO,MAAM,WAAW,EAAsC,eAAe,CAAC;AAG9E,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAG3C,eAAO,MAAM,QAAQ,EAAE,YAAY,EAAwE,CAAC;AAE5G,wBAAgB,aAAa,CAAC,SAAS,EAAE,SAAS,IAC/B,QAAQ,OAAO,EAAE,aAAa,MAAM,EAAE,YAAY,kBAAkB,wBAOtF"}
package/dist/index.js CHANGED
@@ -30,6 +30,11 @@ export const ReputationRequirement = globalThis.ReputationRequirement;
30
30
  export const ReputationDataResource = globalThis.ReputationDataResource;
31
31
  // Block & World Globals
32
32
  export const BlockModule = globalThis.BlockModule;
33
+ export const ChunkUtil = globalThis.ChunkUtil;
34
+ export const SimpleItemContainer = globalThis.SimpleItemContainer;
35
+ export const ItemContainerState = globalThis.ItemContainerState;
36
+ // ChestHelper - Exposed by HyLithiumJS Java plugin
37
+ export const chestHelper = globalThis.chestHelper;
33
38
  // Usar array global existente ou criar novo (evita sobrescrever handlers de outros plugins)
34
39
  export const handlers = globalThis.handlers || (globalThis.handlers = []);
35
40
  export function EventListener(eventType) {
package/dist/types.d.ts CHANGED
@@ -296,6 +296,340 @@ export interface TableBuilder {
296
296
  export interface TableBuilderConstructor {
297
297
  new (tableName: string): TableBuilder;
298
298
  }
299
+ /**
300
+ * Base interface for item containers (chests, inventories, etc.)
301
+ * Corresponds to com.hypixel.hytale.server.core.inventory.container.ItemContainer
302
+ */
303
+ export interface ItemContainer {
304
+ /**
305
+ * Gets the capacity (number of slots) of this container.
306
+ */
307
+ getCapacity(): number;
308
+ /**
309
+ * Gets the item stack at the specified slot.
310
+ * @param slot Slot index (0-based)
311
+ * @returns ItemStack at slot or null if empty
312
+ */
313
+ getItemStack(slot: number): ItemStack | null;
314
+ /**
315
+ * Sets an item stack at the specified slot.
316
+ * @param slot Slot index (0-based)
317
+ * @param itemStack Item to place in slot
318
+ */
319
+ setItemStackForSlot(slot: number, itemStack: ItemStack): void;
320
+ /**
321
+ * Adds an item stack to the first available slot.
322
+ * @param itemStack Item to add
323
+ * @returns Transaction result
324
+ */
325
+ addItemStack(itemStack: ItemStack): ItemStackTransaction;
326
+ /**
327
+ * Removes an item stack from a slot.
328
+ * @param slot Slot index
329
+ * @returns The removed item or null
330
+ */
331
+ removeItemStack(slot: number): ItemStack | null;
332
+ /**
333
+ * Clears all items from the container.
334
+ * @returns ClearTransaction with info about cleared items
335
+ */
336
+ clear(): ClearTransaction;
337
+ /**
338
+ * Checks if the container is empty.
339
+ */
340
+ isEmpty(): boolean;
341
+ /**
342
+ * Moves all items to another container.
343
+ * @param target Target container
344
+ */
345
+ moveAllItemStacksTo(target: ItemContainer): void;
346
+ }
347
+ /**
348
+ * Simple implementation of ItemContainer.
349
+ * Corresponds to com.hypixel.hytale.server.core.inventory.container.SimpleItemContainer
350
+ */
351
+ export interface SimpleItemContainer extends ItemContainer {
352
+ /**
353
+ * Creates a clone of this container.
354
+ */
355
+ clone(): SimpleItemContainer;
356
+ /**
357
+ * Sets a global filter for the container.
358
+ */
359
+ setGlobalFilter(filterType: FilterType): void;
360
+ /**
361
+ * Sets a filter for a specific slot.
362
+ */
363
+ setSlotFilter(actionType: FilterActionType, slot: number, filter: SlotFilter | null): void;
364
+ }
365
+ /**
366
+ * Constructor for SimpleItemContainer
367
+ */
368
+ export interface SimpleItemContainerConstructor {
369
+ new (capacity: number): SimpleItemContainer;
370
+ }
371
+ /**
372
+ * Filter type for container operations.
373
+ */
374
+ export type FilterType = 'ALLOW_ALL' | 'DENY_INPUT' | 'DENY_OUTPUT' | 'DENY_ALL';
375
+ /**
376
+ * Filter action type for slot-specific filters.
377
+ */
378
+ export type FilterActionType = 'ADD' | 'REMOVE' | 'DROP';
379
+ /**
380
+ * Slot filter interface for custom filtering logic.
381
+ */
382
+ export interface SlotFilter {
383
+ test(actionType: FilterActionType, container: ItemContainer, slot: number, itemStack: ItemStack | null): boolean;
384
+ }
385
+ /**
386
+ * Transaction result from item stack operations.
387
+ */
388
+ export interface ItemStackTransaction {
389
+ getRemainder(): ItemStack | null;
390
+ isSuccess(): boolean;
391
+ }
392
+ /**
393
+ * Transaction result from clear operations.
394
+ */
395
+ export interface ClearTransaction {
396
+ isSuccess(): boolean;
397
+ getClearedItems(): ItemStack[];
398
+ }
399
+ /**
400
+ * Block state attached to blocks with special behavior.
401
+ * Corresponds to com.hypixel.hytale.server.core.universe.world.meta.BlockState
402
+ */
403
+ export interface BlockState {
404
+ /**
405
+ * Gets the position of this block state.
406
+ */
407
+ getPosition(): Vector3i;
408
+ /**
409
+ * Sets the position for this block state.
410
+ */
411
+ setPosition(chunk: WorldChunk, position: Vector3i): void;
412
+ /**
413
+ * Converts this state to a holder for storage.
414
+ */
415
+ toHolder(): Holder;
416
+ }
417
+ /**
418
+ * Block state for containers (chests, barrels, etc.)
419
+ * Corresponds to com.hypixel.hytale.server.core.universe.world.meta.state.ItemContainerState
420
+ */
421
+ export interface ItemContainerState extends BlockState {
422
+ /**
423
+ * Gets the item container for this block.
424
+ */
425
+ getItemContainer(): ItemContainer;
426
+ /**
427
+ * Sets a new item container for this block.
428
+ * @param container The new container (usually SimpleItemContainer)
429
+ */
430
+ setItemContainer(container: SimpleItemContainer): void;
431
+ /**
432
+ * Initializes the container with specified capacity and type.
433
+ */
434
+ initializeContainer(capacity: number, itemContainerType: string): void;
435
+ }
436
+ /**
437
+ * Chunk in the world containing blocks and entities.
438
+ * Corresponds to com.hypixel.hytale.server.core.universe.world.chunk.WorldChunk
439
+ */
440
+ export interface WorldChunk {
441
+ /**
442
+ * Gets the X coordinate of this chunk.
443
+ */
444
+ getX(): number;
445
+ /**
446
+ * Gets the Z coordinate of this chunk.
447
+ */
448
+ getZ(): number;
449
+ /**
450
+ * Gets the chunk index.
451
+ */
452
+ getIndex(): number;
453
+ /**
454
+ * Gets the block ID at the specified local coordinates.
455
+ */
456
+ getBlock(x: number, y: number, z: number): number;
457
+ /**
458
+ * Sets a block at the specified local coordinates.
459
+ */
460
+ setBlock(x: number, y: number, z: number, id: number, blockType: BlockType, rotation: number, filler: number, settings: number): boolean;
461
+ /**
462
+ * Gets the block state at the specified local coordinates.
463
+ * @returns BlockState or null if no state exists
464
+ */
465
+ getState(x: number, y: number, z: number): BlockState | null;
466
+ /**
467
+ * Sets the block state at the specified local coordinates.
468
+ */
469
+ setState(x: number, y: number, z: number, state: BlockState | null, notify: boolean): void;
470
+ /**
471
+ * Gets the world this chunk belongs to.
472
+ */
473
+ getWorld(): World;
474
+ /**
475
+ * Gets the block component chunk.
476
+ */
477
+ getBlockComponentChunk(): BlockComponentChunk | null;
478
+ /**
479
+ * Gets the entity chunk.
480
+ */
481
+ getEntityChunk(): EntityChunk | null;
482
+ }
483
+ /**
484
+ * Interface for block component storage in chunks.
485
+ */
486
+ export interface BlockComponentChunk {
487
+ getNeedsSaving(): boolean;
488
+ consumeNeedsSaving(): boolean;
489
+ }
490
+ /**
491
+ * Interface for entity storage in chunks.
492
+ */
493
+ export interface EntityChunk {
494
+ getNeedsSaving(): boolean;
495
+ consumeNeedsSaving(): boolean;
496
+ }
497
+ /**
498
+ * World interface with chunk and block access.
499
+ * Corresponds to com.hypixel.hytale.server.core.universe.world.World
500
+ */
501
+ export interface World {
502
+ /**
503
+ * Gets the world name/identifier.
504
+ */
505
+ getName(): string;
506
+ /**
507
+ * Gets a chunk by its index (may not be ticking).
508
+ */
509
+ getNonTickingChunk(chunkIndex: number): WorldChunk | null;
510
+ /**
511
+ * Gets a ticking chunk by its index.
512
+ */
513
+ getTickingChunk(chunkIndex: number): WorldChunk | null;
514
+ /**
515
+ * Gets the chunk store.
516
+ */
517
+ getChunkStore(): ChunkStore;
518
+ /**
519
+ * Gets the entity store.
520
+ */
521
+ getEntityStore(): EntityStore;
522
+ /**
523
+ * Sets a block at world coordinates.
524
+ * @param x World X coordinate
525
+ * @param y World Y coordinate
526
+ * @param z World Z coordinate
527
+ * @param blockId Block type ID string
528
+ */
529
+ setBlock(x: number, y: number, z: number, blockId: string): void;
530
+ /**
531
+ * Gets the block type at world coordinates.
532
+ */
533
+ getBlockType(x: number, y: number, z: number): BlockType;
534
+ /**
535
+ * Breaks a block at world coordinates.
536
+ */
537
+ breakBlock(x: number, y: number, z: number, settings: number): void;
538
+ /**
539
+ * Checks if the current thread is the world's ticking thread.
540
+ */
541
+ isInThread(): boolean;
542
+ /**
543
+ * Executes a runnable on the world's ticking thread.
544
+ */
545
+ execute(runnable: () => void): void;
546
+ }
547
+ /**
548
+ * Chunk store for managing world chunks.
549
+ */
550
+ export interface ChunkStore {
551
+ getStore(): Store<ChunkStore>;
552
+ }
553
+ /**
554
+ * Utility class for chunk coordinate calculations.
555
+ * Corresponds to com.hypixel.hytale.math.util.ChunkUtil
556
+ */
557
+ export interface ChunkUtilStatic {
558
+ /**
559
+ * Calculates chunk index from block coordinates.
560
+ * @param blockX Block X coordinate
561
+ * @param blockZ Block Z coordinate
562
+ * @returns Chunk index as a long number
563
+ */
564
+ indexChunkFromBlock(blockX: number, blockZ: number): number;
565
+ /**
566
+ * Gets the chunk coordinate from a block coordinate.
567
+ * @param blockCoord Block coordinate
568
+ * @returns Chunk coordinate
569
+ */
570
+ chunkCoordinate(blockCoord: number): number;
571
+ /**
572
+ * Calculates the index of a block within a column.
573
+ */
574
+ indexBlockInColumn(x: number, y: number, z: number): number;
575
+ /**
576
+ * Checks if two block positions are in the same chunk.
577
+ */
578
+ isSameChunk(x1: number, z1: number, x2: number, z2: number): boolean;
579
+ }
580
+ /**
581
+ * Helper class for chest/container operations.
582
+ * Exposed by HyLithiumJS Java plugin.
583
+ */
584
+ export interface ChestHelper {
585
+ /**
586
+ * Fills a chest/container with items at random slots.
587
+ * @param world The world object
588
+ * @param x X coordinate of the chest block
589
+ * @param y Y coordinate of the chest block
590
+ * @param z Z coordinate of the chest block
591
+ * @param items Array of ItemStacks to add
592
+ * @returns Number of items successfully added
593
+ */
594
+ fillChestWithItems(world: World, x: number, y: number, z: number, items: ItemStack[]): number;
595
+ /**
596
+ * Gets the ItemContainer from a chest/container block.
597
+ * @param world The world object
598
+ * @param x X coordinate of the chest block
599
+ * @param y Y coordinate of the chest block
600
+ * @param z Z coordinate of the chest block
601
+ * @returns ItemContainer or null if not found
602
+ */
603
+ getBlockContainer(world: World, x: number, y: number, z: number): ItemContainer | null;
604
+ /**
605
+ * Clears all items from a chest/container.
606
+ * @param world The world object
607
+ * @param x X coordinate of the chest block
608
+ * @param y Y coordinate of the chest block
609
+ * @param z Z coordinate of the chest block
610
+ * @returns true if successful
611
+ */
612
+ clearChest(world: World, x: number, y: number, z: number): boolean;
613
+ /**
614
+ * Sets the capacity (number of slots) for a chest.
615
+ * @param world The world object
616
+ * @param x X coordinate of the chest block
617
+ * @param y Y coordinate of the chest block
618
+ * @param z Z coordinate of the chest block
619
+ * @param capacity New capacity (number of slots)
620
+ * @returns true if successful
621
+ */
622
+ setChestCapacity(world: World, x: number, y: number, z: number, capacity: number): boolean;
623
+ /**
624
+ * Gets all contents of a chest/container.
625
+ * @param world The world object
626
+ * @param x X coordinate of the chest block
627
+ * @param y Y coordinate of the chest block
628
+ * @param z Z coordinate of the chest block
629
+ * @returns Array of ItemStacks or null if not found
630
+ */
631
+ getChestContents(world: World, x: number, y: number, z: number): ItemStack[] | null;
632
+ }
299
633
  export interface BootEvent {
300
634
  toString(): string;
301
635
  }