Vending Machine
A fun little mod that lets players buy a random (or fixed) set of 7 items from a vending machine.
The Basics
This mod works in two modes.
1) A random vending machine spawns randomly in Villages! It will contain a random selection of minecraft and modded items each day.
2) A fixed vending machine with preset selected items in it for scenario map building which is placed by map designers.
Ready to Go
The defaults allow any normal player to add Vending Machines without needing configuration. They are reasonable values and exclude game breaking items from vending machines.
Default Vending machines appearing randomly in villages. Each morning they restock with 7 random different items.
Common items sell for 1 emerald each. You can buy up to 8 of the same item before it runs out.
Uncommon items sell for 16 emeralds each. You can buy up to 4 of the same item.
Rare items sell for 32 emeralds each. You can buy up to 2 of the same item.
Epic items sell for 64 emeralds You can buy one item.
The Vending Machines restock with a new selection of 7 random items each morning.
And.. there are plentiful configuration options for mod pack designers and map makers.
The configuration file, which is a server config, is found in serverconfig for the saved world (e.g. saves/New World/serverconfig) and is called vm-server.toml.
The configuration file, now is a common config, is found in the config folder and is called vm-common.toml. You can also use this command in the game /config showfile vm COMMON then click the provided link to edit it, but you might have to restart the game, depending on OS and editor used or unlucky, for the settings to take effect.
Fixed Vending Machines
Map designers can set up a fixed vending machines with up to 7 set items and place them on the map. Excellent for Post Apocalyptic maps!
Then, they can change the configuration file to a different set of 7 items and place those vending machines on the map (must open them after placing for it to load the items and remain that way).
So a map designer could have food vending machines, potion vending machines, etc.
Currency
The default currency is emeralds. You can configure it to any item: emeralds, diamonds, eggs, shulker boxes, silver coins, etc.
Cost
You can configure the cost and limit of items.
By default:
Common items cost 1 currency units and players can buy up to 8 items. .
Uncommon items cost 16 currency units and players can buy up to 4 items.
Rare item items cost 32 currency units and players can buy up to 2 items.
Epic items cost 64 currency units and players can only buy up to 1 items.
If you set the price for a category to 0 currency units then they will not be offered.
You can now set all items from a mod to a given rarity for pricing/cost by doing "modid:*=3", this would set all items from "modid" to Epic.
Mod Include And Exclude lists.
The include list is handled first, the exclude list is handled second.
Include Mod Lists
You may include all mods by putting a "*". (default)
You may include only minecraft by adding "minecraft".
You may include only specific mods by putting their names.
Exclude Mod Lists
You may exclude all items from a mod.
For example: You can include all items from a mod by mod and then exclude a few items you don't want vending machines to sell.
Group Lists
These control creative tab groups inclusion or exclusion.
Include Group Lists
These include specific tabs from the creative menu
The default is include all tabs.
Exclude Group Lists
These exclude specific tabs from the creative menu. The default is "!" which means to exclude any items not on any creative tab.
Example: "!;decorations" excludes "any items not on a tab; and any items on the decoration tab"
Valid group names are: tabs: building_blocks, decorations, redstone, transportation, misc, food, tools, combat, brewing
Item Lists
You can use Include and Exclude Item lists to change what items are in Vending Machines.
Include Item Lists
This list will still be filtered by the other lists, so you have to check and remove any conflicts.
So you can use this if you only want to pick randomly from a smaller set of items instead of specifying a large exclude list.
Exclude Item Lists
You may exclude specific items from minecraft or a mod.
However! "Operator Only" or "Game Master Block" items like Command Blocks, Structure Blocks, etc. will not be sold except when set up by the map developer in a fixed item vending machine.
Fixed Machine List
A list of up to 7 items for fixed Vending Machines placed the next time you run minecraft. You may define a new fixed machine each time you run minecraft.
So you could configure a food vending machine- run minecraft and place several food vending machines.
Then you could configure a drink vending machine- run minecraft and place several drink vending machines.
And so on.
Here's an example configuration sample for 1.16.x:
#Use fixed items
UseFixedItems = true
#Fixed items
FixedItems = "minecraft:iron_chest;minecraft:iron_leggings;minecraft:iron_sword;minecraft:bow;minecraft:air;minecraft:air;minecraft:air"
In later versions the config uses a list of strings instead of a single string with the semi-colon separator.
If you misspell an entry, or put in too few items, the slots will be set to "minecraft:air".
It now supports an optional expanded format, if the rarity system doesn't fit your needs. For example, if you wanted to sell 4 honey bottles for 8 coal (10 times), you would enter this for one of the fields:
"minecraft:honey_bottle,4,minecraft:coal,8,10"
You can also specify nbt for the items, like
"minecraft:wooden_sword{Damage:10,display:{Name:'[{\"text\":\"Used Sword\",\"italic\":false}]'}}"
It is important to escape any double quotes inside the nbt like in this example, otherwise the game can crash (out of my control).
Minable
If this option is turned on then it requires a diamond pickaxe with silk touch to get the vending machine otherwise you get either some iron ingots or nothing.
Note: Vending Machines will allow you "win" minecraft in superflat worlds (eventually!) since they are a source of some otherwise unavailable items.
Patron Support
Vending Machine is Supported by bernardo7480 thru January 31, 2023! It's available on alternative mod loaders due to his generous support. Thank you Bernardo!
You can join us on our Discord Server at the link below.
Like this Mod?
Please Check Out Our Other Fine Mods!
Save Your Pets: Instead of dying immediately, pets fall down wounded. You have a while to save them with bandages or golden bandages.
Enameled Armor: Cover your Diamond Armor with colored enamel and control whether the enchantment glow is on or off.
Nasty Mobs: Six Smarter Skeletons with custom AI, abilities, completely configurable.
Happy Trails: Easily Configure movement on your server (or single person game) to be 1 to 11 times faster or slower on almost any solid block!
Easy Redstone Extras: Tools to reduce redstone annoyance and make it more fun.
Regrowth: Animals eat grass and promote regrowth. Villagers improve their villages.
Beekeeper: A new villager who buys and sells bee related products including Bee Pollen and Royal Jelly custom foods!
Vending Machine: A vending machine which restocks with 7 random* items every morning. (*or Fixed by Map Designers)
Harder Branch Mining: Tools to make branch mining more difficult in various ways to encourage caving.
Villagers Respawn: Villagers who have a bed will respawn at them when they die.
Poor Golems: Hey Buddy, can you spare an ingot? Control over how often and how many iron ingots iron golems drop.
Great mod!
Question, are there any plans to add in a feature where you can have 1 or so "FIXED" item(s) that will always populate in a slot of the Random VM pool? Like instead of it populating 7 random slots it will only do 6, and the empty 7th slot would be a fixed item with its own price. Would be beneficial for worlds that have like Heart canisters or other buff/debuff items added from other mods. If this is already achievable, would you mind walking me through it?
Hello! How to add specific potions to the fixed items? Like: minecraft:potion{Potion:strong_healing}
Thank you in advance!
In reply to HOLYSPAGETI:
You have to escape the quotes: minecraft:potion{Potion:\"minecraft:strong_healing\"}
In reply to lupicus:
Thank you again! ;)
I thought it would be cool if renaming the vending machine in an anvil would change the name displayed in the vending machine UI. Maybe consider it :)
In reply to HOLYSPAGETI:
I'll look at fixing that.
In reply to lupicus:
Awesome :D!

