header
Vending Machine avatar

Vending Machine

Install
item image
item image
  • screenshot thumbnail
  • screenshot thumbnail

Description

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 enter chat so you can click the provided link to edit the config, 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.

ItemRarity config value allows you to change the rarity of items from their default value, just for cost purposes.

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.

(1.18.2+,1.16.5) Tags can be used here, for example: "#minecraft:beds=1", this would set all bed items to Uncommon.

   Value  Rarity
     0        Common
     1        Uncommon
     2        Rare
     3        Epic

Custom item cost can set 1 or 2 items and number of uses. The format is:
   thing=itemA,countA[,itemB,countB][,maxUses]
The thing can be a single item, tag, modid:*, or one of the built wildcards.
If the max uses isn't set then it will be set based on the item rarity. Example:
   "minecraft:elytra=minecraft:diamond,64,minecraft:nether_star,1,1"

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 using "*". (default)

You may include only minecraft by using "minecraft".

You may include only specific mods by putting their id 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

You may include all tabs by using "*". (default)

Exclude Group Lists

These exclude specific tabs from the creative menu. The default is "!" and "op". The "!" means to exclude any items not on any creative tab.

Example (1.17.1+ which is a string list): "!", "tools" excludes "any items not on a tab; and any items on the tools tab"

Example (1.16.5 which is a single string):  "!;decorations" excludes "any items not on a tab; and any items on the decoration tab" 

Valid tab group names are (1.19.4+): buildingBlocks, coloredBlocks, combat, foodAndDrink, functional, ingredients, natural, op, redstone, spawnEggs, tools

Valid tab group names are (up to 1.19.2): brewing, building_blocks, combat, decorations, food, misc, redstone, tools, transportation

Modded tab group names can be used. Look at their lang file and locate lines prefixed by itemGroup. Use the reminder of that key after the next period. Example, "itemGroup.modid.buildingBlocks" will become "modid.buildingBlocks". Lang files can be found in the jar file in folder assets/<modid>/lang/, but can also look at source, if available.

Dedicated Servers

Some mods crash on dedicated servers when accessing tab groups (1.20+), so if this happens then an error message is printed to the log and group features are disabled, so that the vending machine can operate. Special case is if the exclude groups have either operator group ("op") or no group items ("!") then special tags (#vm:op and #vm:nogroup) containing vanilla items are added to exclude items list. Also note that some modded multi-items (items setting nbt, example firework rocket in vanilla) can't be provided due to failure to access the creative tabs, though the vanilla ones will be provided.

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.

(1.18.2+,1.16.5) Tags can be used here (i.e. prefix with #). If you want to remove an item or items in a tag from this list then prefix it with -. For example, if you include all beds with "#minecraft:beds", but don't want a yellow bed, then add an entry "-minecraft:yellow_bed" after the tags entry.

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.

(1.18.2+,1.16.5) Tags can be used here (i.e. prefix with #). If you want to remove an item or items in a tag from this list then prefix it with -. For example, if you exclude all beds with "#minecraft:beds", but want a yellow bed, then add an entry "-minecraft:yellow_bed" after the tags entry.

Add Item Lists

Add item list avoids most filtering, for example if you want to sell building blocks but add some possible tools with it, set:
  IncludeGroups = ["buildingBlocks"]
  AddItems = ["#minecraft:pickaxes", "-minecraft:netherite_pickaxe"]

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. When placing a new vending machine, it will only save current fixed setting. You must open the vending machine once for the current items to be loaded and saved with it.

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; item or item,amount,pay_item,cost,uses
 FixedItems = "minecraft:iron_chest;minecraft:iron_leggings;minecraft:iron_sword;minecraft:bow;minecraft:air;minecraft:air;minecraft:air"

In later versions (1.17+) the config uses a list of strings instead of a single string with the semi-colon separator, i.e.

 FixedItems = ["minecraft:iron_chest", "minecraft:iron_leggings", "minecraft:iron_sword", "minecraft:bow", "minecraft:air", "minecraft:air", "minecraft:air"]

 

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 data components for the items (1.20.6 and later), like

 "minecraft:wooden_sword[minecraft:damage=10,minecraft:custom_name='{\"text\":\"Used Sword\",\"italic\":false}']"

You can also specify nbt for the items (1.20.4 and before), like

 "minecraft:wooden_sword{Damage:10,display:{Name:'[{\"text\":\"Used Sword\",\"italic\":false}]'}}"

It is important to escape any double quotes inside the data components or nbt like in this example, otherwise the game can crash (out of my control).

Here is another example of an iron sword with sharpness 3 and mending selling for 2 diamonds (1.20.4 and before):

 "minecraft:iron_sword{Enchantments:[{lvl:3s,id:\"minecraft:sharpness\"},{lvl:1s,id:\"minecraft:mending\"}]},1,minecraft:diamond,2,4"

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.

Villages

You can use this option to add vending machine structures to villages, the default is true. Changing this requires a server restart (1.19.2 and before require game restart for integrated servers).

 

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.

Discord Logo

 

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.