This Article is up to date with Custom Stuff 2 |
---|
With changes made to CS2, the old gravity attribute now became a block type of its own. Of course, this means no more cross texture blocks being gravity blocks or falling stairs. Fortunately though, this fixes the problems with blocks turning pure black like in CS1 while falling.
Example (CS2 0.9.10 and above)[]
mod.js
config.addBlockIdProperty("enderSandID", 2514); mod.addBlock("enderSand.js", "gravity");
blocks/enderSand.js
id = config.getBlockId("enderSandID"); name = "enderSand"; material = "sand"; stepSound = "sand"; creativeTab = "buildingBlocks"; //Normal gravity block displayName[0] = "Ender Gravel"; hasAntiGravity[0] = false; hardness[0] = 5; resistance[0] = 30; toolClass[0] = "shovel"; harvestLevel[0] = 1; textureFileXP[0] = "enderGravel.png"; textureFileXN[0] = "enderGravel.png"; textureFileYP[0] = "enderGravel.png"; textureFileYN[0] = "enderGravel.png"; textureFileZP[0] = "enderGravel.png"; textureFileZN[0] = "enderGravel.png"; addToCreative[0] = true; //Antigravity block displayName[1] = "Ender Sand"; hasAntiGravity[1] = true; hardness[1] = 5; resistance[1] = 30; toolClass[1] = "shovel"; harvestLevel[1] = 1; textureFileXP[1] = "enderSand.png"; textureFileXN[1] = "enderSand.png"; textureFileYP[1] = "enderSand.png"; textureFileYN[1] = "enderSand.png"; textureFileZP[1] = "enderSand.png"; textureFileZN[1] = "enderSand.png"; addToCreative[1] = true;
Gravity Block Attributes[]
Required Attributes |
Optional Attributes
|
textureFile and textureIndex
In CS2 versions for 1.4.7 and below, CS2 0.9.9 or below, textureFile was used to specify the texture sheet and textureIndex was used for identifying the specific icon within the texture sheet. If using CS2 0.9.9 or lower, make sure to use both of these attributes.
hasAntiGravity This is basically the same thing as the old gravity attribute from CS1, but can be set separately for each block id. The default is false, causing gravity blocks to fall downward. If changed to false, the block will fall upwards, disappearing into the sky if no block is above it.
Bugs[]
In 0.9.12d, gravity blocks will appear to suddenly jump about 3 blocks upward before they start to fall, regardless of if the block falls downward or upward.
Older Examples and Information for Custom Stuff 1.
The gravity option will let you make the block turn into an entity and fall onto the highest stable block. In example, gravel on a ceiling will fall to the stone below. Basically, it's just like sand and gravel in the vanilla game.
Example:[]
This is the basic code to give gravity:
gravity = "true";
To turn it off, use:
gravity = "false";
Lastly, to make it 'fall' upwards, use:
gravity = "reverse";