Skip to content
Caltinor edited this page May 31, 2022 · 4 revisions

This page details the configuration details for jsons placed under /data/namespace/pmmo/items/.

File Naming Convention

Like all datapack jsons, the file name corresponds to the object path under the nested namespace. this means that data/minecraft/pmmo/items/stone.json corresponds to "minecraft:stone".

Base Template

This template lists all root fields for this configuration. all fields are optional

{
    "isTagFor":[],
    "xp_values":{},
    "nbt_xp_values":{},
    "requirements":{},
    "nbt_requirements":{},
    "bonuses":{},
    "nbt_bonuses":{},
    "negative_effect":{},
    "salvage":{},
    "vein_data":{}
}

the sections that follow will elaborate on each section

"isTagFor": []

When this tag is used, the file naming convention is ignored. Instead, the members of this array are used and all configurations in this file are applied to all of them. For example, if we wanted to give the same xp value for crafting stone tools we would define

"isTagFor": [
  "minecraft:stone_pickaxe",
  "minecraft:stone_shovel",
  "minecraft:stone_axe",
  "minecraft:stoen_hoe"
]

"xp_values":{} and "nbt_xp_values":{}

These setting determine what xp is given for this item for specific events. These two settings are mutually exclusive. If you have them both it won't crash anything, but the NBT setting will always supersede the regular one. An example default implementation for "xp_values" looks as follows:

"xp_values":{
  "CRAFT": {
    "crafting": 100,
    "smithing": 55
  },
  "ENCHANT": {
    "magic": 150
  }
}

In this example if we craft the item we will get 100 crafting XP and 55 smithing XP. if we enchant the item we get 150 magic XP. if we Smelt the item we get nothing since it is not defined. The NBT variant uses the same root=>Event structure however, instead of skills and experience there is an entirely different structure. You can read about that structure HERE

Valid Event Types For Items

ANVIL_REPAIR (when this is the output item)
BLOCK_PLACE (if this is a block item, the xp for placing the block)
BREW (as brew ingredient, output does not matter)
CONSUME (if eaten/drank)
CRAFT (when this is the output itemm)
ENCHANT (when enchants are added to this item)
FISH (when this is the item obtained from fishing)
SMELT (when this is the item being smelted/cooked, NOT the output)
ACTIVATE_ITEM (if this item has a right-click action, when that is activated)

"requirements":{} and "nbt_requirements":{}

These settings determine whether an item is permitted to perform a particular function/action. These two settings are mutually exclusive. If you have them both it won't crash anything, but the NBT setting will always supersede the regular one. An example default implementation for "requirements" looks as follows:

"requirements": {
  "TOOL": {
    "mining": 10,
    "excavation": 5
  },
  "WEAPON": {
    "combat": 10
  }
}

In this example the player must have 10 mining levels and 5 excavation levels to use this item as a tool. They must have 10 combat levels to use this item as a weapon, and if the item has a right click action, there is no requirement. The NBT variant uses the same root=>ReqType structure however, instead of skills and levels there is an entirely different structure. You can read about that structure HERE

Valid Req Types for Items

WEAR (for placing in armor slots, curio slots, or either hand)
TOOL (for use breaking blocks)
WEAPON (for use harming entities)
USE (the ability to right-click this item)
PLACE (if this is a block item, the ability to place it)
BREAK (if this is a block item, the ability to break it)
INTERACT (the ability to use this item on blocks/entities. eg gold on piglins)

"bonuses":{} and "nbt_bonuses":{}

These settings determine what bonuses the item gives when used in the prescribed way. These two settings are mutually exclusive. If you have them both it won't crash anything, but the NBT setting will always supersede the regular one. An example default implementation for "bonuses" looks as follows:

"bonuses": {
  "HELD": {
    "farming": 1.5,
    "flying": 0.25
  },
  "WORN": {
    "endurance": 2.0,
    "mining": 0.5
  }
}

