-
Notifications
You must be signed in to change notification settings - Fork 17
Wooden Items
Wooden Items refers specifically to Blocks and Items that can be crafted out of any wood, vanilla or modded, which this library provides. This information is stored in the petrolpark:wood Data Component (for Items).
Wooden Item models use the relevant oak texture for any texture that should change based on the wood the Item is made of. At runtime, the oak textures will be replaced with the textures for the correct wood.
To create a model for a Wooden Item, use the petrolpark:wooden Geometry Loader and place the file in the usual place. This has a single parameter, template, which should be the model of the item with the oak equivalent for all wood textures. For example, the following just copies the model for Logs:
{
"loader": "petrolpark:wooden",
"template": {
"parent": "minecraft:block/cube_column",
"textures": {
"end": "minecraft:block/oak_log_top",
"side": "minecraft:block/oak_log"
}
}
}The textures which will be replaced are unfortunately hard-coded, and are limited to:
minecraft:block/oak_planksminecraft:block/oak_logminecraft:block/oak_log_topminecraft:block/stripped_oak_logminecraft:block/stripped_oak_log_topminecraft:block/oak_leavesminecraft:block/oak_door_topminecraft:block/oak_door_bottomminecraft:block/oak_trapdoor
For each texture, the library will try to search for the matching texture for the type of wood given in the petrolpark:wood Data Component. Each texture will default to oak. Wooden Items will have their wood automatically applied to the model, but for Blocks this information must be supplied manually.
For your Item to be crafted from arbitrary wood types, you must use a petrolpark:wooden_crafting_shaped Recipe. This is formatted like a vanilla shaped Recipe, with the exception that certain symbols are reserved for certain Item tags. These are:
-
Pfor planks (taggedminecraft:planks) -
sfor slabs (taggedminecraft:wooden_slabs) -
Sfor stairs (taggedminecraft:wooden_stairs) -
Ffor fences (taggedc:fences/wooden) -
Gfor fence gates (taggedc:fence_gates/wooden) -
bfor buttons (taggedminecraft:wooden_buttons) -
Lfor logs (taggedminecraft:logs) -
lfor stripped logs (taggedc:stripped_logs) -
Efor leaves (taggedminecraft:leavesorminecraft:wart_blocks) -
Afor saplings (taggedminecraft:saplings) -
pfor pressure plates (taggedminecraft:wooden_pressure_plates) -
Dfor doors (taggedminecraft:wooden_doors) -
Tfor trapdoors (taggedminecraft:wooden_trapdoors) -
Ifor signs (taggedminecraft:signs) -
Hfor hanging signs (taggedminecraft:hanging_signs) -
Bfor boats (taggedminecraft:boats)
When the Wooden Item is crafted, all Ingredients conforming to those listed above must be the same wood type, and this wood will be conferred to the output. Any Ingredients with the petrolpark:wood Data Component must also match. Your recipe must include at least one of the Ingredients listed above to parse correctly (as otherwise there is no way of knowing which wood to confer to the result).
For your Wooden Item to be placeable, the type of wood must be stored, so it must be a Block Entity. It must:
- Confer the wood type of the Item to the Block when it is placed
- Supply the wood to the model
- Confer the wood type to the Item when the Block is broken
This is done for you if you extend WoodenBlockEntity and include the appropriate function in the Loot Table file:
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"functions": [
{
"function": "minecraft:copy_components",
"include": [
"petrolpark:wood"
],
"source": "block_entity"
}
],
"name": "mymod:my_wooden_block"
}
],
"rolls": 1.0
}
],
"random_sequence": "mymod:blocks/my_wooden_block"
}That Loot Table would be generated by something like this:
lootTable()
.withPool(
lt.applyExplosionCondition(MY_WOODEN_ITEM, lootPool()
.setRolls(ConstantValue.exactly(1f))
.add(lootTableItem(b).apply(CopyComponentsFunction.copyComponents(CopyComponentsFunction.Source.BLOCK_ENTITY)
.include(PetrolparkDataComponentTypes.WOOD)
))
)
)Flags than can be applied to Item Stacks and other objects and will propagate through crafting
Timers that can be attached to Item Stacks to modify them after a given time, no matter what Inventory they are in
A way for mods to detect groupings of Players and store information on these groupings
Manipulation of Loot Table randomness and other RNG to give desired Items
Additional inventory and hotbar slots for the Player
Blocks and Items that have variants craftable from any mod's wood
Data-driven modifications to existing Loot Tables with greater versatility than NeoForge Global Loot Modifiers
Data-driven changes to the world (give Items, XP, unlock Villager Trades)
Levelable "Shops" shared between Teams giving Rewards for randomly-generated Item requests
Additional implementations of vanilla's Number Providers used in Loot Tables and Advancements
Extension of NeoForge Ingredients to include descriptions and Loot Table forcing
Work with automatically-detected "compression" Recipes (e.g. Nuggets <-> Ingots <-> Blocks)
Recycling (page under construction)
Balanced and versatile "uncrafting" API
Gating Recipes for vanilla and modded Items behind Item unlocks
1.3.1, 1.3.2, 1.3.3, 1.3.4
1.4.0, 1.4.1, 1.4.2, 1.4.3, 1.4.4, 1.4.5, 1.4.6, 1.4.7, 1.4.8, 1.4.9, 1.4.10, 1.4.11, 1.4.12, 1.4.13, 1.4.14, 1.4.15, 1.4.16, 1.4.17, 1.4.18, 1.4.19, 1.4.20, 1.4.21, 1.4.22, 1.4.23, 1.4.24, 1.4.25, 1.4.26