Can you please have a look and tell me if I'm doing something wrong? I enabled the option "UseFixedItems" by setting it to "true". Now the vending machines I take from creative contain the fixed item list but those that spawn in villages have random items.
In reply to HOLYSPAGETI:
When you place a vending machine it sets the fixed setting. The vending machine structures were placed with random set, so you would have to make a data pack with them set to fixed. The fixed items are only set from config when the UI is opened the first time, so you shouldn't open them before saving structures unless you want those items saved for that structure. This allows multiple fixed vending machines with different items.
In reply to lupicus:
Unfortunately I have no code writing skills, I've tried to search how to do it by myself, but it's over my possibilities.
Any chance you are going to add a config option to make all the vending machines random set by world generation spawned with the fixed list?
For n00bs like me would be a great addition, this way I can have all the vending machines selling fixed items in villages and special vending machines in interest points. :D
In reply to lupicus:
By saying that I have to make a data pack with them set to fixed do you mean a separate data pack or that I have to edit the data folder in the mod?
Looking into the mod folder I did not found anything about fixed lists. :(
Soon I have to launch the server, please help me X,D
In reply to HOLYSPAGETI:
I was saying a separate zip containing the changed structures which you would install on the server, but I guess you could replace the ones in the mod.
You would set the config to fixed then you have to load a village structure, replace the vending machine, then save the village structure. Repeat for each of them.
You then can zip them or replace the ones in the mod.
Awesome mod, well job! I found that when using Carry on is possible to pick-up the vending machine and then, when placed, one of the two blocks disappear. It would be useful to have an option to avoid players from picking up the machine.



I'll add some screenshots to improve the feedback:
In reply to HOLYSPAGETI:
I'll look at it some, but you can add the vending machine (i.e. vm:vending_machine) to the Carry On config for blacklist.forbiddenTiles that has other multi block things, like beds.
In reply to lupicus:
Nice to know! I still have to start tweaking the configs of the pack. Thank you for the hint! :)
Just look at spartan's comment under me. Just saw its updated and now the world is correct again.
*sees mod is updated to 1.19*
Congratulations for a really interesting mod. may i ask if you can sell more than 7 items in a vending machine, an idenfinite amount. it is tedious to wait for the item you really want to appear without modifying the configuration file. thanks!
...translated with DeepLTranslator.
1.19.2?
Option to add a random price for items of a tier? I.e. adding a list of potential currencies and a range. I'd like the items to cost a random amount of a random coin from Thermal, with differing coin tiers based on rarity. Also is there a way to add globs to included item amounts? E.g. adding any random soda from PamHC by adding "pamhc2foodextended:*sodaitem"? Thanks
Is this compatible with Better Villages, which completely overhauls vanilla villages, when it comes to the vending machine village structure? If not, is this something you can implement? Would be nice!
In reply to deletemetainf:
I don't know, but when I get a chance I'll check.