top of page

Java Basics

Hi! In this article, I will show you all the commands you need to know to begin working and building at WequilCraft. Everything here is a fraction of what you will learn in my Java Coding Class. If you want to join my class, contact either Joe Wequil, or me, Benny, on the slack group. You can also visit my website at Java Coding Class | WEquil School for more information on the class. If you don't have Minecraft: Java Edition, you can read my article here on how to buy it for $26 USD: How to get Minecraft

If you don't know, we are planning on creating a ton of things on the new WequilCraft Creative server. Because of this, we want to recruit a large amount of Java Coders to get this job done! One thing we need to first understand is what a command is. A command in Minecraft is a string of code allowing you to do many things: summon crazy mobs, fill a large area with any block instantly, and a bunch more. If you know how to use Java Commands, you can pretty much do anything you want inside Minecraft.

When we want to use any type of Java Coding, we have to make sure that we have OP, or Operating Permissions. If you try anything below without having OP, nothing will happen when you try to run commands. To get OP, you can join the WequilCraft server. To do this, when you open Minecraft, go to 'multiplayer', then Direct Connect, and type in this IP:



Click on 'Connect', and you should be on the server! If you aren't or are having problems, contact me on the Slack Group.

If you want to acquire OP on a singleplayer world, create a new world, enable cheats, and set the gamemode to Creative.

To start a command, you need to go into Minecraft, and then open your chat using T.

Then, we can type in a forward-slash to start a command. It looks like this: /

A bunch of words will pop up, and these are the commands we can choose from.

First, we want to start with the summon command.

This command allows us to summon any mob in the game. We can start this by typing in 'summon' after our slash. It should look something like this:


/summon

Then, we want to type in the mob we want to summon. You can do Zombie, Skeleton, or whatever you want. Even a wither or Ender Dragon! One quick tip, though: if the entity you want to summon has a space in its name, use an underscore.

After your command is finished, you can press enter! Mine looked like this:


/summon iron_golem

Now you have learned the summon command! Let's move on.

The 'give' command allows you to give yourself any item in the game. It's super useful! We can start it by pressing T and entering our forward-slash again, to signify that we want to start a command.

Then, after the slash, we can type in 'give', so we can tell Minecraft we want to use a 'give' command.

After that, we can type in the item we want! Just like before, if your item has spaces in its name, use an underscore. One thing this command allows us to achieve is Command Blocks. These are blocks capable of running commands and can be activated using redstone. From now on, we will be using these for our new commands. To get a command block, use the give command and type in 'command_block' as our item. Then, place it down and right-click on it. It will open up a menu, and there will be many buttons, but all we need to do is type our commands in the little bar. Once our command is finished, hit 'Done'. Then, to run our command, simply place a redstone block next to it!

On to the next command! TIP: If you are reading this in one sitting, take a break and experiment with things in Minecraft! Practice makes perfect.

Now, we get into the tricky stuff. We want to learn three new commands: setblock, fill, and clone. These all have to do with summoning or recreating blocks. But one thing stands in our way: XYZ coordinates. This rule in Minecraft allows us to pinpoint any location in the entire infinite Minecraft World. There are three ways we can do this: Absolute, Relative, and Local. We only need to know Absolute and Relative. This will be a simplified version of XYZ coordinates, but I detail everything in this article below. This is highly advanced, and I only recommend reading this if you have spent some time in my Java Coding Class.


Each letter in X Y Z represents a line, or 'axis'. Each one meets at a point, called the 'Origin Point'. The Origin point defaults to the block that a Command Block is in whenever you are running a command off of a Command Block. If you are running a command through chat, the origin point defaults to your feet. Here is a picture to help you better understand.

The X axis represents East/West. A positive value increases the position to the East. A negative value increases the position to the West.


The Y axis represents up/down. A positive value increases the position up. A negative value increases the position down.


The Z axis represents South/North. A positive value increases the position to the South. A negative value increases your position to the North.


We can refer to this any time if you get stuck or don't understand anything stated here.

Let's start with relative coordinates first. A Relative XYZ Coordinate would look something like this:


~ ~ ~

These are called 'Tildes'. If you want to type one, it is usually found about the 'TAB' button on your keyboard.

Right now, our Relative XYZ Coordinate is just defaulting to the Origin Point. We can change that. If I wrote this as my XYZ Coordinate:


~ ~1 ~

This would mean that the location that I am targeting is one block above the origin point. If I did something like this:


~2 ~5 ~-35

This would mean that the location I am targeting is 2 blocks east, 5 blocks higher, and 35 blocks North, relative to the Origin Point, since a negative value on the Z-axis increases the position North.

