Vanilla Minecraft Tricks

Noah Petherbridge
kirsle
Posted by Noah Petherbridge on Wednesday, November 20 2013 @ 11:34:59 AM
I run a couple of Minecraft servers, and I always prefer to run the default vanilla server as provided by Mojang - mainly because the custom servers like Bukkit always lag behind by weeks or sometimes months every time a new version of Minecraft is released, and partly because there's just way too many custom plugins for Bukkit, many of which do the same things in different ways while being incompatible with each other and it's a huge mess.

I liked the idea of some of Bukkit's plugins, though, so I'm always trying to find creative ways to get similar results using just the vanilla server. Here's a few tricks I figured out myself or heard about from Reddit.

Spawn Region Mechanics

Most of these tricks involve command blocks and understanding a few quirks about how Minecraft vanilla servers work.

Upon creating a new world, give yourself a compass and follow it to find the center of the world spawn region. I usually put a block here to visually remind myself where the center is, because the spawn region is important for a couple of reasons.

Firstly, the spawn region is always kept loaded in memory, along with the 5x5 chunk radius surrounding the spawn point (where a chunk is a 16x16 block section of the world). This is important because it means that if you set up any Redstone devices that run on a loop, they'll run all the time even if all the players wander far away from the spawn area. So it's a good place to incorporate command block circuits to enforce global "rules" on your server.

The other important thing is the spawn protection radius, which is the number of blocks around the spawn point (where the compass points) in which non-operator players are not allowed to place or destroy blocks, or interact with most items. By default the radius is set to 16 blocks, and is configurable in the server.properties file.

In the spawn protection radius, non-op players can't place or destroy blocks, and they can't use any devices except for pressure plates and trip wires. They can't even open or close wooden doors, they can't use crafting tables or furnaces, etc. Only the server operators have rights in the protection radius.

However, the protected area is not safe from monsters or outside interference, so for example if a player lures a Creeper into the spawn region it can still blow up blocks (unless you turn off mob griefing with /gamerule mobGriefing off, which prevents Creepers and other mobs from changing blocks). Clever players can also fling TNT in from outside the protected region to destroy blocks inside. When in doubt, encase your Redstone circuits in bedrock bunkers and keep them hidden away from view. ;)

Command Blocks

Clever use of command blocks can enforce "rules" on a server, for example if you want to ban the use of TNT, you can have a command block be executed very rapidly that removes TNT from all player inventories, by running the command /clear @a minecraft:tnt.

All your command block redstone circuits should use a clock circuit of some kind (one that will run in an infinite loop). Ideally, the circuit should be self-starting, especially if the circuit is NOT within the 5x5 chunk spawn radius. This is because when the chunks that contain a redstone circuit are unloaded, the circuit stops running, and when the chunks are reloaded (because a player walks closer to them), you want your circuit to automatically start back up.

See clock circuits for some ideas. An example I use is where you have a redstone torch that powers a circuit, and the circuit eventually extends a piston over an earlier part of the circuit to interrupt its own power. With the power interrupted, the piston retracts, allowing the circuit to be powered again by the redstone torch, and so on.

Griefer Protection

The easy way to prevent players from breaking your structures is to build everything important within the protected spawn radius. If you also turn off mob griefing, and use a command block to remove TNT from player inventories, it's highly unlikely they'll find a way to break things in the spawn region.

Outside the spawn region, a useful tip I saw on Reddit is to apply the Mining Fatigue V effect to all players within a certain radius of your building. For example, create a redstone clock near the middle of your building that runs a command block to run this command:

/effect @a[r=60,m=0] 4 3 5
This will apply an affect to all players (@a), who are within 60 blocks of the command block and who are in Survival Mode (m=0), the Mining Fatigue effect (ID 4), for 3 seconds, at level 5. Mining Fatigue level 5 basically makes it 100% impossible for the player to mine a block, even if they have a diamond pickaxe, even if it's enchanted. The player can't even break a flower under this condition.

