Difference between revisions of "Auto-Tiling"

From wiki
Jump to: navigation, search
(Initial commit.)
 
("lookFromOverride")
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
This page is not complete. This is only here in order to store "autoTileInfo" for now. Will be written later.
+
[[Category:Modding]]
 +
There are times where you would want a tile to change it's look depending on what other tiles are around it. It could be objects like roofing tiles or fences. And there are times where you want a tile to change the tiles around it, again like roofing and fences. Auto-Tiling will allow you to do the following;
  
 +
* Change the tile you are placing.
 +
* Change tiles up to 2 blocks away from the tile.
 +
* Block placing your tile unless certain conditions are met.
  
AutoTileInfo is always a list of blobs. These blobs contain information about what block to override or what block to look for in what place. Each blob in the list is constructed like so:
+
 
 +
= Tutorial: How to do Simple Stairs =
 +
 
 +
This tutorial focuses on the typical use of Auto-Tile, but it might be a bit advanced for starting modders. '''[[User:Toketsupuurin/AutoTileTutorial|Toketsupuurin's tutorial]]''' breaks things down into smaller chunks and covers some of the more unusual aspects of Auto-Tile.
 +
 
 +
Before starting this tutorial, be sure to look at [[Modding#Setting up for Mod Creation]]. There will be a reference file at the end of this tutorial which will have a completed version of the stairs.
 +
 
 +
To start this tutorial off, you will need 3 [[Tile|Tiles]]. These tiles should similar to the following;
 +
 
 +
[http://i.imgur.com/IZLGUm2.png Image containing 3 stair tiles.]
 +
 
 +
For the purposes of this tutorial, the stair on the left will be the "Outer" Stairs, the one on the right will be "Inner" stairs and the one in the middle will be known as "Straight.
 +
 
 +
The Outer and Inner stairs should have the following in their *.tile files.
 +
<pre>
 +
{
 +
  "__inherits" : "staxel/tileObject/base.config",
 +
  "code" : "mods.tutorial.MCStairs.inner",
 +
  "voxels" : "mods/[Folder Name]/InnerStair.qb",
 +
  "categories" : [ "stair" ],
 +
  "representativeTile" : "mods.tutorial.MCStairs.straight"
 +
}
 +
</pre>
 +
Use Inner and Outer depending on which tile this is. Also be sure to change the folder name to the folder you store these tiles in. These tiles are now effectively done. What this does, is set these stairs up as normal Tile Objects. You really do not need to change much about these tiles. The one extra change however is "representativeTile". This will make it so you get the straight tile back instead of the corner pieces.
 +
 
 +
 
 +
The next step is to set up the Straight tile file;
 +
 
 +
<pre>
 +
{
 +
  "__inherits" : "staxel/tileObject/base.config",
 +
  "code" : "mods.tutorial.MCStairs.straight",
 +
  "voxels" : "mods/[Folder Name]/StraightStair.qb",
 +
  "categories" : [ "stair" ],
 +
  "autoTileInfo" : [
 +
 
 +
  ]
 +
}
 +
</pre>
 +
 
 +
This file is almost set up. The last property is however not complete, as this will be the focus of this tutorial. Feel free to skip to the end if you don't want to figure out what all of this means.
 +
 
 +
 
 +
First off lets think of how minecraft steps work. Or rather when they change from straight stairs. Here is a list of the ways they change;
 +
# If a stair is behind the stair you are placing, then you will place a corner piece. This corner piece is the Outer stair from before. There are two orientations to this.
 +
# If a stair is infront the stair you are placing, then you will place a corner piece. This corner piece is the Inner stair from before. There are two orientations to this.
 +
# If there is a stair to the left of the stair you are placing, it will turn into a corner piece if it doesn't line up. (Not Completed with this tutorial.)
 +
# If there is a stair to the right of the stair you are placing, it will turn into a corner piece if it doesn't line up. (Not Completed with this tutorial.)
 +
 
 +
Lets start adding in these interactions then. Lets start off with changing how the stair will react when being placed in front of another stair. The following should be added to the file;
 
<pre>
 
<pre>
 
"autoTileInfo" : [
 
"autoTileInfo" : [
 
   {
 
   {
     "lookFromOverride" : "",
+
     "directionsToLookIn" : [
    "DirectionsToLookIn" : [
+
 
       {
 
       {
         "direction" : "",
+
         "direction" : "back",
         "secondDirection" : "",
+
         "tilesToLookFor" : [ "mods.tutorial.MCStairs.straight", "mods.tutorial.MCStairs.outer", "mods.tutorial.MCStairs.inner"],
        "tilesToLookFor" : [],
+
         "rotationToLookFor" : 1
        "tileCategoriesToLookFor" : [],
+
         "rotationToLookFor": 0
+
 
       }
 
       }
 
     ],
 
     ],
 
     "results" : [
 
     "results" : [
 
       {
 
       {
         "tileToPlace" : "",
+
         "tileToPlace" : "mods.tutorial.MCStairs.inner",
        "direction" : "",
+
         "rotation" : 0
        "secondDirection" : "",
+
         "rotation" : ""
+
 
       }
 
       }
     ],
+
     ]
     "onTileRemoval" : false
+
  }
 +
]
 +
</pre>
 +
 
 +
This should set the stair up to do the following;
 +
 
 +
[http://i.imgur.com/YU4StqT.png An image of the stair in front of the three different stairs.]
 +
 
 +
That is, it will turn the tile into a specific model if the stair behind it is facing right. Feel free to build these files and test out how it works in game. If it does not look like the image, then your stairs are probably not in the correct rotations. You'll need to rotate the tiles, as the rest of this tutorial will assume this section works. There will be a reference file at the end of this tutorial that will have all of the stairs in their correct rotations. Do note that it will only work on one direction and not both directions at this point in time.
 +
 
 +
Now what this section does should be self explanatory if you look at it. We search the tile behind the one we are looking at by setting "direction" to "back". We then look for one of the three stairs we made, and make sure it is in a set rotation. If this is the case, then we want to place inner down instead of straight and make it a very specific rotation. And that is it.
 +
 
 +
 
 +
Now we make it for when the tile behind the stair is facing left instead of right.
 +
"autoTileInfo" : [
 +
  {
 +
     //Behind stair facing right.
 +
  },
 +
    {
 +
      "directionsToLookIn" : [
 +
        {
 +
          "direction" : "back",
 +
          "tilesToLookFor" : [ "mods.tutorial.MCStairs.straight"],
 +
          "rotationToLookFor" : 3
 +
        }
 +
      ],
 +
      "results" : [
 +
        {
 +
          "tileToPlace" : "mods.tutorial.MCStairs.inner",
 +
          "rotation" : 3
 +
        }
 +
      ]
 +
    },
 +
    {
 +
      "directionsToLookIn" : [
 +
        {
 +
          "direction" : "back",
 +
          "tilesToLookFor" : [ "mods.tutorial.MCStairs.inner"],
 +
          "rotationToLookFor" : 2
 +
        }
 +
      ],
 +
      "results" : [
 +
        {
 +
          "tileToPlace" : "mods.tutorial.MCStairs.inner",
 +
          "rotation" : 3
 +
        }
 +
      ]
 +
    },
 +
    {
 +
      "directionsToLookIn" : [
 +
        {
 +
          "direction" : "back",
 +
          "tilesToLookFor" : [ "mods.tutorial.MCStairs.outer"],
 +
          "rotationToLookFor" : 0
 +
        }
 +
      ],
 +
      "results" : [
 +
        {
 +
          "tileToPlace" : "mods.tutorial.MCStairs.inner",
 +
          "rotation" : 3
 +
        }
 +
      ]
 +
    }
 +
]
 +
 
 +
Now this is long, but it is needed. This is long due to the fact that different tiles will rotate slightly differently to each other. But these should be self explanatory, especially when considering the above section.
 +
 
 +
 
 +
With that done, we can implement the other direction. If you want to do this yourself, feel free to do so. Otherwise here is a completed file;
 +
<pre>
 +
{
 +
  "__inherits" : "staxel/tileObject/base.config",
 +
  "code" : "mods.tutorial.MCStairs.straight",
 +
  "voxels" : "mods/Minecraft Stairs/StairDark1.qb",
 +
  "categories" : [ "dark", "clean", "coloured", "brown", "stair" ],
 +
  "autoTileInfo" : [
 +
    {
 +
      "directionsToLookIn" : [
 +
        {
 +
          "direction" : "back",
 +
          "tilesToLookFor" : [ "mods.tutorial.MCStairs.straight", "mods.tutorial.MCStairs.outer", "mods.tutorial.MCStairs.inner"],
 +
          "rotationToLookFor" : 1
 +
        }
 +
      ],
 +
      "results" : [
 +
        {
 +
          "tileToPlace" : "mods.tutorial.MCStairs.inner",
 +
          "rotation" : 0
 +
        }
 +
      ]
 +
    },
 +
    {
 +
      "directionsToLookIn" : [
 +
        {
 +
          "direction" : "back",
 +
          "tilesToLookFor" : [ "mods.tutorial.MCStairs.straight"],
 +
          "rotationToLookFor" : 3
 +
        }
 +
      ],
 +
      "results" : [
 +
        {
 +
          "tileToPlace" : "mods.tutorial.MCStairs.inner",
 +
          "rotation" : 3
 +
        }
 +
      ]
 +
    },
 +
    {
 +
      "directionsToLookIn" : [
 +
        {
 +
          "direction" : "back",
 +
          "tilesToLookFor" : [ "mods.tutorial.MCStairs.inner"],
 +
          "rotationToLookFor" : 2
 +
        }
 +
      ],
 +
      "results" : [
 +
        {
 +
          "tileToPlace" : "mods.tutorial.MCStairs.inner",
 +
          "rotation" : 3
 +
        }
 +
      ]
 +
    },
 +
    {
 +
      "directionsToLookIn" : [
 +
        {
 +
          "direction" : "back",
 +
          "tilesToLookFor" : [ "mods.tutorial.MCStairs.outer"],
 +
          "rotationToLookFor" : 0
 +
        }
 +
      ],
 +
      "results" : [
 +
        {
 +
          "tileToPlace" : "mods.tutorial.MCStairs.inner",
 +
          "rotation" : 3
 +
        }
 +
      ]
 +
    },
 +
    {
 +
      "directionsToLookIn" : [
 +
        {
 +
          "direction" : "front",
 +
          "tilesToLookFor" : [ "mods.tutorial.MCStairs.straight"],
 +
          "rotationToLookFor" : 1
 +
        }
 +
      ],
 +
      "results" : [
 +
        {
 +
          "tileToPlace" : "mods.tutorial.MCStairs.outer",
 +
          "rotation" : 1
 +
        }
 +
      ]
 +
    },
 +
    {
 +
      "directionsToLookIn" : [
 +
        {
 +
          "direction" : "front",
 +
          "tilesToLookFor" : [ "mods.tutorial.MCStairs.straight"],
 +
          "rotationToLookFor" : 3
 +
        }
 +
      ],
 +
      "results" : [
 +
        {
 +
          "tileToPlace" : "mods.tutorial.MCStairs.outer",
 +
          "rotation" : 0
 +
        }
 +
      ]
 +
    },
 +
    {
 +
      "directionsToLookIn" : [
 +
        {
 +
          "direction" : "front",
 +
          "tilesToLookFor" : [ "mods.tutorial.MCStairs.outer"],
 +
          "rotationToLookFor" : 2
 +
        }
 +
      ],
 +
      "results" : [
 +
        {
 +
          "tileToPlace" : "mods.tutorial.MCStairs.outer",
 +
          "rotation" : 1
 +
        }
 +
      ]
 +
    },
 +
    {
 +
      "directionsToLookIn" : [
 +
        {
 +
          "direction" : "front",
 +
          "tilesToLookFor" : [ "mods.tutorial.MCStairs.outer"],
 +
          "rotationToLookFor" : 3
 +
        }
 +
      ],
 +
      "results" : [
 +
        {
 +
          "tileToPlace" : "mods.tutorial.MCStairs.outer",
 +
          "rotation" : 0
 +
        }
 +
      ]
 +
    },
 +
    {
 +
      "directionsToLookIn" : [
 +
        {
 +
          "direction" : "front",
 +
          "tilesToLookFor" : [ "mods.tutorial.MCStairs.inner"],
 +
          "rotationToLookFor" : 0
 +
        }
 +
      ],
 +
      "results" : [
 +
        {
 +
          "tileToPlace" : "mods.tutorial.MCStairs.outer",
 +
          "rotation" : 1
 +
        }
 +
      ]
 +
    },
 +
    {
 +
      "directionsToLookIn" : [
 +
        {
 +
          "direction" : "front",
 +
          "tilesToLookFor" : [ "mods.tutorial.MCStairs.inner"],
 +
          "rotationToLookFor" : 3
 +
        }
 +
      ],
 +
      "results" : [
 +
        {
 +
          "tileToPlace" : "mods.tutorial.MCStairs.outer",
 +
          "rotation" : 0
 +
        }
 +
      ]
 +
    },
 +
  ]
 
}
 
}
 
</pre>
 
</pre>
  
 +
And with that, you have a set of minecraft stairs. If you want to try making these stairs affect the stairs nearby, use "direction" in "results". But otherwise, you are ready to go.
  
==== "Common Terms" ====
 
===== "direction" =====
 
'''Valid options (String): <code>up, down, front, back, left, right, none</code>'''
 
  
Forces the object to go look in this direction. So giving this up, makes the tile look one tile upwards.
+
[https://drive.google.com/open?id=0BxmnC4fDU4HyMnBGcE1uNndhUW8 Here is the example file that implemented this tutorial.]
  
 +
= Config Options =
 +
An important thing to note, is that Auto-tiling is not by it's own. It must be placed within a [[Tile]]. Auto-Tiling allows multiple different outcomes to occur, as such the following property should be read before continuing.
  
===== "secondDirection" =====
+
== "autoTileInfo" ==
'''Valid options (String): <code>up, down, front, back, left, right, none</code>'''
+
AutoTileInfo is the property which contains all the properties listed below. However this is being mentioned, due to a special condition.
  
Forces the object to go look in this direction after heading in "direction". So giving this up, makes the tile look one tile upwards. Therefore if both "direction" and "secondDirection" is up, then it will look for two tiles upwards.
+
AutoTileInfo is a [[Modding_Key_Terms#List|List]] of [[Modding_Key_Terms#Blob|Blobs]]. This means you can specify multiple different groups of autoTiling in the same tile. It will commonly look like;
 +
<pre>
 +
"autoTileInfo" : [
 +
  {
 +
    //Group 1
 +
  },
 +
  {
 +
    //Group 2
 +
  },
 +
  {
 +
    //Group 3
 +
  }
 +
]
 +
</pre>
  
 +
Another thing to note is that these groups are done in order, with higher groups going first. This can be taken advantage off and make simpler files, as later groups will override earlier results. Take a look at Rope Fence Corner to see this in action.
 +
 +
 +
== "directionsToLookIn" ==
 +
This is yet another list of [[Modding_Key_Terms#List|List]] of [[Modding_Key_Terms#Blob|Blobs]]. It will commonly look like the following;
 +
<pre>
 +
"DirectionsToLookIn" : [
 +
  {
 +
    "direction" : "",
 +
    "secondDirection" : "",
 +
    "tilesToLookFor" : [],
 +
    "tileCategoriesToLookFor" : [],
 +
    "rotationToLookFor": 0
 +
  },
 +
  {
 +
    //Direction 2
 +
  }
 +
],
 +
</pre>
 +
 +
=== "direction" ===
 +
'''Valid options ([[Modding_Key_Terms#String|String]]): <code>"right", "left", "front", "back", "up", "down", "none"</code>'''
 +
 +
'''Default Value:''' No default value is specified. Always need to provide your own.
 +
 +
This is the direction that it will check first. That is, if you say "right" it will check the tile to the right.
 +
 +
 +
=== "rotationToLookFor" ===
 +
'''Valid options ([[Modding_Key_Terms#Integer|Integer]]): <code>0,1,2 or 3</code>'''
 +
 +
'''Default Value:''' If not specified, will not care about rotation.
 +
 +
 +
If the tile that is searched, the one specified with [[#"direction"]] and [[#"secondDirection"]], has this specific rotation, then proceed to [[#"results"]]. Otherwise reject it.
 +
 +
 +
=== "secondDirection" ===
 +
'''Valid options ([[Modding_Key_Terms#String|String]]): <code>"right", "left", "front", "back", "up", "down", "none"</code>'''
 +
 +
'''Default Value:''' If not specified, will default to "none".
 +
 +
This is the direction that will check second. This will force the checked tile to be one further That is, if you say "right" for direction, then "right" for secondDirection it will check the tile, two tiles to the right.
 +
 +
 +
=== "tileCategoriesToLookFor" ===
 +
'''Valid options ([[Modding_Key_Terms#List|List]] of [[Modding_Key_Terms#String|String]]): <code>A list of any valid strings.</code>'''
 +
 +
'''Default Value:''' If not specified, will not look for categories. Should specify either "tileCategoriesToLookFor" or "tilesToLookFor".
 +
 +
 +
If the tile that is searched, the one specified with [[#"direction"]] and [[#"secondDirection"]], has any of these categories, then proceed to [[#"results"]]. (As long as it is not rejected.)
 +
 +
 +
=== "tileCategoriesToReject" ===
 +
'''Valid options ([[Modding_Key_Terms#List|List]] of [[Modding_Key_Terms#String|String]]): <code>A list of any valid strings.</code>'''
 +
 +
'''Default Value:''' If not specified, will not look for categories. Should specify either "tileCategoriesToLookFor" or "tilesToLookFor".
 +
 +
 +
If the tile that is searched, the one specified with [[#"direction"]] and [[#"secondDirection"]], has any of these categories, then reject going to [[#"results"]].
 +
 +
 +
=== "tilesToLookFor" ===
 +
'''Valid options ([[Modding_Key_Terms#List|List]] of [[Modding_Key_Terms#String|String]]): <code>A list of strings each containing the code to a [[Tile]].</code>'''
 +
 +
'''Default Value:''' If not specified, will not reject any tiles.
 +
 +
 +
If the tile that is searched, the one specified with [[#"direction"]] and [[#"secondDirection"]], has a code in this list, then proceed to [[#"results"]]. (As long as it is not rejected.)
 +
 +
 +
=== "tilesToReject" ===
 +
'''Valid options ([[Modding_Key_Terms#List|List]] of [[Modding_Key_Terms#String|String]]): <code>A list of strings each containing the code to a [[Tile]].</code>'''
 +
 +
'''Default Value:''' If not specified, will not reject any tiles.
 +
 +
 +
If the tile that is searched, the one specified with [[#"direction"]] and [[#"secondDirection"]], has a code in this list, then reject going to [[#"results"]].
 +
 +
 +
== "lookFromOverride" ==
 +
'''Valid options ([[Modding_Key_Terms#String|String]]): <code>"right", "left", "front", "back", "up", "down", "none"</code>'''
 +
 +
'''Default Value:''' No default value is specified. Always need to provide your own.
 +
 +
This lets you override the normal "direction" and "secondDirection" values under certain circumstances and limit a tile to only checking one direction.
 +
 +
== "results" ==
 +
This is yet another list of [[Modding_Key_Terms#List|List]] of [[Modding_Key_Terms#Blob|Blobs]]. It will commonly look like the following;
 +
<pre>
 +
"results" : [
 +
  {
 +
    "tileToPlace" : "",
 +
    "direction" : "",
 +
    "secondDirection" : "",
 +
    "rotation" : ""
 +
  },
 +
  {
 +
    //Group 2
 +
  }
 +
],
 +
</pre>
  
===== "lookFromOverride" =====
+
=== "alt" ===
'''Valid options (String): <code>up, down, front, back, left, right, none</code>'''
+
'''Valid options ([[Modding_Key_Terms#Integer|Integer]]): <code>0, 1, 2 or 3</code>'''
  
Sets the initial spot to be in the specified direction, rather than the tile itself.
+
'''Default Value:''' If not specified, will place in a random alt.
  
  
===== "onTileRemoval" =====
+
This will be the number of the alternative look (alt) that the tile will have.
'''Valid options (Bool): <code>Either true or false</code>'''
+
  
Updates the tiles on removing the tile?
 
  
 +
=== "tileToPlace" ===
 +
'''Valid options ([[Modding_Key_Terms#String|String]]): <code>A strings containing the code to a [[Tile]].</code>'''
  
==== "directionsToLookIn" ====
+
'''Default Value:''' If not specified, will place the the tile.
This is a list of directions that will be looked in to see if objects are in certain blocks first. Uses direction and secondDirection to navigate to the tile.
+
  
  
===== "tilesToLookFor" =====
+
This will be the tile that is placed in the place specified by [[#"direction"_2|#"direction"]] and [[#"secondDirection"_2|#"secondDirection"]].
'''Valid options (String): <code>Any valid code that points towards a tile or tileObject.</code>'''
+
  
This is a list of tiles it will look for. If it contains any of these then it will succeed and cause "results" to run.
 
  
 +
=== "direction" ===
 +
'''Valid options ([[Modding_Key_Terms#String|String]]): <code>"right", "left", "front", "back", "up", "down", "none"</code>'''
  
===== "tileCategoriesToLookFor" =====
+
'''Default Value:''' No default value is specified. Always need to provide your own.
'''Valid options (String): <code>Any valid string that points that is a category in tile or tileObject.</code>'''
+
  
This is a list of categories inside of the tile's categories that it will look for. If it contains any of these then it will succeed and cause "results" to run.
+
This is the direction that it will check first. That is, if you say "right" it will check the tile to the right.
  
  
===== "rotation" =====
+
=== "rotation" ===
'''Valid options (Int): <code>A number between 0-3 representing rotation</code>'''
+
'''Valid options ([[Modding_Key_Terms#Integer|Integer]]): <code>0, 1, 2 or 3</code>'''
  
If it finds the right tile, then it will then search for what direction it is in, if this is present. This is relative to the tile that is being placed. If this succeeds after it has found a tile, then results will run. If it fails, results won't run.
+
'''Default Value:''' If not specified, will place in a random rotation.
  
  
==== "results" ====
+
This will be the rotation that the tile is placed in.
This is a list of resulting objects that will be placed if it succeeds in looking for tiles. This uses direction and secondDirection in order to specify where the tile is placed.
+
  
===== "tileToPlace" =====
 
'''Valid options (String): <code>Any valid string that points that is a category in tile or tileObject.</code>'''
 
  
This points to the specific tile or tileObject to be placed when succeeding.
+
=== "secondDirection" ===
 +
'''Valid options ([[Modding_Key_Terms#String|String]]): <code>"right", "left", "front", "back", "up", "down", "none"</code>'''
  
===== "rotation" =====
+
'''Default Value:''' If not specified, will default to "none".
'''Valid options (Int): <code>A number between 0-3 representing rotation</code>'''
+
  
This is the rotation that the tile will be placed in. This is relative to the tile being placed.
+
This is the direction that will check second. This will force the checked tile to be one further That is, if you say "right" for direction, then "right" for secondDirection it will check the tile, two tiles to the right.

Latest revision as of 23:55, 13 January 2020

There are times where you would want a tile to change it's look depending on what other tiles are around it. It could be objects like roofing tiles or fences. And there are times where you want a tile to change the tiles around it, again like roofing and fences. Auto-Tiling will allow you to do the following;

  • Change the tile you are placing.
  • Change tiles up to 2 blocks away from the tile.
  • Block placing your tile unless certain conditions are met.


Tutorial: How to do Simple Stairs

This tutorial focuses on the typical use of Auto-Tile, but it might be a bit advanced for starting modders. Toketsupuurin's tutorial breaks things down into smaller chunks and covers some of the more unusual aspects of Auto-Tile.

Before starting this tutorial, be sure to look at Modding#Setting up for Mod Creation. There will be a reference file at the end of this tutorial which will have a completed version of the stairs.

To start this tutorial off, you will need 3 Tiles. These tiles should similar to the following;

Image containing 3 stair tiles.

For the purposes of this tutorial, the stair on the left will be the "Outer" Stairs, the one on the right will be "Inner" stairs and the one in the middle will be known as "Straight.

The Outer and Inner stairs should have the following in their *.tile files.

{
  "__inherits" : "staxel/tileObject/base.config",
  "code" : "mods.tutorial.MCStairs.inner",
  "voxels" : "mods/[Folder Name]/InnerStair.qb",
  "categories" : [ "stair" ],
  "representativeTile" : "mods.tutorial.MCStairs.straight"
}

Use Inner and Outer depending on which tile this is. Also be sure to change the folder name to the folder you store these tiles in. These tiles are now effectively done. What this does, is set these stairs up as normal Tile Objects. You really do not need to change much about these tiles. The one extra change however is "representativeTile". This will make it so you get the straight tile back instead of the corner pieces.


The next step is to set up the Straight tile file;

{
  "__inherits" : "staxel/tileObject/base.config",
  "code" : "mods.tutorial.MCStairs.straight",
  "voxels" : "mods/[Folder Name]/StraightStair.qb",
  "categories" : [ "stair" ],
  "autoTileInfo" : [

  ]
}

This file is almost set up. The last property is however not complete, as this will be the focus of this tutorial. Feel free to skip to the end if you don't want to figure out what all of this means.


First off lets think of how minecraft steps work. Or rather when they change from straight stairs. Here is a list of the ways they change;

  1. If a stair is behind the stair you are placing, then you will place a corner piece. This corner piece is the Outer stair from before. There are two orientations to this.
  2. If a stair is infront the stair you are placing, then you will place a corner piece. This corner piece is the Inner stair from before. There are two orientations to this.
  3. If there is a stair to the left of the stair you are placing, it will turn into a corner piece if it doesn't line up. (Not Completed with this tutorial.)
  4. If there is a stair to the right of the stair you are placing, it will turn into a corner piece if it doesn't line up. (Not Completed with this tutorial.)

Lets start adding in these interactions then. Lets start off with changing how the stair will react when being placed in front of another stair. The following should be added to the file;

"autoTileInfo" : [
  {
    "directionsToLookIn" : [
      {
        "direction" : "back",
        "tilesToLookFor" : [ "mods.tutorial.MCStairs.straight", "mods.tutorial.MCStairs.outer", "mods.tutorial.MCStairs.inner"],
        "rotationToLookFor" : 1
      }
    ],
    "results" : [
      {
        "tileToPlace" : "mods.tutorial.MCStairs.inner",
        "rotation" : 0
      }
    ]
  }
]

This should set the stair up to do the following;

An image of the stair in front of the three different stairs.

That is, it will turn the tile into a specific model if the stair behind it is facing right. Feel free to build these files and test out how it works in game. If it does not look like the image, then your stairs are probably not in the correct rotations. You'll need to rotate the tiles, as the rest of this tutorial will assume this section works. There will be a reference file at the end of this tutorial that will have all of the stairs in their correct rotations. Do note that it will only work on one direction and not both directions at this point in time.

Now what this section does should be self explanatory if you look at it. We search the tile behind the one we are looking at by setting "direction" to "back". We then look for one of the three stairs we made, and make sure it is in a set rotation. If this is the case, then we want to place inner down instead of straight and make it a very specific rotation. And that is it.


Now we make it for when the tile behind the stair is facing left instead of right. "autoTileInfo" : [

 {
   //Behind stair facing right.
 },
   {
     "directionsToLookIn" : [
       {
         "direction" : "back",
         "tilesToLookFor" : [ "mods.tutorial.MCStairs.straight"],
         "rotationToLookFor" : 3
       }
     ],
     "results" : [
       {
         "tileToPlace" : "mods.tutorial.MCStairs.inner",
         "rotation" : 3
       }
     ]
   },
   {
     "directionsToLookIn" : [
       {
         "direction" : "back",
         "tilesToLookFor" : [ "mods.tutorial.MCStairs.inner"],
         "rotationToLookFor" : 2
       }
     ],
     "results" : [
       {
         "tileToPlace" : "mods.tutorial.MCStairs.inner",
         "rotation" : 3
       }
     ]
   },
   {
     "directionsToLookIn" : [
       {
         "direction" : "back",
         "tilesToLookFor" : [ "mods.tutorial.MCStairs.outer"],
         "rotationToLookFor" : 0
       }
     ],
     "results" : [
       {
         "tileToPlace" : "mods.tutorial.MCStairs.inner",
         "rotation" : 3
       }
     ]
   }

]

Now this is long, but it is needed. This is long due to the fact that different tiles will rotate slightly differently to each other. But these should be self explanatory, especially when considering the above section.


With that done, we can implement the other direction. If you want to do this yourself, feel free to do so. Otherwise here is a completed file;

{
  "__inherits" : "staxel/tileObject/base.config",
  "code" : "mods.tutorial.MCStairs.straight",
  "voxels" : "mods/Minecraft Stairs/StairDark1.qb",
  "categories" : [ "dark", "clean", "coloured", "brown", "stair" ],
  "autoTileInfo" : [
    {
      "directionsToLookIn" : [
        {
          "direction" : "back",
          "tilesToLookFor" : [ "mods.tutorial.MCStairs.straight", "mods.tutorial.MCStairs.outer", "mods.tutorial.MCStairs.inner"],
          "rotationToLookFor" : 1
        }
      ],
      "results" : [
        {
          "tileToPlace" : "mods.tutorial.MCStairs.inner",
          "rotation" : 0
        }
      ]
    },
    {
      "directionsToLookIn" : [
        {
          "direction" : "back",
          "tilesToLookFor" : [ "mods.tutorial.MCStairs.straight"],
          "rotationToLookFor" : 3
        }
      ],
      "results" : [
        {
          "tileToPlace" : "mods.tutorial.MCStairs.inner",
          "rotation" : 3
        }
      ]
    },
    {
      "directionsToLookIn" : [
        {
          "direction" : "back",
          "tilesToLookFor" : [ "mods.tutorial.MCStairs.inner"],
          "rotationToLookFor" : 2
        }
      ],
      "results" : [
        {
          "tileToPlace" : "mods.tutorial.MCStairs.inner",
          "rotation" : 3
        }
      ]
    },
    {
      "directionsToLookIn" : [
        {
          "direction" : "back",
          "tilesToLookFor" : [ "mods.tutorial.MCStairs.outer"],
          "rotationToLookFor" : 0
        }
      ],
      "results" : [
        {
          "tileToPlace" : "mods.tutorial.MCStairs.inner",
          "rotation" : 3
        }
      ]
    },
    {
      "directionsToLookIn" : [
        {
          "direction" : "front",
          "tilesToLookFor" : [ "mods.tutorial.MCStairs.straight"],
          "rotationToLookFor" : 1
        }
      ],
      "results" : [
        {
          "tileToPlace" : "mods.tutorial.MCStairs.outer",
          "rotation" : 1
        }
      ]
    },
    {
      "directionsToLookIn" : [
        {
          "direction" : "front",
          "tilesToLookFor" : [ "mods.tutorial.MCStairs.straight"],
          "rotationToLookFor" : 3
        }
      ],
      "results" : [
        {
          "tileToPlace" : "mods.tutorial.MCStairs.outer",
          "rotation" : 0
        }
      ]
    },
    {
      "directionsToLookIn" : [
        {
          "direction" : "front",
          "tilesToLookFor" : [ "mods.tutorial.MCStairs.outer"],
          "rotationToLookFor" : 2
        }
      ],
      "results" : [
        {
          "tileToPlace" : "mods.tutorial.MCStairs.outer",
          "rotation" : 1
        }
      ]
    },
    {
      "directionsToLookIn" : [
        {
          "direction" : "front",
          "tilesToLookFor" : [ "mods.tutorial.MCStairs.outer"],
          "rotationToLookFor" : 3
        }
      ],
      "results" : [
        {
          "tileToPlace" : "mods.tutorial.MCStairs.outer",
          "rotation" : 0
        }
      ]
    },
    {
      "directionsToLookIn" : [
        {
          "direction" : "front",
          "tilesToLookFor" : [ "mods.tutorial.MCStairs.inner"],
          "rotationToLookFor" : 0
        }
      ],
      "results" : [
        {
          "tileToPlace" : "mods.tutorial.MCStairs.outer",
          "rotation" : 1
        }
      ]
    },
    {
      "directionsToLookIn" : [
        {
          "direction" : "front",
          "tilesToLookFor" : [ "mods.tutorial.MCStairs.inner"],
          "rotationToLookFor" : 3
        }
      ],
      "results" : [
        {
          "tileToPlace" : "mods.tutorial.MCStairs.outer",
          "rotation" : 0
        }
      ]
    },
  ]
}

And with that, you have a set of minecraft stairs. If you want to try making these stairs affect the stairs nearby, use "direction" in "results". But otherwise, you are ready to go.


Here is the example file that implemented this tutorial.

Config Options

An important thing to note, is that Auto-tiling is not by it's own. It must be placed within a Tile. Auto-Tiling allows multiple different outcomes to occur, as such the following property should be read before continuing.

"autoTileInfo"

AutoTileInfo is the property which contains all the properties listed below. However this is being mentioned, due to a special condition.

AutoTileInfo is a List of Blobs. This means you can specify multiple different groups of autoTiling in the same tile. It will commonly look like;

"autoTileInfo" : [
  {
    //Group 1
  },
  {
    //Group 2
  },
  {
    //Group 3
  }
]

Another thing to note is that these groups are done in order, with higher groups going first. This can be taken advantage off and make simpler files, as later groups will override earlier results. Take a look at Rope Fence Corner to see this in action.


"directionsToLookIn"

This is yet another list of List of Blobs. It will commonly look like the following;

"DirectionsToLookIn" : [
  {
    "direction" : "",
    "secondDirection" : "",
    "tilesToLookFor" : [],
    "tileCategoriesToLookFor" : [],
    "rotationToLookFor": 0
  },
  {
    //Direction 2
  }
],

"direction"

Valid options (String): "right", "left", "front", "back", "up", "down", "none"

Default Value: No default value is specified. Always need to provide your own.

This is the direction that it will check first. That is, if you say "right" it will check the tile to the right.


"rotationToLookFor"

Valid options (Integer): 0,1,2 or 3

Default Value: If not specified, will not care about rotation.


If the tile that is searched, the one specified with #"direction" and #"secondDirection", has this specific rotation, then proceed to #"results". Otherwise reject it.


"secondDirection"

Valid options (String): "right", "left", "front", "back", "up", "down", "none"

Default Value: If not specified, will default to "none".

This is the direction that will check second. This will force the checked tile to be one further That is, if you say "right" for direction, then "right" for secondDirection it will check the tile, two tiles to the right.


"tileCategoriesToLookFor"

Valid options (List of String): A list of any valid strings.

Default Value: If not specified, will not look for categories. Should specify either "tileCategoriesToLookFor" or "tilesToLookFor".


If the tile that is searched, the one specified with #"direction" and #"secondDirection", has any of these categories, then proceed to #"results". (As long as it is not rejected.)


"tileCategoriesToReject"

Valid options (List of String): A list of any valid strings.

Default Value: If not specified, will not look for categories. Should specify either "tileCategoriesToLookFor" or "tilesToLookFor".


If the tile that is searched, the one specified with #"direction" and #"secondDirection", has any of these categories, then reject going to #"results".


"tilesToLookFor"

Valid options (List of String): A list of strings each containing the code to a Tile.

Default Value: If not specified, will not reject any tiles.


If the tile that is searched, the one specified with #"direction" and #"secondDirection", has a code in this list, then proceed to #"results". (As long as it is not rejected.)


"tilesToReject"

Valid options (List of String): A list of strings each containing the code to a Tile.

Default Value: If not specified, will not reject any tiles.


If the tile that is searched, the one specified with #"direction" and #"secondDirection", has a code in this list, then reject going to #"results".


"lookFromOverride"

Valid options (String): "right", "left", "front", "back", "up", "down", "none"

Default Value: No default value is specified. Always need to provide your own.

This lets you override the normal "direction" and "secondDirection" values under certain circumstances and limit a tile to only checking one direction.

"results"

This is yet another list of List of Blobs. It will commonly look like the following;

"results" : [
  {
    "tileToPlace" : "",
    "direction" : "",
    "secondDirection" : "",
    "rotation" : ""
  },
  {
    //Group 2
  }
],

"alt"

Valid options (Integer): 0, 1, 2 or 3

Default Value: If not specified, will place in a random alt.


This will be the number of the alternative look (alt) that the tile will have.


"tileToPlace"

Valid options (String): A strings containing the code to a Tile.

Default Value: If not specified, will place the the tile.


This will be the tile that is placed in the place specified by #"direction" and #"secondDirection".


"direction"

Valid options (String): "right", "left", "front", "back", "up", "down", "none"

Default Value: No default value is specified. Always need to provide your own.

This is the direction that it will check first. That is, if you say "right" it will check the tile to the right.


"rotation"

Valid options (Integer): 0, 1, 2 or 3

Default Value: If not specified, will place in a random rotation.


This will be the rotation that the tile is placed in.


"secondDirection"

Valid options (String): "right", "left", "front", "back", "up", "down", "none"

Default Value: If not specified, will default to "none".

This is the direction that will check second. This will force the checked tile to be one further That is, if you say "right" for direction, then "right" for secondDirection it will check the tile, two tiles to the right.