[Mod] hotbar [v0.1.5a][hotbar]

User avatar
aristotle
Member
Posts: 79
Joined: Wed Mar 14, 2018 23:40
GitHub: askotos
IRC: aristotle_
In-game: aristotle
Location: Currently on Melpomene, waiting for the starship to be fixed.
Contact:

[Mod] hotbar [v0.1.5a][hotbar]

by aristotle » Post

This (my very first MT) mod adds one command:

hotbar

to control the slots number and the mod current behavior besides showing its settings.

The idea comes from the empowered hotbar I always miss when I cannot run VanessaE's Dreambuilder modpack.


Syntax
hotbar [size|mode]

By itself, hotbar displays the hotbar slots number and the current hotbar mode in the chat;
when it is followed by a number in the correct range that is currently [0,23], it accordingly sets the new slots number.
If set to zero, the hotbar gets hidden together with the wielded item and the hand: to restore everything you just need to set a slots number greater than zero.
Again, the command can be even invoked followed by one of the supported modes: LEGACY, WORLD, SESSION.

At startup, the mod should by default automatically choose the best supported mode, but - if supported and possible - its behavior can be overridden at any time.
In singleplayer, WORLD is the suggested mode for a MT v0.4.16+ client: the slots size can be in fact set to a different value in each world.
LEGACY will instead force a global slots number to be managed, saved and retrieved: this is the only mode a MT < 0.4.16 will be set to in singleplayer.
On a server, SESSION is the only supported mode: no data is saved and each user should be able to set an independent slots number every time he/she logs in.

Features
It may permanently store the user's preferences by setting and retrieving the hotbar_slots and the hotbar_mode keys in the minetest configuration file.
On recent MT clients, the mod_storage API can be used and is the preferred storage.

Usage Examples

] hotbar
issued command: /hotbar
[_] WORLD / 10
<== Chat output (note inside the square brackets the underscore: that tells us that MineTest is running in singleplayer mode - not connected to a server - otherwise our nickname would replace it).

] hotbar 4
issued command: /hotbar 4
[_] Hotbar slots number set to 4.
<== We have overridden the default value in the current world / map.

] hotbar legacy
issued command: /hotbar legacy
[_] Hotbar slots number set to 16.
<== Each mode has a default value that can be changed at any time.
[_] Hotbar mode changed to LEGACY. <== Changing hotbar mode in singleplayer is possible at any time: no restart is required.

] hotbar world
issued command: /hotbar world
[_] Hotbar slots number set to 4.
<== The value we had set before in the current world has been restored.
[_] Hotbar mode changed to WORLD. <== This is in fact the hotbar mode we have chosen.

... We can then have a look at what happens when we connect to our home server. Let's start it with something like this:
[mynick@mylinuxbox] minetestserver --terminal --logfile /home/mynick/.minetest/RevolutionaryArchitect.log --worldname RevolutionaryArchitect --verbose
Lots of stuff follows... when all those text messages end and the server is up, we are ready to connect to it from the Play Online tab of our latest MineTest client!
Once we are in, we start checking how the mod we have used before in singleplayer has been automatically loaded:

] hotbar
issued command: /hotbar
[mt_super_nick] SESSION / 12
<== Chat output (note inside the square brackets our nickname: that tells us that MineTest is running in server mode). As specified before, the only supported mode on a server is SESSION and that allows temporary changes to the player's hotbar. At every login, in fact, the default hotbar size will be automatically set.

] hotbar 18
issued command: /hotbar 18
[mt_super_nick] Hotbar slots number set to 18.
<== The default temporary value (currently 12) has been overridden by ours: 18.

When MT is run as a server, SESSION should be the only supported hotbar mode: let's check if that is true!

] hotbar legacy
issued command: /hotbar legacy
[mt_super_nick] LEGACY mode cannot be set on a server.
<== Once again the world has not exploded. :P


Future Improvements (I am currently working on while offline for some time)
v0.1.6
- Some interface fixes.
v0.1.7
- A ClientMod? (Still not sure)

