import{Direction as t,ItemStack as e}from"@minecraft/server";import{DisplayContext as r}from"./context";export class WeaponStand{_allowedTags=["minecraft:is_tool","minecraft:is_trident"];type;constructor(t){this.type=t}typeId(){return`bc_ds:${this.type}_weapon_stand`}supportsItem(t){return this._allowedTags.filter(e=>t.hasTag(e)).length>0}displayContext(){return r.WeaponStand}maxStackSize(){return 1}maxItems(){return 4}lockedRotation(){return!0}calculateBestIndex(e,r,s){if(this.isSameAxis(e,r))return r===t.North||r===t.South?Math.abs(("south"===e?-5:0)+Math.ceil(s.x/.25)):Math.abs(("west"===e?-5:0)+Math.ceil(s.z/.25));switch(e){case"north":if(r===t.West)break;if(r===t.East)return 4;return Math.abs(Math.ceil(s.x/.25));case"east":if(r===t.North)break;if(r===t.South)return 4;return Math.abs(Math.ceil(s.z/.25));case"south":if(r===t.East)break;if(r===t.West)return 4;return Math.abs(5-Math.ceil(s.x/.25));case"west":if(r===t.South)break;if(r===t.North)return 4;return Math.abs(5-Math.ceil(s.z/.25))}return 1}isSameAxis(t,e){switch(t=t.toLowerCase(),e=e.toLowerCase(),t){case"up":case"down":return"up"===e||"down"==e;case"north":case"south":return"north"===e||"south"===e;case"east":case"west":return"east"===e||"west"===e}return!1}calculateRotation(t,e){return({north:4,east:6,south:0,west:2})[e]}}