@@ -566,22 +566,22 @@ export class OutboundPackets {
566
566
567
567
public updateCurrentMapChunk ( ) : void {
568
568
const packet = new Packet ( 166 , PacketType . DYNAMIC_LARGE ) ;
569
- packet . put ( this . player . position . chunkLocalY , 'SHORT ' ) ;
570
- packet . put ( this . player . position . chunkX + 6 , 'SHORT ' , 'LITTLE_ENDIAN ' ) ;
571
- packet . put ( this . player . position . chunkLocalX , 'SHORT ' ) ;
572
- packet . put ( this . player . position . chunkY + 6 , 'SHORT ' , 'LITTLE_ENDIAN ' ) ;
569
+ packet . put ( this . player . position . chunkLocalY , 'short ' ) ;
570
+ packet . put ( this . player . position . chunkX + 6 , 'short ' , 'le ' ) ;
571
+ packet . put ( this . player . position . chunkLocalX , 'short ' ) ;
572
+ packet . put ( this . player . position . chunkY + 6 , 'short ' , 'le ' ) ;
573
573
packet . put ( this . player . position . level ) ;
574
574
575
- for ( let xCalc = Math . floor ( this . player . position . chunkX / 8 ) ; xCalc <= Math . floor ( ( this . player . position . chunkX + 12 ) / 8 ) ; xCalc ++ ) {
576
- for ( let yCalc = Math . floor ( this . player . position . chunkY / 8 ) ; yCalc <= Math . floor ( ( this . player . position . chunkY + 12 ) / 8 ) ; yCalc ++ ) {
577
- const regionid = ( xCalc << 8 | yCalc ) ;
578
- const xteaRegion = xteaRegions [ regionid ]
575
+ const startX = Math . floor ( this . player . position . chunkX / 8 ) ;
576
+ const endX = Math . floor ( ( this . player . position . chunkX + 12 ) / 8 ) ;
577
+ const startY = Math . floor ( this . player . position . chunkY / 8 ) ;
578
+ const endY = Math . floor ( ( this . player . position . chunkY + 12 ) / 8 ) ;
579
+
580
+ for ( let mapX = startX ; mapX <= endX ; mapX ++ ) {
581
+ for ( let mapY = startY ; mapY <= endY ; mapY ++ ) {
582
+ const xteaRegion = xteaRegions [ `l${ mapX } _${ mapY } ` ] ;
579
583
for ( let seeds = 0 ; seeds < 4 ; seeds ++ ) {
580
- if ( xteaRegion ) {
581
- packet . put ( xteaRegion . key [ seeds ] , 'INT' ) ;
582
- } else {
583
- packet . put ( 0 , 'INT' ) ;
584
- }
584
+ packet . put ( xteaRegion ?. key [ seeds ] || 0 , 'int' ) ;
585
585
}
586
586
}
587
587
}
0 commit comments