The 3 second interval would be adjusted depending on how frequently your clock runs the command. You want it to only affect players while they're within the general area of your building, and lift the effect quickly if they leave.

Controlling the Spawn Location

In certain maps, you might like to have much finer-grained control over where exactly users on your server will spawn. In vanilla Minecraft, users will spawn somewhere within a 20x20 radius area centered around where the compass points. See Spawn/Multiplayer Details.

On one of my servers, I wanted all players to appear in the center of a room when they joined the server (or died without a bed) so that I could somewhat randomly disperse them around the world by having them pick a pressure plate that would teleport them somewhere. See my blog post "Fun with Command Blocks".

Basically, if you go this route, the actual world spawn point will not be used. Instead you'll just have a command block running on a clock that teleports anyone who appears in the spawn region to a destination somewhere else (you should make sure you teleport them far away from the spawn region, so that they'll be outside the radius of the command block that teleported them... otherwise you get caught in an infinite loop of teleportation!)

Example command for this command block to run:

/tp @a[m=0,r=25] X Y Z
Substitute X, Y and Z for the coordinates to teleport to. This command would snipe all users within a 25 block radius of the command block and teleport them off to those coordinates. Also make sure to include the "m=0" -- this will make it only teleport Survival Mode players away. This way, you (the operator) can switch your mode to Creative and be able to get close enough to the command block to edit it or whatever you need to do. But it will keep all the other players away by teleporting them to your designated "spawn location".

Adventure Mode

Adventure Mode might be considered for certain circumstances as a method of anti-grief protection. On one of my servers, I built a huge Parkour course in the End Dimension, and I hadn't heard about using Mining Fatigue V to prevent players from griefing the parkour course, and things in The End aren't protected by the world spawn region, obviously.

