Custom Items (v1)
Format version 1 (legacy)
warning
format_version: 1 is no longer receiving updates. New features will only be added to format version 2.
JSON mappings (v1)
- Start your server, and you should have a folder called
custom_mappingsthat is created. That would be with the folder ofGeyser.jarfile for standalone and inside your Geyser data folder for a plugin. - Create a
.jsonfile, it can be any name you like and as many files as you like. You don't need to make one file per item. Here is the structure of the file:
{
"format_version": 1,
"items": {
}
}
- Inside the
itemsentry, you can add your java item to extend:
"minecraft:JAVA_ITEM": [
]
- Inside this java item, goes an array of all your custom items.
{
"name": "my_item"
}
- Then, you need to set one or more item options or registrations, they can be stacked, so that all of the specified types need to match.
- Custom model data:
custom_model_data(int) - Damage predicate:
damage_predicate(int) This is a fractional value of damage/max damage and not a number between 0 and 1. - Unbreakable:
unbreakable(boolean)
- Custom model data:
- You also have some extra modifiers that you can set to further customise your item. Note that the following modifiers are NOT required.
display_name(string) default: item nameicon(string) default: item nameallow_offhand(boolean) default: falsetexture_size(int) default: 16creative_category(int) default: not set. This can take values between 1-5, and defines the creative category the item appears in. Note: Adding your item to a creative category is needed if you want recipes that output this custom item to show up in the recipe book! However, including it does NOT mean you can get the custom item from the creative inventory.creative_group(string) default: not set. Requires a creative category to also be set - allows you to group the custom item in a sub-group. See here for all categories.render_offsets(object) It works as follows. Note that all the sub-objects are optional, except x, y and z. You can have for example only a main hand with a position, and noting else. default: no render offsettags(array) default: no tags. Allows defining tags that can be used in Molang queries. Example value: ["test:tag_one", "test:tag_two"].
"render_offsets": {
"main_hand": {
"first_person": {
"position": {
"x": 0,
"y": 0,
"z": 0
},
"rotation": {
"x": 0,
"y": 0,
"z": 0
},
"scale": {
"x": 0,
"y": 0,
"z": 0
}
},
"third_person": {
}
},
"off_hand": {
}
}
Geyser extensions (v1)
Extending a vanilla item (v1)
- Create your custom item options or registrations, to which you can add any of the following. They can be stacked, so that all of the specified types need to match, but you do NOT need all of them.
CustomItemOptions itemOptions = CustomItemOptions.builder()
.customModelData(1)
.damagePredicate(1) //This is a fractional value of damage/max damage and not a number between 0 and 1.
.unbreakable(true)
.build();
- Create your custom item, and store it somewhere:
CustomItemData data = CustomItemData.builder()
.name("my_item")
.customItemOptions(itemOptions)
.build();
- You have some modifiers that you can set to further customise your item. Note that the following modifiers are NOT required.
.displayName("displayName"); //Default: item name
.icon("my_icon"); //Default: item name
.allowOffhand(false); //Default: false
.textureSize(16); //Default: 16
.renderOffsets(new CustomRenderOffsets(...)); //Default: no render offset
- Then, in your pre init event, you can register your item:
@Subscribe
public void onGeyserPreInitializeEvent(GeyserDefineCustomItemsEvent event) {
event.registerCustomItem("minecraft:JAVA_ITEM", data);
}
Non vanilla (modded) items with Geyser extensions (for example to use with Fabric) (v1)
- Create your item data:
NonVanillaCustomItemData data = NonVanillaCustomItemData.builder()
.name("my_item")
.identifier("my_mod:my_item")
.javaId(1)
- There are many other options you can set to match the behavior that you require for your item. You can see them here
- Register your item in the GeyserDefineCustomItems event:
@Subscribe
public void onGeyserDefineCustomItemsEvent(GeyserDefineCustomItemsEvent event) {
event.register(data);
}