In this example if the player holds the item either hand they get a 50% increase in farming XP and a 75% penalty on flying (reduced to 25% gain if that makes more sense). If the player is able to put this item into an armor/curio slot they instead get double xp in endurance and half xp in mining. The value used in this configuration is a raw multiplier of the XP. Therefore, a value of 1.0 does nothing. The NBT variant uses the same root=>Type structure however, instead of skills and multipliers there is an entirely different structure. You can read about that structure HERE

Valid Bonus Types For Items

HELD  (in either hand)
WORN  (in an armor/curio slot)

"negative_effect":{}

A negative effect is applied when the player holds/wears an item but does not meet the requirements. The format for this section is the ID of the status effect you want to give to the player. Modded status effects work as well as vanilla. the number is the level you want for the status effect. Zero is the lowest level. Here is an example configuration:

"negative_effect": {
  "minecraft:slowness": 0,
  "minecraft:mining_fatigue": 1
}

In this example the player will get a continuous slowness 1 and mining fatigue 2 while they hold this item without meeting it's requirement.

"salvage":{}

Salvage allows you to define what this item can salvage into if anything. Salvaging has two parts: the output items and their salvage chance info. To start simple, we are going to list all the items we want to return. for this example let's assume this is an enchanting table.

"salvage": {
  "minecraft:obsidian": {},
  "minecraft:diamond": {},
  "minecraft:book": {}
}

Before we get into the specific salvage settings, we can see that this item has values for each of the component items, but we don't have to just use recipe items. I could also put something like a nether_star as an output. What items salvage into is completely up to you. Perhaps you think that salvaging a stone pickaxe should give regular stone instead of cobblestone. That's up to you. each of this output items is a "salvage entry".

Next we have to define our salvage criteria for each item. Unlike other settings, all of these settings are mandatory though you may leave some of them empty. I will give examples of each. Here is each of the fields needed to set up salvage:

"chancePerLevel": {}, //a map of skills and decimals corresponding to the increased chance amount per level in that skill
"levelReq": {}, //a map of skills and levels necessary to unlock this salvage entry
"xpPerItem": {}, //a map of skills and xp to be awarded if this item is obtained from salvaging
"salvageMax": 1, //the total number of attempts at obtaining this item
"baseChance": 0.0, //the chance you get without any skill-based increases
"maxChance": 1.0 //the max chance you have regardless of skill level

Let's look at a more realistic example

"minecraft:obsidian": {
  "chancePerLevel": {
    "smithing": 0.05,
    "crafting": 0.01
  },
  "levelReq": {
    "mining": 50
  },
  "xpPerItem": {
    "smithing": 100
  },
  "salvageMax": 2,
  "baseChance": 0.25,
  "maxChance": 0.5
}

this salvage entry will attempt to give us Obsidian twice because of the salvageMax. Our base chance is 0.25 or 25% chance for each try. but if we have skill in smithing or crafting we get an extra 0.05 and 0.01 per level respectively. let's assume we are at 100 levels in both. That means we get an extra 5.0 and 1.0 chance respectively giving us a 625% chance. That means we would get it every time and get both except.... we have a maxChance of 0.5 which means that despite our high skill, this item is capped at a 50% chance. We go to salvage anyways and we get one obsidian. the first was a success but we didn't get it the second time. Because we got one we also get 100 xp in smithing. Had we been lucky and gotten both, we would have gotten 200 xp in smithing. The last entry that I didn't cover was the level req. for any of the above to happen I had to have 50 mining. without that level req, I would never get any obsidian.

repeat these entries for every item you want to give as salvage.

"vein_data":{}

Vein Data lets you give this item vein charge and capacity. This means that the item can be used to provide the player with charge towards the vein ability. Items have two settings:

"chargeCap", //the max charge this item provides
"chargeRate" //the rate at which this item recovers used charge
Clone this wiki locally