Skip to content

Scripting

Tschipp edited this page Oct 1, 2017 · 42 revisions

Scripting is an advanced method that can be used for many different things.
You could for example make a script that renders all small entities on your shoulders instead of in your hands,
or you could have custom pickup conditions like XP levels, achievements and even positioning in the world.

The scripts are simple json files, that can have any name and must be placed in the config/carryon-scripts folder.

Contents

Pickup Object

The pickup object refers to which objects this script are affected by. The object can either be of type block or entity.

Block

Blocks can be specified using name for the blockname, meta for meta value, nbt for any NBT Tags. NBT structure works like vanilla's default nbt structure.
Blocks can also have a material type, which can be used to specify a block material. Valid material names here.
Blocks can also be matched based on resistance, meaning explosion resistance and hardness, meaning break time.

Entity

Entites also have a name type, which is used to specifiy the name. The height and weight types can be used to specify dimensions of the entity. They can, like blocks, be matched on nbt. They can also be matched based on health.

Examples

This probably sounds very strange, so let's explain with some examples.

{
	"object": 
	{
		"block":
		{
			"name" : "minecraft:gold_block"		
		}
	}
}

This script runs for Minecraft's Gold Block.

{
	"object": 
	{
		"block":
		{
			"hardness" : ">=1"		
		}
	}
}

This script runs for any block with a hardness value that's greater than or equal to 1 These types can be combined in any way.

{
	"object": 
	{
		"block":
		{
			"hardness" : ">=1",
			"material" : "rock",
			"meta" : "<=11",
			"nbt" : 
			{
				"SomeString" : "foo",
				"SomeInt" : 2
			}
		}
	}
}

This script runs for any block with a hardness that's greater than or equal to 1, has the material "rock" (like stone, bricks..), has a meta value that's below or equal to 11, and has an NBT tag with two tags, one called "SomeString" and one called "SomeInt". So as you can see, they can get very specific.

{
	"object": 
	{
		"entity":
		{
			"width" : "<=1",
			"height" : "<1.2",
			"health" : ">=20",
			"nbt" : 
			{
				"SomeString" : "foo",
				"SomeInt" : 2
			}
		}
	}
}

Likewise, for entities.

Clone this wiki locally