import{system as t,world as e,EntityComponentTypes as s,EquipmentSlot as i}from"@minecraft/server";const n=new Map;n.clear();const a=["ftb_sd:drawers"];class r{constructor(t){this.justJumped=!1,this.state={sneaking:!1,currentHandItem:null,jumping:!1},this.player=t}tick(){this.player&&(this.player.isJumping&&!this.justJumped&&this.playerJumped(),!this.player.isJumping&&this.player.isOnGround&&this.justJumped&&(this.justJumped=!1))}playerJumped(){const t=this.player.getComponent(s.Equippable);if(!t)return;const e=t.getEquipment(i.Mainhand);e&&a.forEach((t=>this.closeBlook(e,t)))}closeBlook(t,e){t.typeId.startsWith(e+"_")&&(this.player.runCommand("playsound item.book.page_turn @a ~~~"),this.player.runCommand(`replaceitem entity @s slot.weapon.mainhand 0 ${e}`))}}t.runInterval((()=>{for(const t of e.getAllPlayers())if(n.has(t.id))n.get(t.id)?.tick();else{const e=new r(t);n.set(t.id,e)}}));
