for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
TileEntity entity = worldObj.getTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ);
if (entity instanceof TileInfusedGrain) {
//Exchange aspects
TileInfusedGrain tileInfusedGrain = (TileInfusedGrain) entity;
Aspect aspect = tileInfusedGrain.aspect;
if (aspect.isPrimal()) {
if (primalTendencies.getAmount(aspect) < 5) {
primalTendencies.add(aspect, 1);
reduceSaturatedAspects();
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
if (worldObj.isRemote) {
for (int i = 0; i < 50; i++) {
ThaumicTinkerer.tcProxy.essentiaTrailFx(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, xCoord, yCoord, zCoord, 50, aspect.getColor(), 1F);
}
}
return;
}
} else {
AspectList targetList = tileInfusedGrain.primalTendencies;
if (targetList.getAspects().length == 0 || targetList.getAspects()[0] == null) {
return;
}
aspect = targetList.getAspects()[worldObj.rand.nextInt(targetList.getAspects().length)];
if (targetList.getAmount(aspect) >= primalTendencies.getAmount(aspect)) {
primalTendencies.add(aspect, 1);
targetList.reduce(aspect, 1);
reduceSaturatedAspects();
if (worldObj.isRemote) {
for (int i = 0; i < 50; i++) {
ThaumicTinkerer.tcProxy.essentiaTrailFx(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, xCoord, yCoord, zCoord, 50, aspect.getColor(), 1F);
}
}
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}