If you want to find out what direction you are facing in Minecraft, so you can form all three axes in your mind, we need to open the Debug Menu. To do this, press F3 on your keyboard if you are on Windows, and if that doesn't work, try Ctrl+F3. If you are on Mac, try pressing F3 on your keyboard, and if that doesn't work, try command+F3.

Now that we have our debug menu open, it should look something like this:


There are a ton of lines here, and I have highlighted the important ones. Now we can view what direction we are facing! In the middle of our crosshair, we also get a little XYZ coordinate plane. The green line is the Y-axis, the red line is the X-axis, and the blue line is the Z-axis. Hope this helps!

As you might have noticed, the locations displayed on your debug menu are not Relative. They are in Absolute form, our new way of targeting locations.

As you know, the origin point when you are using Relative coordinates defaults to your feet or a command block. But always, when you are using Absolute coordinates, the origin point is 0,0. What do I mean by that? In the entire infinite Minecraft world, every block builds off of the center, which is 0X, 0Y, 0Z. When you open up your debug menu, it shows you your location in blocks, in other words, the location of your feet. In the screenshot above, I am at:


205X, 4Y, 123Z

This means I am 205 blocks East of the origin point, 4 blocks higher than the origin point, and 123 blocks South of the origin point.

When we look at a block, our debug menu shows us the exact location of that block. This is extremely useful, and you will see why.

Now that we know our XYZ coordinates, we can move on to the last three commands.

The setblock command allows us to place any block anywhere. This is extremely useful because, with a click of a button, we can place a block thousands of miles away!

Let's start with trying it out through chat, first. We start our command with a /setblock, obviously, and then after that, we can enter our location. We can either use Relative or Absolute, and I will use both. If I run the command:


/setblock ~1 ~-1 ~5

This will set whatever block I choose one block East of my feet, one block below my feet, and 5 blocks North of my feet.

After that, we simply choose the block we want to fill in. In my case, I will choose a diamond block. My command looks like this:


/setblock ~1 ~-1 ~5 diamond_block

Let's try something different. What if we used Absolute coordinates? Given that I am at 100, 50, 25, and I run the command:


setblock 150 75 0 redstone_block

This would set a block 50 blocks East of my feet, 25 blocks higher than my feet, and 25 blocks North of my feet. Make sense?


Let's move on to the 'fill' command. This command allows us to fill a large rectangular area with blocks. We need to find two blocks to act as corners, though. We can imagine our rectangle in our head and then place two blocks in two of the corners. Then, we need to get the locations of both of them. For example, my first block is at 100, 100, 100, and my second block is at 50, 50, 50. To be able to use them in a fill command, we have to write them like this:


100 100 100 50 50 50

Then, we can put it in our fill command. So far, mine looks like this:


/fill 100 100 100 50 50 50

Then, we simply enter the block we want to use. Then we are done! ... almost. We can enter one more parameter (this is completely optional). If we type 'hollow' after our block, it hollows out the rectangle. This comes in handy sometimes, like if we want to build a house instantly, or something like that. I want to make my structure out of emerald blocks and completely hollow, so my command will look like this:


/fill 100 100 100 50 50 50 emerald_block hollow

Now, we can move on to our last command, the clone command. This allows us to clone any object in the game. Just like the fill command, we need to get the two corners of the object. My object's two corners are at:


(1st block) 64 32 12 (2nd block) 32 12 43

Then, we need to get the location we want to clone the structure. My command looked like this:


/clone 64 32 12 32 12 43 100 50 100

The first three numbers are the first corner, the 2nd pair of the numbers is the second corner, and the last set of three numbers is the location I want to clone the object to.


We have learned all our commands now. One thing I want to mention is that when using commands like fill, make sure not to create extremely large areas. This can lag the server and other players around you. Now, I want to move on to the three types of command blocks.

The three types of command blocks are Default (yellow), Repeat (purple), and Chain (green). Default is what you get whenever you place down a command block. You can change the type by clicking on the button on the left of the command block menu. When you set it to repeat, the block changes color to purple, and any command you run in it will repeat 20 times a second, as long as it is powered by a redstone signal. This is extremely dangerous as you can crash a server in seconds if you run a command like /summon zombie. Be sure not to do that. One thing before we move on to the last is that if you click on 'Needs Redstone in the Command Block menu, it will set it to "Always Active". This means that you don't need to use a redstone signal on your command blocks!

Thankfully, the last type of Command Block, Chain, is pretty advanced. It is not required for learning Java Basics, but if you want to know how to utilize it check out my Java Coding Class at Java Coding Class | WEquil School.


For now, though, congratulations! You have read all the material you need to be able to start helping build at WequilCraft.

Please contact me (Benny) on slack and I will give you access. I might also test you a little bit :)


~ Benny

47 views
bottom of page