COWMODSКаталог модов

Custom Item API

An API to make your own custom blocks and custom items.

Автор: Senne2 тыс.12обновлён 18 мая 2024 г.
ДекорМеханики игрыБиблиотеки

Описание

An API for making custom blocks and items for 1.20+ on paperMC

How to use?

Data driven blocks and items

Create a 'pack'

To create custom items and blocks in this way, you will have to create a 'pack' similar to a datapack or a resource pack. The file structure of which looks like this:

- <namespace>
   - blocks
      - default_block
      - transparent_block
   - items

The namespace of your pack will be what shows before the item id in the give command namespace:item_id.

Add items

To add an item you just need to create a json and put it in the items folder. The name of the file will become the item id.

Add blocks

To add a block you need to create a json. If you want it to be a transparent block, you need to put it in the transparent_block folder. It is recommended to use a block that is transparent as the placed_block, otherwise it might look weird. If you want a normal block you put the json in the default_block folder. The name of the file will become the block id, for good practice you should make this id the same as the id of its item but it's not required.

Use a 'pack'

To use a 'pack' you need to put it in the packs folder, this can be found by going in the plugins folder and then the custom_item_api folder.

- plugins
   - Custom_Item_Api
	- packs

Add blocks and items with a plugin

Custom items

You can add a custom item by creating a new CustomItem(Material material, NamespacedKey key, Class actions). This will create the custom item if there isn't a custom item with this NamespacedKey. The actions define what should happen when the item is clicked, it's a class that implements CustomItemActions. You can change the texture,tags,... If you want to place a custom block using this item you can add this with CustomItem#setCustomBlock(NamespacedKey)

example:

NamespacedKey itemKey = new NamespacedKey(plugin, "example_item");
CustomItem customItem = new CustomItem(Material.FURNACE, itemKey, Class.forName("org.super_man2006.custom_item_api.utils.items.EmptyCustomItemAction"));
customItem.setCustomBlock(blockKey);
customItem.setName(Component.text("Example"));

Custom blocks

You can add a custom item by creating a new CustomBlock(Material material, NamespacedKey key, Class actions, Material placedBlock). This will create the custom item if there isn't a custom item with this NamespacedKey. The actions define what should happen when the block is placed/broken/clicked on, it's a class that implements CustomBlockActions. You can change the texture,tags,... The block uses an item texture, NOT a block texture. This means that if you set custom model data (cmd) you can change the texture. If you want to drop a custom item after breaking this block you made with CustomBlock#setDropItem(NamespacedKey)

example:

NamespacedKey blockKey = new NamespacedKey(plugin, "example_block");
CustomBlock customBlock = new CustomBlock(Material.FURNACE, blockKey, Class.forName("org.super_man2006.custom_item_api.utils.blocks.EmptyCustomBlockAction"), Material.STONE);
customBlock.setRotation(CustomBlock.Rotation.AROUND_Y);

Features / Bugs

If you find bugs or want a feature to be added, ask in the discord or create an issue on github.

Галерея

Последние версии

Все версии →
release

Custom Item API 5.5

5.5
18 мая 2024 г.782Minecraft: 1.20.6, 1.21paper
Скачать
Что нового
Updated to Minecraft 1.20.6 and Java 1.21 **Full Changelog**: https://github.com/Senne98/Custom-Item-Api/compare/Custom_Item_Api-5.4...Custom_Item_Api-5.5
release

Custom Item API 5.4

5.4
11 мар. 2024 г.252Minecraft: 1.20, 1.20.1, 1.20.2, 1.20.3, 1.20.4paper
Скачать
Что нового
## What's Changed * Performance in https://github.com/Senne98/Custom-Item-Api/pull/10 * Optimized light updates of custom blocks **Full Changelog**: https://github.com/Senne98/Custom-Item-Api/compare/Custom_Item_Api-5.3...Custom_Item_Api-5.4
release

Custom Item API 5.3

5.3
28 февр. 2024 г.92Minecraft: 1.20, 1.20.1, 1.20.2, 1.20.3, 1.20.4paper
Скачать
Что нового
## What's Changed * org.super_man2006.custom_item_api.utils.blocks.EmptyCustomItemAction to org.super_man2006.custom_item_api.utils.items.EmptyCustomItemAction * Pdc for all blocks * only save permissions if a player gained or lost a permission * Remove unused code **Full Changelog**: https://github.com/Senne98/Custom-Item-Api/compare/Custom_Item_Api-5.2...Custom_Item_Api-5.3
release

Custom Item API 5.2

5.2
27 февр. 2024 г.91Minecraft: 1.20, 1.20.1, 1.20.2, 1.20.3, 1.20.4paper
Скачать
Что нового
## What's Changed * permissions get saved now when the server restarts **Full Changelog**: https://github.com/Senne98/Custom-Item-Api/compare/Custom_Item_Api-5.1...Custom_Item_Api-5.2
release

Custom Item API 5.1

5.1
21 февр. 2024 г.98Minecraft: 1.20, 1.20.1, 1.20.2, 1.20.3, 1.20.4paper
Скачать
Что нового
Added a notification when a new version is available. Give log info about every block and item that is loaded. **Full Changelog**: https://github.com/Senne98/Custom-Item-Api/compare/Custom_Item_Api-5.0...Custom_Item_Api-5.1
release

Custom Item API 5.0

5.0
20 февр. 2024 г.77Minecraft: 1.20, 1.20.1, 1.20.2, 1.20.3, 1.20.4paper
Скачать
Что нового
## What's Changed * Added a way to create data driven blocks and items with 'packs'. * Added ``customapi`` command with ``permission/help/give`` to use the commands you need to be given op with ``/cia permission give <player> op``, or the ``givecmd`` to use the ``give`` command. * Added a [wiki](https://github.com/Senne98/Custom-Item-Api/wiki) ## code changes * Data driven blocks by @Senne98 in https://github.com/Senne98/Custom-Item-Api/pull/3 **Full Changelog**: https://github.com/Senne98/Custom-Item-Api/compare/Custom_Item_Api-4.1...Custom_Item_Api-5.0
release

Custom Item API 4.1

4.1
4 янв. 2024 г.91Minecraft: 1.20, 1.20.1, 1.20.2, 1.20.3, 1.20.4paper
Скачать
Что нового
Features: - Changed customBlockActions: you now need to give the class (with .getClass) instead of an Instance. - Custom blocks can now drop vanilla items.
release

Custom Item API 4.0

4.0
22 дек. 2023 г.79Minecraft: 1.20, 1.20.1, 1.20.2, 1.20.3, 1.20.4paper
Скачать
Что нового
## Features * Added Transparent blocks * Added the ability to choose the block placed at the 'core' of a custom block
release

Custom Item API 3.0

3.0
25 окт. 2023 г.148Minecraft: 1.20, 1.20.1, 1.20.2paper
Скачать
Что нового
Features: - Added ```CustomBlockActions``` and ```CustomItemActions```, which can be used to add your own features to items and blocks. - Items and blocks are no longer saved in an external file, the plugin that adds the block/item should always be in the plugin folder. (The plugin doesn't need to save it themselves, but they need to initialize the block/item every time the server starts) If you have any questions about these changes you can ask them in the discord.
release

Custom Item API 2.0-SNAPSHOT

2.0-SNAPSHOT
8 сент. 2023 г.126Minecraft: 1.20, 1.20.1, 1.20.2paper
Скачать
Что нового
Bug Fixes: - Pistons could move the block "inside" the custom block Features: - Pistons can no longer move custom blocks.