Jump to content
  • Sign Up

Archived

This topic is now archived and is closed to further replies.

Venk

(Revisioned) Empy's Guide for Adding Custom Blocks

Recommended Posts

* Please note that I did not create this guide, I just thought that since not a whole lot of people check the archived forums, this would be a better place for it. The original guide was created by Empy and can be found here. Full credit goes to them. *

Quote

 

It has come to my attention that ever since BlockDefinitions has been added as a server feature for MCGalaxy (and ProCraft, which I will not cover in this guide), very few people have known about the feature, let alone know how to use it. This tutorial will hopefully teach you the fundamentals as I cover each and every step, as well as a few things to keep in mind when adding blocks to the server. I will also provide examples of the block creation process as I go along.

/globalblock (shortcut /gb), /levelblock (shortcut /lb)

These two commands are the base commands used when you want to add a block either globally, meaning every single map on your server created or not will share that one block, or locally, where it's on a per-map basis. Also, locally-defined blocks will overwrite global blocks. Be sure you keep in mind if you create blocks locally. I recommend creating local blocks starting at ID 254, that way any blocks you later decide to add globally won't accidentally disappear from your locally-defined blocks that you had defined before.

[+Command Parameters+]

/gb add [ID]

This begins the creation of a new block. Remember, the only valid IDs are between 1 and 254.

/gb abort

Use this command to quit the creation process at any point.

/gb copy [Copied ID] [New ID]

Use this to copy an existing defined block to another ID. Local blocks are already defined for you, so it should make copying and editing existing blocks easier.

/gb edit [ID]

Use this command to edit one of many properties of a defined block, such as shape, collision, etc. Use the command without an ID parameter to see the list of editable properties if you need any further help.

/gb info [ID]

View information about a specific defined block.

/gb list

This lists all the defined global blocks that have been created.

/gb remove [ID]

Remove an ID you added/edited.

/gb revert

If you need to go back a step because you realized you made a mistake, then use this command.

Take note that /lb works exactly the same as /gb, the only difference is whether the blocks created are usable on all maps or on a single (local) map. Alternatively, overseer (personal) maps use /os lb for local block creation.

==== In this example I will create a simple Wood slab, just to cover all the parameters. ====

/gb add 66

This means I have specified that the 66th ID, which is the first empty ID when no globals have been normally defined yet, will be the new block. This may be different from server to server as some blocks may have already been defined. In that case, skip to the next free ID.
/gb Wood slab

The next step is to give it a name. Here, I will call it "Wood slab", since naming it just "slab2" or something equivalent could be confusing. You can name it whatever you want, but it's best to use a name that doesn't exist yet.
/gb 0

I want a cuboid shape, so I use "0" in this case. For sprite blocks, you would use "1".
/gb 1

The texture ID I want to use is at ID 4, or the fifth texture at the top left of terrain.png, defaulted to wood planks. I recommend to try not to get confused between Texture IDs and Block IDs. Texture IDs go from left to right and top to bottom. To easily view the terrain atlas, press F10 while in-game to pull it up (this only works in later versions of the client, so if you haven't updated, then I highly recommend doing so).

In order to use a custom texture for your block, you will need to either create or edit an existing terrain.png file. You can find the default one inside of "default.zip" in the "texpacks" folder of your client. After you have your terrain ready, you can upload it to a filehosting website like imgur.com or dropbox.com and get the direct URL for it (This URL should end in a .png, if it does not, then it is not the correct URL). Once you have the URL copied, you can then use /texture level[zip] or /texture global[zip] command to apply it in your server. (or /os map texture[zip], if this is an overseer/realm.)

Each face can also have a unique texture mapped to it if desired. After the initial block creation process has been completed, you can further manipulate what your blocks appearance is, for example if I wanted a bookcase with 2 sides as planks. The command I would use would for further texture editing would be /... edit [block ID] toptex/bottomtex/fronttex/backtex/lefttex/righttex [texture ID] , where ... is how the block was created, either globally or locally.

/gb 1

As in the previous step, I do the same for all the side textures of my block...
/gb 1

...and for the bottom of my block, as well.
/gb 0 0 0

This is where it gets tricky. For almost all blocks you build with, your minimum coordinates will want to be at "0 0 0". The 1st number is the X coordinate (width), the 2nd number is the y coordinate (height), and the 3rd number is the z coordinate(depth). I will leave it as is.
/gb 16 8 16

My max coordinates are the upper part of my block shape. Creating a slab means halving the Y coordinate for example, or "16 8 16", So what I do is I simply half the y value.
If you chose a sprite as your block type, you won't have to worry about this.
/gb 2

I want the block to be collidable so I put the number to 2. The other numbers I can simply ignore.

if you choose 0, the block will be walk through, like an air block.

if you choose 1, said block is moreso climbable.
if you choose 3, you get a solid slippery block.
if you choose 4, it's the same as 3, but even more slippery.
if you choose 5, the block is close to a water-type block.
if you choose 6, it's is close to a lava-type block.
Normally, the third choice is the de-facto when it comes to general blocks.

/gb 1

This parameter defines the speed effect of the block while either walking on top of it or walking/swimming through it, so for example if you wanted a block that slows you to a crawl you would type in /gb 0.25, the lowest speed possible. Stone does not offer any speed benefits or hinderances normally, so I leave it at 1, or no change in speed.
/gb yes

Stone blocks light, so I set it to yes. The only time you don't want your blocks to block light is if it's a source of light itself, the block is vertically thinner such as a pillar or fence, the block is transparent or translucent (whether or not to block light with a translucent block is really up to you), or if you want some kind of "barrier" block to prevent players and entities from accessing certain areas without changing the environment too much.
/gb 1

Wood makes a woody sound when walked on or placed. It should be set to 1.
0=none 1=wood 2=gravel 3=grass 4=stone 5=metal 6=glass 7=cloth 8=sand 9=snow

/gb no

Wood is not a source of light, and I don't want a full-bright block at all, so I set it to no.
/gb 0

Most blocks will use "0", or opaque draw method. for things like glass, where you have texture and full transparency, use "1". "2" works like leaves, so that the back faces will not cull (disappear in layman's terms). For things like stained glass or ice, use "3" for translucent blocks. Blocks will neither draw any textures nor cull at "4". For this example I will choose 0.
/gb 0

Water has fog of 12, and lava is almost impossible to see through while submerged, so it is set at 255, the max value. The default is 0.
/gb 1

This parameter is for those who wish not to use a client with BlockDefinitions support, usually something like WoM, ChargedMiners, or ClassiCube's older client. A backup block will be shown to the client using an existing block ID numbered from 0-49 (0-65 with CPE support enabled). Since my block shape is more important, I will choose 44 (Stone Slab).
And really, that's it. Your block has been created and can now be used! Keep in mind that you can only edit blocks that have been defined, so if you want to redefine the original block's parameters then you have to completely define it all over again.

 

Additionally, I'd like to state that you do not have to do this for each custom block you create as it would take an excessively long time. I recommend making use of /gb copy [id] and /gb edit [id] [value] [args] as it is so much quicker and more efficient than following through with the creation process.

Share this post


Link to post

×
×
  • Create New...