Browse the source code on github
Download Latest - v0.1.5a
Previous versions
hotbar-master-v0.1.4.zip
(70.34 KiB) Downloaded 133 times
hotbar-master-v0.1.3.zip
(67.69 KiB) Downloaded 76 times
Changelog
v0.1.5a
- luacheck activation.
- FIXES:
- Fraction control was bypassed in get_and_set_initial_slots for an already existing legacy mode value.
- A possible float in minetest.conf or in the modstorage is now automatically converted into an int.
- normalize() scope is now local
v0.1.5
- Some code refactoring: hotbar and hotbar_mode have been merged into just hotbar.
- FIXES:
- Some feedback messages did not report the player's name.
v0.1.4
- Three modes have been identified: LEGACY, WORLD, SESSION.
- The slots number has been extended to include the zero.
- FIXES:
- The accepted slots number is now checked to cut out fractions
v0.1.3
- New update to assure the full API support because the v0.1.2
update seems to have gone wrong for some reason. (SORRY!)
The accepted slots number should now be in the range [1,23]
v0.1.2
- The size range [1,23] specified by the API is now fully supported
- Some textures have been added, others modified, some renamed
v0.1.1
- Small bug fix (the error message was not displayed when the slots number was out of the accepted range)
- Range extension from [4,16] to [1,16]
- Some code clean up
v0.1.0
- The hotbar is now correctly resized even when there are no items in it.

Sample screenshots:

5 slots
Image

12 slots
Image

16 slots
Image

4 empty slots
Image
Last edited by aristotle on Mon Aug 27, 2018 18:32, edited 22 times in total.
Happy builds & explorations! | Initiating my Creative Minetest channel on YouTube

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [Mod] hotbar v0.1

by azekill_DIABLO » Post

+1 some image would make the post more attractive
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

User avatar
GamingAssociation39
Member
Posts: 858
Joined: Mon Apr 25, 2016 16:09
GitHub: Gerold55
IRC: Gerold55
In-game: Gerold55
Location: Maryland, USA

Re: [Mod] hotbar v0.1

by GamingAssociation39 » Post

Image
Attachments
Hotbar.png
Hotbar.png (632.27 KiB) Viewed 1980 times
Jesus Is Lord and Savior!!!

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [Mod] hotbar v0.1

by azekill_DIABLO » Post

Clap clap clap!
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

User avatar
aristotle
Member
Posts: 79
Joined: Wed Mar 14, 2018 23:40
GitHub: askotos
IRC: aristotle_
In-game: aristotle
Location: Currently on Melpomene, waiting for the starship to be fixed.
Contact:

Re: [Mod] hotbar v0.1.1

by aristotle » Post

Version 0.1.1 is out.
The selectable range size has been extended and a small bug has been fixed (an error message was not shown when the received size was out of range).
Thanks for the support and the interest shown.
Happy builds & explorations! | Initiating my Creative Minetest channel on YouTube

User avatar
aristotle
Member
Posts: 79
Joined: Wed Mar 14, 2018 23:40
GitHub: askotos
IRC: aristotle_
In-game: aristotle
Location: Currently on Melpomene, waiting for the starship to be fixed.
Contact:

Re: [Mod] hotbar v0.1.2

by aristotle » Post

Version 0.1.2 is out.
The hotbar slots number can now be in the range [1,23], as specified by the Minetest API.
Happy builds & explorations! | Initiating my Creative Minetest channel on YouTube

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [Mod] hotbar v0.1.2

by azekill_DIABLO » Post

who can have 23 slots on screen?
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

User avatar
aristotle
Member
Posts: 79
Joined: Wed Mar 14, 2018 23:40
GitHub: askotos
IRC: aristotle_
In-game: aristotle
Location: Currently on Melpomene, waiting for the starship to be fixed.
Contact:

Re: [Mod] hotbar v0.1.2

by aristotle » Post

azekill_DIABLO wrote:who can have 23 slots on screen?
Here it is:
Image

The image you see now is 918x512 pixels, but the original, before scaling it down is 3674x2049.
:P
Taken from a 4K display :D
Happy builds & explorations! | Initiating my Creative Minetest channel on YouTube

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [Mod] hotbar v0.1.2

by azekill_DIABLO » Post

:P I don't have a big screen enough!
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

User avatar
aristotle
Member
Posts: 79
Joined: Wed Mar 14, 2018 23:40
GitHub: askotos
IRC: aristotle_
In-game: aristotle
Location: Currently on Melpomene, waiting for the starship to be fixed.
Contact:

Re: [Mod] hotbar v0.1.2

by aristotle » Post

azekill_DIABLO wrote::P I don't have a big screen enough!
4K is a *very* rare screen resolution indeed: in the 80's, instead - in a previous life of mine - i was used at working on CRT monitors which had more than 5000 pixels on their longer side: does anyone remember the TARGA Vision expansion boards? those which stored images in .tga files? it was the time in which personal computers were still running MS-DOS/PC-DOS 2.x/3.x and the commonly used video boards were monochrome (Hercules) and - rarely - CGA or EGA (4 and 16 colors at most)...
Today monitors are safer (no more X rays), but - 30 years later - still far from those professional standards.
We might say the API and the mod are 4k ready, I guess. LOL
Happy builds & explorations! | Initiating my Creative Minetest channel on YouTube

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [Mod] hotbar v0.1.2

