Monday, June 23, 2014

Minecraft: Vending Machines



Welcome, Rovers!  Today I'm going to look at the wonderful world of vending machines.  If you play solo a lot, you probably don't have a need for a vending machine.  If you play on multiplayer servers, you may discover you'd like to put some of your hard won loot or well built goods up for sale.  The problem is you are a rover.  You don't want to have to sit there and monitor your shop personally.  Worse yet, setting up a shop with a chest full of stuff and a chest for payment is like asking to be robbed.  

The picture above is my first stab at an armor store.  The way the machine works is the customer throws (Q key) a diamond into the hopper, and the dropper spits out their purchase.  We'll be doing a deep dive on another of MrCrayfish's designs: https://www.youtube.com/watch?v=B82PxfnZkug


It starts with a 3 block deep hole in the ground.  For the benefits of showing you how it works, I'm going to build it above ground, but please remember to build it in a 3 deep hole.

The whole shebang starts with a chest, and then two hoppers feeding into it.  The top hopper is empty and just servers to receive the payment. The second will serve as a filter.  You will set it up to take a certain block as payment.

The beauty of it is if they throw the wrong block in, it will just sit in the top hopper and they can collect it back.  When you're building a vending machine you don't want to have to always come running when someone puts in something valuable to them and they need it back immediately.

If you try throwing things in right now with just these three items set up, it will all just filter into the chest.  We need to set up a circuit to stop that.  Well, it will do a lot more.

Now you'll place the above circuit.  Put two blocks down in a line away from the chest.  On the first block put down a comparator, and the next a red stone repeater.  On the right side of the comparator, put down a red stone block with a piece of red stone dust.

You  are using the comparator in its standard comparison mode.  This means it will compare the signal from the hopper against the red stone block.  The red stone block gives a strong value of 15 (the max for a red stone circuit).  The hopper varies it's input based upon how full it is.  If the value coming from the side is higher than it's input, it won't pass through any power.  This means the hopper has to be full before the comparator passes any power into the circuit.

This power will then flow into the repeater which adds a small delay to the signal.  Put some red stone dust in the next square.  To the left of that dust place a block and affix a red stone torch on the side next to your repeater.  Place another repeater behind the torch, and then a block with some dust.

The block with the torch is meant to switch the value of the circuit.  If the comparator turns on, the red stone torch will turn it off.  This makes more sense when you find out WHY this part of the circuit is on.  Its feeding a constant power to the hopper.  This stops the hopper from dispensing items.

The state the circuit is in now locks the hopper in place.  if you were to drop items in they would all stop in the second hopper.  That said, the circuit isn't complete.


To complete the circuit, you need a block placed above that solitary red stone dust, with a red stone torch pointing to the right.  This is the only reason I can tell that dust is there for, but MrCrayfish is much better with red stone than I am.  Perhaps he can shed light on its purpose.

Now that the circuit is complete, if you put items in the top hopper, they will filter through the middle hopper until it is full.  When full it will pass one item into the bottom chest.  Congratulations, you've completed the payment portion of the vending machine.

Many shop owners would love to take a payment and never have to give anyone any goods, but sadly its not the way it works.  If people don't get product, they just tend to get mad.  We need to carry this momentary


A block, torch, block combo above the redstone torch you just placed will carry your signal up above the hoppers.  This will give you some room for the payment system.


This is the last part of the circuit.  a platform of 6 blocks.  A comparator next to the block bringing signal up.  Redstone across the front (with a block to bump it up) and around into a repeater.

This comparator needs to be clicked so it's front torch is glowing.  That places the comparator in subtraction mode.  When the circuit is dark like this, it is because 0 is being subtracted by 0 and there is no power to push on.

However, when the hopper has an item flow through it, the block will receive power.  This will be compared against the dead circuit and it will momentarily power, turning the dropper on long enough to drop one item.  The power will then flow through the repeater, whose delay allows the circuit to turn on at all.

but then the delay will end and the full signal will be subtracted against the full signal turning everything off.

 A vending machine is pretty useless until you set up a currency you want to take.  The easiest way to do this is to place 4 non stacking items in the right 4 spots.  I used beds because they're pretty cheap, but you can fill each slot with 64 dirt or cobblestone just as easily.

The important slot is the far left slot.  This is where you define your currency.  If it is empty, you can only accept non stackable items like beds or doors.  I don't think those are great forms of payment, but that's really on you.

Better is a stackable item like iron, gold, emeralds, diamonds, full blocks of minerals, coal, etc.  You have to figure out what people might think is a good deal.  once you settle on an item you want, you need to place a stack of 63 of them in the left-hand slot.


Then you go to your dropper, and fill it with items to sell.  If you sell weapons or armor, you'll need to refill it often.  Once it is full, you can press shift and place a ladder over the front.  This will prevent other users from just removing the items from it without paying.

Go ahead and toss some payment in, you'll have an item spit out at you.


An important thing to remember is a normal server without mods won't protect your vending machine from being destroyed, vandalized, or broken for the items or payment.  Your best bet for using this item in practice is either to play with people you trust a lot, or play on a server with protection plugins that allow you to control your own territory.


This is just a reminder, all of the above is meant to be built in a 3-block deep hole.  It is a lot more convenient for your shoppers.

Good luck in your business endeavors, Rovers!

No comments:

Post a Comment