FANDOM


2012-02-05 10.10.26

Cubes. More Cubes!

Before 2.0.0 update of Custom Stuff, exists function setblocks. This function fill specificed area. Now, you can create cuboid too, but with code in javascript. This example additional shows how to create "cloner" with area.

Introduction

Go to /config/customStuffFunctions, and create cuboid.script file. Next open this file (with notepad or other text editor).

Code

At the beginning, create 3 variablfes: x,y,z. This will be used for loop "for".

var x;
var y;
var z;


Now add code below, because without this block will be created in wrong positon.

origin.x-=Math.floor(3/2);
origin.z-=Math.floor(3/2);
origin.y-=Math.floor(3/2);


This is beginning of "for" loop:

for(x=0;x<3;x++)
{
for(z=0;z<3;z++)
{
for(y=0;y<3;y++)
{


And this is function executed for each block:

world.setBlockIdAndMetadata(origin,id,dmg);


End of script:

origin.y++;
}
origin.z++;
origin.y-=3;
}
origin.x++;
origin.z-=3;
}

Item "cloner"

Create file "cloner.item" in /config/customItems directory. Paste this code:

name = "Cloner";
id = 6567;
iconfile = "cloner.png";
iconindex = 0;
maxstack = 1;
type="normal";
efficiencyblocks="none";
maxuses=8;
rightclick="player.damageItem(player.getCurrentSlot(), 1); id=world.getBlockId(origin); dmg=world.getBlockDamage(origin); customstuff.loadScript('cuboid.script');";

What can I do too?

  • If you want to use this script for more items, you can replace all numbers with variables. Don't forget add these variables to Items, this is example:
var x;
var y;
var z;
origin.x-=Math.floor(w*hotx);
origin.z-=Math.floor(d*hotz);
origin.y-=Math.floor(h*hoty);
for(x=0;x<w;x++)
{
for(z=0;z<d;z++)
{
for(y=0;y<h;y++)
{
world.setBlockIdAndMetadata(origin,id,dmg);
origin.y++;
}
origin.z++;
origin.y-=h;
}
origin.x++;
origin.z-=d;
}
2012-02-05 10.13.05

Cube apocalipse

Item:
name = "Cloner";
id = 6567;
iconfile = "cloner.png";
iconindex = 0;
maxstack = 1;
type="normal";
efficiencyblocks="none";
maxuses=8;
rightclick="player.damageItem(player.getCurrentSlot(), 1); h=5; d=5; w=5; id=5; dmg=0; hotx=0.5; hoty=0; hotz=0.5; id=world.getBlockId(origin); dmg=world.getBlockDamage(origin); customstuff.loadScript('cuboid.script');";

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.