by azekill_DIABLO » Post

#4Kminetest
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

User avatar
aristotle
Member
Posts: 79
Joined: Wed Mar 14, 2018 23:40
GitHub: askotos
IRC: aristotle_
In-game: aristotle
Location: Currently on Melpomene, waiting for the starship to be fixed.
Contact:

Re: [Mod] hotbar v0.1.3

by aristotle » Post

A new updated version is available.
For further info, please read the Changelog paragraph in the first message of the thread.
Thank you, _Xenon!
Happy builds & explorations! | Initiating my Creative Minetest channel on YouTube

User avatar
Stix
Member
Posts: 1385
Joined: Fri Aug 04, 2017 14:19
IRC: nil
In-game: Stix [+alts]
Location: USA

Re: [Mod] hotbar v0.1.3

by Stix » Post

This mod is now in use on the PRO SKYBLOCK server viewtopic.php?f=10&p=326536#p326498 :)
Hey, what can i say? I'm the bad guy.

User avatar
aristotle
Member
Posts: 79
Joined: Wed Mar 14, 2018 23:40
GitHub: askotos
IRC: aristotle_
In-game: aristotle
Location: Currently on Melpomene, waiting for the starship to be fixed.
Contact:

Re: [Mod] hotbar v0.1.3

by aristotle » Post

Stix wrote:This mod is now in use on the PRO SKYBLOCK server viewtopic.php?f=10&p=326536#p326498 :)
Thank you for letting me know about it. I am pleased and honored. :D
Happy builds & explorations! | Initiating my Creative Minetest channel on YouTube

User avatar
bosapara
Member
Posts: 637
Joined: Fri Apr 07, 2017 08:49

Re: [Mod] hotbar v0.1.3

by bosapara » Post

Stix wrote:This mod is now in use on the PRO SKYBLOCK server viewtopic.php?f=10&p=326536#p326498 :)
Actually im using different thing:

Code: Select all

minetest.register_chatcommand("setbar", {
	params = "",
	description = "Sets the size of your hotbar. 1 - 16",
	privs = {interact=true},
	func = function(name, param)
		if param == "" then
			minetest.chat_send_player(name, "Use a number from 1 - 16")
			return
		end
		if type(tonumber(param)) ~= "number" then
			minetest.chat_send_player(name, "This is not a number.")
			return
		end
		if tonumber(param) < 10 or tonumber(param) > 16 then
			minetest.chat_send_player(name, "The number of slots must be between 8 and 16.")
			return
		end
		local player = minetest.get_player_by_name(name)
		player:hud_set_hotbar_itemcount(tonumber(param))
		player:hud_set_hotbar_image("")
	end,
})

User avatar
GreenXenith
Member
Posts: 1356
Joined: Wed Oct 28, 2015 01:26
GitHub: GreenXenith
Location: UTC-8:00
Contact:

Re: [Mod] hotbar v0.1.3

by GreenXenith » Post