What I did was encased the End Dimension Spawn Platform in bedrock, with the only exits to either go back through the Exit Portal, or step on a pressure plate that would teleport them into the Parkour course (if somebody destroys the pressure plate, then nobody can get into the parkour course, but it's better than allowing them to vandalize the course itself).

The pressure plate would run a few command blocks - one would clear all their inventory with /clear, another one would change their game mode to Adventure with /gamemode 2 @p, and the last one would finally teleport them into the course.

A command block clock in the overworld would set all adventure mode players back to survival in case they died and respawned, with /gamemode 0 @a[m=2].

The thing to know about Adventure Mode, though, is that it's basically "Strict" Survival Mode. If a block requires a specific class of tool to break it (stone needs a pickaxe, wood needs an axe), then only that tool is allowed to be used. If you swing an axe at stone, or a pickaxe at dirt, then your player just swings once as if hitting air, and then nothing.

You don't necessarily need to use the right material of tool, just the right tool. For example Adventure Mode allows you to destroy obsidian using a wooden pickaxe, even though the wooden pickaxe won't drop the obsidian block. So for Adventure Mode to work, you basically need to remove ALL tools from their inventory.

Even without tools, blocks that can be broken by hand are still vulnerable. So avoid using glass, torches, flowers, redstone devices (including buttons) which are in reach of the player, etc., as they can break these without needing any tools at all.

Update (8/14/15): As of Minecraft 1.8, the Adventure Mode behavior has been changed. Briefly:

  • Players in Adventure Mode can't break or place **any** blocks by default, even if they have the correct tool (e.g. with a pickaxe, they can **not** mine stone blocks by default).
  • The exception is that items have new `CanDestroy` and `CanPlaceOn` tags, so for example you could `/give` an Adventure Mode player a pickaxe with a `CanDestroy:["stone"]` tag, and that pickaxe can *only* destroy stone blocks but nothing else that isn't explicitly listed in the `CanDestroy` tag.
So, Adventure Mode as a way to grief-protect an area is even better in Minecraft 1.8 because it stops them from being able to break anything at all, and you don't have to /clear their inventory either!

Helpful Links

Categories:

[ Blog ]

Comments

There are 36 comments on this page.

guest
guest
Posted on Friday, February 28 2014 @ 10:45:53 PM by ImmortalPvP.

I'm sorry, but i dont understand how to control griefing. Could you tell me step by step. (if you want)

Avatar
kirsle
Posted on Friday, February 28 2014 @ 10:47:24 PM by Noah Petherbridge.

I wrote a more detailed post about griefer control with command blocks here:

http://www.kirsle.net/blog/kirsle/minecraft-anti-griefing-in-vanilla

guest
guest
Posted on Sunday, March 09 2014 @ 11:23:50 PM by Harlem Burdett.

Do You No How To Do Setup The .spawn Things

Avatar
guest
Posted on Tuesday, May 13 2014 @ 10:11:11 PM by Kate.

Any idea how to set up a couple of basic commands like .spawn or .sethome?

guest
guest
Posted on Monday, September 01 2014 @ 09:59:40 AM by Henry.

use /setblock [x] [y] [z] minecraft:redstone_block 0 destroy for a redstone clock that goes of every second more than 2 times its the fastest clock ever no need for circuit!

guest
guest
Posted on Friday, September 05 2014 @ 03:41:19 PM by Henry.

Oh and the x y z cords have to be touching the command block for instace ~ ~1 ~ or ~1 ~ ~ or ~ ~ ~1 and so on

Avatar
kirsle
Posted on Friday, September 05 2014 @ 03:54:48 PM by Noah Petherbridge.

That produces an insane number of redstone block item drops. Is there a way to do it that doesn't result in drops? (/gamerule doTileDrops false not being a good option)

Command: setblock ~1 ~ ~ minecraft:redstone_block 0 destroy

Screenshot

Avatar
kirsle
Posted on Friday, September 05 2014 @ 04:06:12 PM by Noah Petherbridge.

I found a way of doing this that involves two command blocks (I believe this is the way most people do it but I figured it out myself as well)...

It kinda exploits the order in which Minecraft processes command blocks, though, i.e. you have to put them in the correct order (X/Y/Z coordinates-wise).

You have two command blocks with one empty space between them, like

[X] [_] [X]

(the empty space can be vertical as well, probably)

One command block sets that empty space to be a redstone block; the other sets the space to be air (or, anything that's NOT a redstone block, maybe).

Like:

  • setblock ~1 ~ ~ minecraft:redstone_block 0 replace
  • setblock ~-1 ~ ~ minecraft:air 0 replace

Then place a redstone block between the two to start the process. If the redstone block you place disappears and never comes back, the command blocks are in the wrong order, and you should swap their commands (and be sure to fix the X/Y/Z coordinates to be opposites as well, in this example, the redstone_block uses ~-1 instead of ~1 and the same for the air block).

When it works, the redstone block appears to stay in place forever.

Like I said, this exploits the ordering in which the game processes command blocks. If the game ever switches order in a future update, or if they multi-thread the command blocks, this clock may break.

But basically, when you place the redstone block between the command blocks, you power both blocks at exactly the same time, but the game can't run both of their commands at exactly the same time, so it does them in a certain order (I don't know the order off-hand, but logically it would be, the block with the lower numbers in the X, Y, Z coordinates is run first).

So the first command block runs, and replaces the redstone block with air. Then the game still has to execute the other command block (since it was powered, even though "now" it isn't), and this block puts the redstone block back where it was originally. End of game tick.

Then the game's like, "oh, redstone block here, power the command blocks! First one, then the other" and so on.

If the blocks are in the wrong order (i.e. the one that replaces with redstone runs first).... player places Redstone, command block 1 puts Redstone there (no net effect), command block 2 puts Air there. End of tick. Now there is no redstone block, and the command blocks don't get run again.

Avatar
guest
Posted on Monday, October 13 2014 @ 10:18:11 AM by Steve Digs.

I use this for clocks too. But I replace stone instead of air so I can turn the commands on and off easy when testing. Just break the redstone and the updating stops. Put a stone block back and it starts again.

Clock top: /fill ~ ~-1 ~ ~ ~-1 ~10 redstone_block 0 replace stone
Clock Bottom: /fill ~ ~1 ~ ~ ~1 ~10 stone 0 replace redstone_block

This makes a 10 block long clock in the +Z direction

Avatar
guest
Posted on Monday, October 27 2014 @ 11:47:36 AM by PDXTony.

The server processes command blocks along the x axis
first then y axis highest to lowest. (this is in reference to the commandblock clock mentioned in the post. which is very handy since it eliminates block/chunk updates and reduces lag)

Avatar
guest
Posted on Tuesday, November 18 2014 @ 08:20:42 AM by Angie.

We're running a vanilla build, 1.8, on a linux host, in creative only.. for a group of young crafters. How can I offer the players the option to protect their creations from damage from the inexperienced/etc, without modding?

Thanks in advance!!

guest
guest
Posted on Tuesday, November 18 2014 @ 09:27:26 AM by Steve Digs.

Without mods I think the only way would be to turn the server into survival or adventure and then give creative mode at assigned areas. Each player would have an area for creative mode and when outside of that switch to a different mode. /gamemode 1 @p[r=30,name=Steve_Digs]
Or, all players but one get switched to adventure mode in a specified area. /gamemode 2 @a[r=30,name=!Steve_Digs]

guest
guest
Posted on Thursday, November 27 2014 @ 08:46:38 AM by LOLOLOL.

Put this command in a command block (above ground)

/setblock ~ ~ ~ mob_spawner 0 replace {EntityId:Zombie,SpawnRange:6,RequiredPlayerRange:12,SpawnCount:1,MaxNearbyEntities:6,MinSpawnDelay:100,MaxSpawnDelay:600,SpawnData:{Equipment:[{id:268,Count:1},{id:301,Count:1}{id:300,Count:1,tag:{display:{color:5013401}}},{id:299,Count:1,tag:{display:{color:6717235}}{id:397,Count:1,Damage:3,tag:{SkullOwner:<Player name>}}]},SpawnPotentials:[ {Type:Zombie,Weight:4,Properties:{Equipment:{id:268,Count:1,Damage:58},{id:301,Count:1{id:300,Count:1,tag:{display:{color:5013401}}},{id:299,Count:1,tag:{display:{color:6717235}}{id:397,Count:1,Damage:3,tag:{SkullOwner:<Player name>}}]}}, {Type:Skeleton,Weight:2,Propertie{Equipment:[{id:267},{id:301,Count:1,tag:{display:{color:1644825}}},{id:300,Count:1,tag:{displa{color:1644825}}},{id:299,Count:1,tag:{display:{color:1644825}}},{id:397,Count:1,Damage:3,ta{SkullOwner:<Player name>}}]}}, {Type:Zombie,Weight:4,Properties:{Equipment:[{id:272,Count:1},{id:305,Count:1},{id:304,Count:1}{id:303,Count:1},{id:397,Count:1,Damage:3,tag:{ench:{id:0,lvl:2}],SkullOwner:<Player name>}}]}}, {Type:Zombie,Weight:4,Properties:{Fire:2400,Equipment[{id:283,Count:1,tag:{ench:{id:20,lvl:1}]}}{id:317,Count:1},{id:316,Count:1},{id:315,Count:1}{id:86,Count:1,tag:{ench:[{id:0,lvl:2}{id:1,lvl:10}]}}]}}, {Type:Zombie,Weight:4,Properties:{Equipmen[{id:267,Count:1,tag:{ench:{id:16,lvl:2}]}}{id:309,Count:1},{id:308,Count:1},{id:307,Count:1}{id:397,Count:1,Damage:3,tag:{ench[{id:0,lvl:2}],SkullOwner:<Player name>}}]}}{Type:Zombie,Weight:1,Properties:{Equipment:[{id:278,Count:1,tag:{ench:{id:16,lvl:4},{id:17,lvl:4{id:18,lvl:4},{id:21,lvl:3},{id:34,lvl:3}]}},{id:313,Count:1,tag:{ench:[{id:1,lvl:4},{id:2,lvl:4}]}}{id:312,Count:1,tag:{ench:[{id:3,lvl:4}]}},{id:311,Count:1,tag:{ench:[{id:0,lvl:4}]}}{id:397,Count:1,Damage:3,tag:{SkullOwner:<Player name>,ench:[{id:0,lvl:4},{id:1,lvl:4},{id:3,lvl:4}{id:5,lvl:3},{id:6,lvl:1}]}}],CustomNameVisible:1,CustomName:Herobrine,PersistenceRequired:1}}, ]}

Activate the command block with a button

guest
guest
Posted on Thursday, December 18 2014 @ 04:16:19 PM by Anonymous.

How do i have the command block keep the command after i break it??

Avatar
kirsle
Posted on Thursday, December 18 2014 @ 04:22:48 PM by Noah Petherbridge.

You don't. The command block item (in your inventory) doesn't keep its NBT tags. Those are only for the placed block.

Avatar
guest
Posted on Thursday, February 05 2015 @ 07:14:11 PM by captainbuildit.

Can i join your server? I just started my own vanilla one too. Your tips work and i love them!

Avatar
guest
Posted on Saturday, February 14 2015 @ 01:31:34 AM by Jeff.

What's the command for this;;

Your making a custom map. It's in survival/ adventure.
You don't want to have that people are cheating with their gamemode. Whats the commandblock(s) command(s) for that if people say; /gamemode 1 / /gamemode creative ?

Avatar
guest
Posted on Wednesday, March 04 2015 @ 10:10:02 AM by ThunderBear21.

Curious how to keep players from placing blocks in the pseudo spawn area. I have them spawn going to one point and they can't break blocks. But they can still place blocks.

Any Ideas???

BTW this is the most helpful site for vanilla. Thanks

Avatar
kirsle
Posted on Wednesday, March 04 2015 @ 11:02:02 AM by Noah Petherbridge.

In adventure mode players can't place blocks either, unless the block item has an explicit CanPlaceOn flag set.

Edit: as of Minecraft 1.8

guest
guest
Posted on Thursday, March 05 2015 @ 04:06:59 PM by ThunderBear21.

Kisle,

I can change them in and out of adventure mode but how do I include or exclude groups such as staff??? We are already using scoreboard and that only allows for players to be on one team I think.

Thunder

Avatar
kirsle
Posted on Thursday, March 05 2015 @ 04:12:55 PM by Noah Petherbridge.

You might be able to use scoreboard objectives and apply those to the individual players rather than teams.

/scoreboard objectives add staff dummy Staff
/scoreboard players set <name> staff 1

Repeat the second command for each staff user.

And in the command block selector,

/gamemode 2 @a[r=30,score_staff_min=1]

guest
guest
Posted on Sunday, April 05 2015 @ 09:16:46 PM by Lol.

I love you

Avatar
guest
Posted on Tuesday, May 12 2015 @ 02:10:31 PM by Hi I'm not saying my name, ok?.

I created total LAG!!!!!!!!! Created a block made of anything you want and seirowd it with tnt an put the command in the command block and put an iron door in front of the presser plate and Derum role plz? guess what... LAGGGGGGGGGGGGG!!!!!!!!!!

guest
guest
Posted on Tuesday, May 26 2015 @ 08:13:28 AM by Benji_does-MC.

i cant use any command in a world in multiplayer

Avatar
kirsle
Posted on Tuesday, May 26 2015 @ 08:47:40 AM by Noah Petherbridge.

On multiplayer you have to be a server operator to use command blocks (because you have to be an op to use commands at all).

guest
guest
Posted on Thursday, June 18 2015 @ 12:01:40 AM by MC ruler.

Kirsle

Im making a server and what is the command to welcome someone to the server with their name in the message so everyone knoes that they're online. I want the message to go to everyone

guest
guest
Posted on Wednesday, June 24 2015 @ 06:27:53 AM by Heibel.

Well, this page was named "Vanilla Minecraft Tricks" so i was wondering if you can give me a hand on particicles, (like having it revolving around players, out of blocks, and such)

Avatar
guest
Posted on Monday, June 29 2015 @ 08:33:44 PM by Ryo Stonewell.

hi, I was just wondering, is there a command that you can use, either with comm blocks or after pressing / that makes certain or all entity names permanently visible no matter where you look or how far away you are? of course, I'd like to have them fade the further away you get, as I'm assuming this may reduce lag.

Avatar
guest
Posted on Monday, August 10 2015 @ 07:46:33 AM by Thejs.

My world burn - how can i remove the fire for a second?

guest
guest
Posted on Friday, August 14 2015 @ 11:08:50 AM by Guest.

is there a way to make it that when a player spawns on LAN it activates redstone (to set of a title)

Avatar
kirsle
Posted on Friday, August 14 2015 @ 12:35:34 PM by Noah Petherbridge.

You could do that on their first spawn by using scoreboard objectives. Something like...

1) Make a dummy objective named "spawned" or something:

