Created
January 29, 2015 17:29
-
-
Save downslope7/3668e7240b18e29715fb to your computer and use it in GitHub Desktop.
Runic Matrix Symmetry Determination - Thaumcraft 4.2.3.3
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
private void getSurroundings() { | |
ArrayList stuff = new ArrayList(); | |
this.pedestals.clear(); | |
try | |
{ | |
for (int xx = -12; xx <= 12; xx++) { | |
for (int zz = -12; zz <= 12; zz++) { | |
boolean skip = false; | |
for (int yy = -5; yy <= 10; yy++) { | |
if ((xx != 0) || (zz != 0)) { | |
int x = this.xCoord + xx; | |
int y = this.yCoord - yy; | |
int z = this.zCoord + zz; | |
TileEntity te = this.worldObj.getTileEntity(x, y, z); | |
if ((!skip) && (yy > 0) && (Math.abs(xx) <= 8) && (Math.abs(zz) <= 8) && (te != null) && ((te instanceof TilePedestal))) | |
{ | |
this.pedestals.add(new ChunkCoordinates(x, y, z)); | |
skip = true; | |
} else { | |
Block bi = this.worldObj.getBlock(x, y, z); | |
if ((bi == Blocks.skull) || (((bi instanceof IInfusionStabiliser)) && (((IInfusionStabiliser)bi).canStabaliseInfusion(getWorldObj(), x, y, z)))) | |
{ | |
stuff.add(new ChunkCoordinates(x, y, z)); | |
} | |
} | |
} | |
} | |
} | |
} | |
this.symmetry = 0; | |
for (ChunkCoordinates cc : this.pedestals) { | |
boolean items = false; | |
int x = this.xCoord - cc.posX; | |
int z = this.zCoord - cc.posZ; | |
TileEntity te = this.worldObj.getTileEntity(cc.posX, cc.posY, cc.posZ); | |
if ((te != null) && ((te instanceof TilePedestal))) { | |
this.symmetry += 2; | |
if (((TilePedestal)te).getStackInSlot(0) != null) { | |
this.symmetry += 1; | |
items = true; | |
} | |
} | |
int xx = this.xCoord + x; | |
int zz = this.zCoord + z; | |
te = this.worldObj.getTileEntity(xx, cc.posY, zz); | |
if ((te != null) && ((te instanceof TilePedestal))) { | |
this.symmetry -= 2; | |
if ((((TilePedestal)te).getStackInSlot(0) != null) && (items)) { | |
this.symmetry -= 1; | |
} | |
} | |
} | |
float sym = 0.0F; | |
for (ChunkCoordinates cc : stuff) { | |
boolean items = false; | |
int x = this.xCoord - cc.posX; | |
int z = this.zCoord - cc.posZ; | |
Block bi = this.worldObj.getBlock(cc.posX, cc.posY, cc.posZ); | |
if ((bi == Blocks.skull) || (((bi instanceof IInfusionStabiliser)) && (((IInfusionStabiliser)bi).canStabaliseInfusion(getWorldObj(), cc.posX, cc.posY, cc.posZ)))) | |
{ | |
sym += 0.1F; | |
} | |
int xx = this.xCoord + x; | |
int zz = this.zCoord + z; | |
bi = this.worldObj.getBlock(xx, cc.posY, zz); | |
if ((bi == Blocks.skull) || (((bi instanceof IInfusionStabiliser)) && (((IInfusionStabiliser)bi).canStabaliseInfusion(getWorldObj(), cc.posX, cc.posY, cc.posZ)))) | |
{ | |
sym -= 0.2F; | |
} | |
} | |
this.symmetry = ((int)(this.symmetry + sym)); | |
} | |
catch (Exception e) | |
{ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment