Hi! Thanks for downloading Shipping Bin!

This document details how you can change the Bin's trades with datapacks.


			 [[[[[ DATAPACKS ]]]]]

To put a datapack into your world, you'll need to place it into the /datapacks/ folder of your world file.
I won't go over everything to do with datapacks here, but there's two examples datapacks in this folder that will
work out of the box. Place either [default_trades.zip] or [quality_food.zip] into the /datapacks/ folder and they 
should add their trades to the Shipping Bin.
Keep in mind that if an item has two different trades/results, there could be problems! So don't use both these
datapacks at once.
Each trade that the shipping bin can do is determined by a .json file that is placed in the folder
[<datapackname>/data/shippingbin/trades]. Anything not in this structure won't be recognised, so put all your .json
in there!

On the topic of datapacks, one critical piece of this is the [pack.mcmeta] in the main datapack folder.
If you want to make a datapack that REPLACES SHIPPING BINS DEFAULT TRADES, ensure that your pack.mcmeta looks
like this:
#########################################################
{
  "pack": {
    "pack_format": 15,
    "description": "This is the description for your datapack."
  },

  "filter": {
    "block": [
      {
        "namespace": "shippingbin",
        "path": "trades"
      }
    ]
  }
}
#########################################################
That last "filter" part is very important, as it will disable the default trades that Shipping Bin comes with. If you
don't include this in your pack file then you'll probably have some issues.





			[[[[[ BASIC TRADES ]]]]]

Basic trades can be made pretty easily; there's a whole bunch of them under [default_trades.zip]. In there you'll find
basic trades for every food, wood type, metal, gem and raw meat in Vanilla. These are the default trades that the 
Shipping Bin mod uses.
An example of a simple trade would be under [default.zip/data/shippingbin/trades/amethyst.json]:
#########################################################
{
  "attribute": "shippingbin:gem_sell_multiplier", 
  "input": {
 	   "count": 12,
  	   "ingredient": {
  		    "item": "minecraft:amethyst_shard"
  	   }
  },
  "output": {
     	   "item": "minecraft:emerald",
   	   "count": 1
  }
}
##########################################################
Let's break this down:

- "attribute" is the attribute that is used for the sell multiplier. All trades use [shippingbin:sell_multiplier] as 
their sell multiplier, and add whatever you put in the "attribute" section on top, using the following formula:
##########################################################
floor(<sell price> * (1 + <attribute value> * <shippingbin:sell_multiplier value>))
##########################################################
Any attribute works as a sell multiplier, but the ones built in (but don't get changed) in the Shipping Bin mod include:
[shippingbin:crop_sell_multiplier]
[shippingbin:wood_sell_multiplier]
[shippingbin:meat_sell_multiplier]
[shippingbin:gem_sell_multiplier]
Use those however you want, remembering that if you're making a trade for, say, logs, and don't put 
["attribute": "shippingbin:wood_sell_multiplier"] in the attribute section, it won't add to your multiplier!

- Everthing in the "input" section is for the item you put into the Shipping Bin, and everything under "output" is
the profit item.

- "count" is the amount of this item (in the Input or Output) that this trade will use: 
i.e in this trade, 12 Amethyst Shards are traded for 1 emerald.
- "item" is the item id of the item. Duh! If you swap this out for "tag" you can use item tags, for example to
make a trade for any item under the [#minecraft:logs] tag, you can put:
##########################################################
	"tag": "minecraft:logs"
##########################################################
Don't put tags under the output item, though. It won't work.

Note: the name of your .jsons don't need to match anything in the file, as long as the name is unique.

That's pretty much it for your basic trades!





		[[[[[ NBT / QUALITY FOOD TRADES ]]]]]

I like the Quality Food mod so here's how you can add different prices for different qualities of foods/items!
An example of how to add trades for Apples of differing qualities can be found in [quality_food.zip].

Quality Food adds its quality via NBT data, for example, it adds [ {quality_food:{quality:1}} ] to any item
with an Iron quality. 1 is Iron, 2 is Gold, 3 is Diamond.
Because each .json file can only sell one item type/tag, we need four different .json files to sell the different
qualities of, say, Apples for different prices. [quality_food.zip] gives us four .json files, one for normal
apples, and one for each quality of apple (1, 2 and 3.)
Here's [quality_food.zip/data/shippingbin/trades/apple.json], which sells 5 Apples that DON'T have a quality
(normal apples) for 1 emerald.
##########################################################
{
  "attribute": "shippingbin:crop_sell_multiplier",
  "input": {
    "count": 5,
    "ingredient": {
      "type": "forge:difference",
      "base": {
        "item": "minecraft:apple"
      },
      "subtracted": [
        {
          "type": "forge:partial_nbt",
          "item": "minecraft:apple",
          "nbt": "{quality_food:{quality:1}}"
        },
        {
          "type": "forge:partial_nbt",
          "item": "minecraft:apple",
          "nbt": "{quality_food:{quality:2}}"
        },
        {
          "type": "forge:partial_nbt",
          "item": "minecraft:apple",
          "nbt": "{quality_food:{quality:3}}"
        }
      ]
    }
  },
  "output": {
    "count": 1,
    "item": "minecraft:emerald"
  }
}
##########################################################

Looks complicated! I know, but you don't have to worry about changing most of this. Most of this is for checking
that the item doesn't have the quality NBT data so that you don't have the same item for two different prices, 
and so it has to check it three times. Such is the life of a datapack maker.
All you need to know is that changing this to whatever item you want involves changing the "item" field for ALL FOUR
listings of "minecraft:apple" in this file. Make sure you do this or some unexpected things may occur!

Thankfully, the other three files are a bit easier, here's the file to sell 3 apples with a Quality of 1 (Iron Quality)
for 2 Emeralds, which is in [quality_food.zip/data/shippingbin/trades/apple_quality_1.json]

##########################################################
{
  "attribute": "shippingbin:crop_sell_multiplier",
  "input": {
    "count": 3,
    "ingredient": {
      "type": "forge:partial_nbt",
      "item": "minecraft:apple",
      "nbt": "{quality_food:{quality:1}}"
    }
  },
  "output": {
    "count": 2,
    "item": "minecraft:emerald"
  }
}
##########################################################

Comparatively simple! Note the "{quality_food:{quality:1}}" part, that determines what the quality value is, so to
change this to be for Quality 2 (Gold Quality) Apples, just change it to "{quality_food:{quality:2}}". Diamond Quality
would be quality 3.

That's pretty much all there is to making trades for the Shipping Bin! Remember that you can use item tags if you
have a bunch of items for the same price, might save you a bit of headache. If you have any other questions, feel
free to ask me in the comments on the mod page.
Also don't forget to check out the full Project Stardew modpack when it comes out :)))) 

Good luck and enjoy! 
- garflemn