/scoreboard objectives add spawned dummy Spawned

2) Make a redstone clock at your spawn area that repeatedly powers a command block that checks for users that don't have this point:

testfor @a[!score_spawned=1]

When this command block's output is true (i.e. it detected a player whose "spawned" score is not 1), the block itself will output a redstone signal.

3) On the other side of the block (away from the side that gave it power), run some redstone dust over a couple more command blocks:

  • tell @a[!score_spawned=1] Welcome to the server!
  • scoreboard players add @a[!score_spawned=1] spawned 1

These blocks would show the welcome message to the newly spawned user and then set their spawned score to 1 (so that the command blocks won't match that user again in the future).

This all will cover newly joining players who connect for the first time. If they return to the same server later, they'll still have the spawned=1 score and not be greeted again (there isn't an "on spawn" handler you can use directly, so messing with scoreboards is the only way to do this afaik).

There's also statistics you can try, but none are very useful for this... the best being stat.timeSinceDeath which resets every time the player dies and presumably begins at 0 when they first spawn... but you'd end up showing the welcome message on every respawn even after dying.

Relevant links:

guest
guest
Posted on Wednesday, August 19 2015 @ 07:02:27 AM by Halobot.

How do you attach a command to a certain key on your computer so that you can press that button to activate the command

Avatar
guest
Posted on Monday, August 24 2015 @ 01:33:09 PM by Des.