Image
Hmmmm, might wanna check for and disallow fractions (:
YouTube | Mods | Patreon | Minetest Discord @greenxenith

You should not be able to read this message.

User avatar
aristotle
Member
Posts: 79
Joined: Wed Mar 14, 2018 23:40
GitHub: askotos
IRC: aristotle_
In-game: aristotle
Location: Currently on Melpomene, waiting for the starship to be fixed.
Contact:

Re: [Mod] hotbar v0.1.3

by aristotle » Post

bosapara wrote:
Stix wrote:This mod is now in use on the PRO SKYBLOCK server viewtopic.php?f=10&p=326536#p326498 :)
Actually im using different thing:

Code: Select all

minetest.register_chatcommand("setbar", {...
Thank you for clarifying this.
I am a newbie and I still cannot fully see how it could run on a server without further additions.
I am in fact creating a test server just now to deepen this aspect.
Happy builds & explorations! | Initiating my Creative Minetest channel on YouTube

User avatar
aristotle
Member
Posts: 79
Joined: Wed Mar 14, 2018 23:40
GitHub: askotos
IRC: aristotle_
In-game: aristotle
Location: Currently on Melpomene, waiting for the starship to be fixed.
Contact:

Re: [Mod] hotbar v0.1.3

by aristotle » Post

GreenDimond wrote:Image
Hmmmm, might wanna check for and disallow fractions (:
Thank you. I totally missed this check.
I will upload a fix asap!
Happy builds & explorations! | Initiating my Creative Minetest channel on YouTube

User avatar
aristotle
Member
Posts: 79
Joined: Wed Mar 14, 2018 23:40
GitHub: askotos
IRC: aristotle_
In-game: aristotle
Location: Currently on Melpomene, waiting for the starship to be fixed.
Contact:

Re: [Mod] hotbar v0.1.4

by aristotle » Post

Version 0.1.4 is out.

The hotbar slots number can now be different in each world.
Up to three different usage modes might exist for singleplayer (legacy, world, session) and one for servers (session).
The automatic mode detection should provide the suggested / supported one.
A first try to provide some server side initial customization has been done: further checks, modifications and feedback are needed before it might be possible to consider it stable.

For further info, please read the Changelog paragraph in the first message of the thread.
Happy builds & explorations! | Initiating my Creative Minetest channel on YouTube

User avatar
aristotle
Member
Posts: 79
Joined: Wed Mar 14, 2018 23:40
GitHub: askotos
IRC: aristotle_
In-game: aristotle
Location: Currently on Melpomene, waiting for the starship to be fixed.
Contact:

Re: [Mod] hotbar v0.1.5

by aristotle » Post

aristotle wrote:Version 0.1.4 is out.

The hotbar slots number can now be different in each world.
Up to three different usage modes might exist for singleplayer (legacy, world, session) and one for servers (session).
The automatic mode detection should provide the suggested / supported one.
A first try to provide some server side initial customization has been done: further checks, modifications and feedback are needed before it might be possible to consider it stable.

For further info, please read the Changelog paragraph in the first message of the thread.
Version 0.1.5 is out.

I could not live with a second command when one simply seemed to be just right. :D
Happy builds & explorations! | Initiating my Creative Minetest channel on YouTube

User avatar
aristotle
Member
Posts: 79
Joined: Wed Mar 14, 2018 23:40
GitHub: askotos
IRC: aristotle_
In-game: aristotle
Location: Currently on Melpomene, waiting for the starship to be fixed.
Contact:

Re: [Mod] hotbar v0.1.5a

by aristotle » Post

Version 0.1.5a is out.

Running luacheck as suggested by rubenwardy on his site made me fix a couple of things:
- normalize() scope is now local
- a few lines had their trailing blanks removed.

Furthermore a couple of "security fixes" have been applied to disallow/sanitize any floating value inside minetest.conf and the modstorage that might have potentially made the mod fail at load time.
Happy builds & explorations! | Initiating my Creative Minetest channel on YouTube

kestral
Member
Posts: 95
Joined: Mon Mar 27, 2017 21:56
GitHub: kestral246

Re: [Mod] hotbar v0.1.5a

by kestral » Post

I like this mod. I also miss the flexibility when I'm not using dreambuilder too. However, one thing I don't care for is the texture of the selection box—the purple is just a little too much for me.

Have you considered adding different versions of hotbar_selected_slot.png so that people can choose the one they prefer?

If so, here's a nice simple one you can add:

Image

https://github.com/kestral246/hotbar/bl ... d_slot.png

Edit: Add attribution. Based on new hotbar textures by paramat. I just made it flatter, lowered the contrast, and resized it to match this mod's size.

User avatar
aristotle
Member
Posts: 79
Joined: Wed Mar 14, 2018 23:40
GitHub: askotos
IRC: aristotle_
In-game: aristotle
Location: Currently on Melpomene, waiting for the starship to be fixed.
Contact:

Re: [Mod] hotbar v0.1.5a

by aristotle » Post

kestral wrote:I like this mod.
Thank you!
kestral wrote:Have you considered adding different versions of hotbar_selected_slot.png so that people can choose the one they prefer?
I did not, but this could be quite a nice addition! :D
I will work on it. :)
kestral wrote:Edit: Add attribution. Based on new hotbar textures by paramat. I just made it flatter, lowered the contrast, and resized it to match this mod's size.
Sure. I will. :)
Happy builds & explorations! | Initiating my Creative Minetest channel on YouTube

totya
Member
Posts: 29
Joined: Sat Sep 08, 2018 19:34

Re: [Mod] hotbar v0.1.5a

by totya » Post

Thank you for this mod!

Otherwise... do you plan "multibar" version from this mod, like as a minecraft mod?

User avatar
ManElevation
Member
Posts: 896
Joined: Tue Aug 02, 2016 22:04
GitHub: ManElevation
IRC: ManElevation
In-game: ManElevation
Location: Madrid,Spain

Re: [Mod] hotbar v0.1.5a

by ManElevation » Post

totya wrote:Thank you for this mod!

Otherwise... do you plan "multibar" version from this mod, like as a minecraft mod?
what do you mean?
My Public Mods! Discord: Rottweiler Games#3368

Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests