MZ Set height of Window_EventItem (RMMZ)

Hi!

I recently started porting my MV game into MZ and here is the problem: I wanted the "Select Item" window to have 3 instead of 2 columns, so I opened rmmz_windows.js and modified
Window_ItemList.prototype.maxCols = function() {
return 2;
};
into 3.

This worked, but now the Select Item window shows an extra row (I have 9 items) and I don't know how to modify it to only have 3 rows instead of four.

Can anybody help me please? Thanks!
Try this, seems to work for me~
JavaScript:
(alias => {
  Window_ItemList.prototype.initialize = function() {
    alias.apply(this, arguments);
    this.move(this.x, this.y, this.width, this.fittingHeight(3));
  };
})(Window_ItemList.prototype.initialize);
I.e. after the default initialize routine, move the window to its current position with only 3 rows of height. 🙂

Edit @dyoghenes: just noticed you mentioned editing the core scripts, which is inadvisable! 👋

I'd suggest putting my script, plus your override, in a .js file (Save As > File Type: All Files, Filename: whatever.js), putting that file in your project's js/plugins folder, and importing as a plugin through Tools > Plugin Manager in the editor. This allows you to preserve the core scripts (very helpful for support reasons!) as well as track and enable/disable your edit(s) at will. 😮‍💨
Thank you so much! It worked perfectly! I also reverted the core script change, thanks for the tip!

Original thread: https://forums.rpgmakerweb.com/threads/set-height-of-window_eventitem-rmmz.126224/