Created
December 8, 2014 08:08
-
-
Save MSourceCoded/f62e320707befb6c0b16 to your computer and use it in GitHub Desktop.
Spirolaterals in 3D
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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