跳到正文

Mad Hatter

作者:Parax342

Over 30 cosmetic hats & an easy-to-use API

收藏

介绍

中文介绍正在准备中,下面暂时显示原文。

Warning! By default, Modrinth does not download the REQUIRED resource pack. You must go to the versions page and download it yourself!

_If you have questions, issues, suggestions, or want your hats included in the pack (with credit), contact my discord @parax342_

mad hatter logo

Information

This datapack adds 30+ unique cosmetic hats that you can apply to any helmet in your world. Any player will be able to see your hats so long as they have the resourcepack. Only the server needs to run the datapack.

Type /trigger hat_menu to pull up a click-menu in chat. Hold any helmet in your mainhand & select whatever hat you want. The helmet’s defense stats, durability, etc. will all be unaffected by turning into a hat.

The resource pack is REQUIRED, even if you don’t plan to use the built-in hats. If you don’t want the built-in hats, you can remove them from the datapack . All players will need to download the resource pack (or you can make it a server resource pack), or else the hats will show up as missing models.

My main goal with this pack is to make it easy to add your own hats, a tutorial is further down. Any packs that are built off of this one must use it as a dependancy

This pack aims to be compatible with all/most mods & datapacks that add custom items. Any item in #minecraft:head_armor can be turned into a hat. When being turned into a hat, the item will back up any components the hat overrides, and then restore them when the hat is removed.

The components that get overridden are minecraft:equippable, minecraft:item_model, and minecraft:enchantment_glint_override. All of these components are purely cosmetic.

Making your own hats

Any pack of custom hats consists of two parts, the resourcepack and the datapack.

For your resourcepack, you don’t need to do anything special, just add your models.

For the datapack, the process is very simple:

  1. Create your hat registry (a regular mcfunction file in your datapack)
  2. Add the function to #paraxs_hats:hat_registries
  3. Add hats to your function (see below)

To add hats, there are two functions you can use:

  • paraxs_hats:internal/register_hat to add solo hats
  • paraxs_hats:internal/register_hat_group to add hats with variants

paraxs_hats:internal/register_hat has two parameters – model and name. model is the path of the model inside the resource pack, and name is what the hat displays as in the menu.

paraxs_hats:internal/register_hat_group also has two parameters – name and hats. name is still what the hat displays as in the menu, while hats is a stringified JSON array of hats with their own model and name. The name of each hat in the array appears as hovertext in the menu and should be used to denote the variant.

Placing either of the below examples into a hat registry would register a solo pirate hat or a football helmet with two colored variants respectively:

  • function paraxs_hats:internal/register_hat with {"name":"Pirate Hat","model":"my_hats:pirate_hat"}
  • function paraxs_hats:internal/register_hat_group with {"name":"Football Helmet","hats":'[{"name":"Red","model":"my_hats:red_football_helmet"},{"name":"Blue","model":"my_hats:blue_football_helmet"}]'}

_Any packs that use this API must have this datapack & resourcepack as a dependency, or else they will not work!_
_If you are having issues adding hats, contact me on discord @parax342_

常见问题

Mad Hatter 支持哪些 Minecraft 版本?

Mad Hatter 支持 Minecraft Java 版 1.21.2–1.21.11,共 8 个版本。下载时注意选择和你游戏版本一致的文件。

Mad Hatter 怎么安装?

新建世界时在「数据包」里把下载的 .zip 拖进去;已有的存档,把文件放进存档目录下的 datapacks 文件夹,进游戏输入 /reload 即可生效。服务器同样放在世界目录的 datapacks 里。

评论

登录后评论和评分

Parax342 的其他作品

查看全部 →