How do you keep from hackers?

Avatar
guest
Posted on Friday, September 11 2015 @ 09:41:04 PM by DJ_ALI.

hahahah. I learn this from a site: (i forgot the site XD)
if you want to make an adventure map that no one can cheat in it when you are creating the world dont allow cheats and keep gamemode 0. once you entered new world go open to lan allow cheats on and start and now you can cheat and make your map and at the end go to default gamemode and restart your map and it will disallow cheats again I HOPE IT HELPED but other players can cheat in your map in the same way lololol

guest
guest
Posted on Monday, October 05 2015 @ 12:45:42 PM by EnderCube.

To protect the spawn from tnt cannons use a command block who kill any ignited tnt entity with a radius. Also kill creepers
To counter hackers use a command block to teleport players with more than a certain flying score, (reset it when the player jump) to an encased bedrock jail and set his spawn point there, give them a special objective dummy and make a command to teleport them back(clock) because hackers can scape. Then when you log in just ban them. Search for anty fly hack in google
For anti pvp at spawn use potion effects: resistance 4 and weakness 4.
Trick: the fastest way to execute two command blocks at the same time is powering one and placeing the other above

guest
guest
Posted on Tuesday, November 17 2015 @ 08:00:35 PM by dreamstar3193.

pigs

Add a Comment

Your name:
Your Email:
Message:
Comments can be formatted with Markdown, and you can use
emoticons in your comment.

If you can see this, don't touch the following fields.