Compatibility
Minecraft: Java Edition
Platforms
Supported environments
Links
Tags
Creators
Details
Display Delight looks great. However, you might want to have some mods other than its support list in your modpack, so I've introduced the ability to register more placable foods with KubeJS. This mod is dedicated for modpacks, feel free to use it anywhere.
How to use this
Display Delight uses its naming convention (see its github page) not only for organizing, but also for loot table, item placing, etc. A food block id should look like abbr_food_name for foods without plate, and abbr_plated_food_name for foods on plates, and abbr_small_plated_food_name for foods on small plates. Food blocks registered in wrong id won't work as intended!
For technical reasons, a full registration is split in three parts. In this demo we use several items from Fruits Delight as an example:
- First register the abbr -> full modid map in startup init:
StartupEvents.init(event => {
DisplayDelight.addCompatAbbr("frd", "fruitsdelight");
});
- Second register the actual food block with a custom BlockBuilder:
StartupEvents.registry('block', event => {
event.create("frd_plated_cranberry_cookie", "displaydelight:stackable_plated")
.maxDisplayStack(4);
event.create("frd_glowberry_jello", "displaydelight:food");
});
For full custom BlockBuilder reference list, see project wiki page. Most methods should work as intended for the custom builder, except for loot tables (Display Delight uses hardcoded loot). For stackable food, use maxDisplayStack() to set the max count.
- Finally register the food item as placable by tag:
ServerEvents.tags('item', event => {
event.add("displaydelight:plate_displayable", "fruitsdelight:cranberry_cookie");
event.add("displaydelight:displayable", "fruitsdelight:glowberry_jello");
});
For non-stackable food block, the model assets are in their regular place; for stackable food block, the model use suffix _1, _2, ..., up to the maximum stack. As of this demo, the models required are block/frd_glowberry_jello.json, block/frd_plated_cranberry_cookie_1.json, block/frd_plated_cranberry_cookie_2.json, ... block/frd_plated_cranberry_cookie_4.json.
Display Delight only use two parts in its blockstate definition, the supports and the main model. The plate is contained in the model, and the plate hidden feature is implemented by directly modifying baked model, rather than blockstate definition. In Display Delight JS, it's possible to use both way. Just call noModelModify(true) in block registry, and you can manually build your plate hidden model at block/<normal model>_plate_hidden.json.
As of this demo, now we've got two fully working food display: (I'm not artist, it just works)

Changes to original mod behaviour
There are several configuration based behaviour change to the original mod (not active by default; available without KubeJS). I've also made the "Appers in ... mod" tooltip use translate keys instead of hardcoded values for mod names. This change isn't configurable.


