Position is the new version of origin from CS1. This object and its values are generated when the player interacts with a block or when an event is called by the block itself. You can change values contained in position by using code such as this:
position.x++; //Moving x position in the positive direction by 1 block position.z-=2; //Moving z position in the negative direction by 2 blocks position.y=0; //changes the y position to 0 (bedrock level)
Examples[]
Creates an explosion at position with 4 strength value (TNT strength):
world.createExplosion(position, 4, false);
Harvest block at position:
world.harvestBlock(position);
Making fire:
origin.y++; world.setBlockId(position, 51);
Same example but without saving the increment to position
world.setBlockId(position.x, position.y+1, position.z, 51);
Custom Stuff 1
Information presented below this line is outdated syntax or information used for Custom Stuff 1. It will not work with Custom Stuff 2. |
Origin is a position value, used when player interact with block, or when event called by block itself. You can change the origin position by adding code like this:
origin.x++ //Moving x position of origin at 1 block origin.z-=2 //Moving z position of origin at 2 blocks backward origin.y=0 //Moving y position of origin to 0 (bedrock level)
Examples[]
Creating explosion at origin position with 4 strength value (TNT strength):
world.createExplosion(origin,4);
Harvest clicked block:
world.harvestBlock(origin);
Making flamethrower:
origin.y++; world.setBlockId(origin,51);