Skip to content

Instantly share code, notes, and snippets.

@MSourceCoded
Created December 8, 2014 08:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MSourceCoded/f62e320707befb6c0b16 to your computer and use it in GitHub Desktop.
Save MSourceCoded/f62e320707befb6c0b16 to your computer and use it in GitHub Desktop.
Spirolaterals in 3D
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int meta, float xo, float yo, float zo) {
if (!world.isRemote) {
Block targetBlock = world.getBlock(x, y-1, z);
int targetMeta = world.getBlockMetadata(x, y-1, z);
if (targetBlock == null || targetBlock == Blocks.air)
targetBlock = Blocks.iron_block;
int order = 89;
int lastCount = 1;
int sX = x + 1;
int sY = y + order;
int sZ = z + 1;
int cX = sX;
int cY = sY;
int cZ = sZ;
do {
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
if (lastCount == order + 1) lastCount = 1;
for (int i = 0; i < lastCount; i++) {
cX += dir.offsetX;
cY += dir.offsetY;
cZ += dir.offsetZ;
world.setBlock(cX, cY, cZ, targetBlock, targetMeta, 3);
}
lastCount++;
}
} while (cX != sX && cZ != sZ && cY != sY);
}
return !world.isRemote;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment