use of minechem.item.blueprint.BlueprintBlock in project Minechem by iopleke.
the class BlueprintProjectorTileEntity method buildManagerBlock.
private TileEntity buildManagerBlock(LocalPosition position) {
BlueprintBlock managerBlock = blueprint.getManagerBlock();
if (managerBlock != null) {
Pos3 worldPos = position.getLocalPos(blueprint.getManagerPosX(), blueprint.getManagerPosY(), blueprint.getManagerPosZ());
worldObj.setBlock(worldPos.x, worldPos.y, worldPos.z, managerBlock.block, managerBlock.metadata, 3);
if (this.blueprint == MinechemBlueprint.fusion && worldObj.getTileEntity(worldPos.x, worldPos.y, worldPos.z) == null) {
FusionTileEntity fusion = new FusionTileEntity();
fusion.setWorldObj(this.worldObj);
fusion.xCoord = worldPos.x;
fusion.yCoord = worldPos.y;
fusion.zCoord = worldPos.z;
fusion.blockType = MinechemBlocksGeneration.fusion;
worldObj.addTileEntity(fusion);
}
return worldObj.getTileEntity(worldPos.x, worldPos.y, worldPos.z);
} else {
return null;
}
}
use of minechem.item.blueprint.BlueprintBlock in project Minechem by iopleke.
the class BlueprintProjectorTileEntity method buildStructure.
private void buildStructure(LocalPosition position) {
Integer[][][] resultStructure = blueprint.getResultStructure();
HashMap<Integer, BlueprintBlock> blockLookup = blueprint.getBlockLookup();
TileEntity managerTileEntity = buildManagerBlock(position);
for (int x = 0; x < blueprint.xSize; x++) {
for (int y = 0; y < blueprint.ySize; y++) {
for (int z = 0; z < blueprint.zSize; z++) {
if (isManagerBlock(x, y, z)) {
continue;
}
int structureId = resultStructure[y][x][z];
setBlock(x, y, z, position, structureId, blockLookup, managerTileEntity);
}
}
}
}
use of minechem.item.blueprint.BlueprintBlock in project Minechem by iopleke.
the class BlueprintProjectorTileEntity method setBlock.
private void setBlock(int x, int y, int z, LocalPosition position, int structureId, HashMap<Integer, BlueprintBlock> blockLookup, TileEntity managerTileEntity) {
Pos3 worldPos = position.getLocalPos(x, y, z);
if (structureId == MinechemBlueprint.wildcard) {
return;
}
if (structureId == air) {
worldObj.setBlockToAir(worldPos.x, worldPos.y, worldPos.z);
} else {
BlueprintBlock blueprintBlock = blockLookup.get(structureId);
if (blueprintBlock.type == Type.MANAGER) {
return;
}
worldObj.setBlock(worldPos.x, worldPos.y, worldPos.z, blueprintBlock.block, blueprintBlock.metadata, 3);
if (blueprintBlock.type == Type.PROXY) {
TileEntity te = worldObj.getTileEntity(worldPos.x, worldPos.y, worldPos.z);
if (te instanceof TileEntityProxy) {
TileEntityProxy proxy = (TileEntityProxy) te;
}
}
}
}
use of minechem.item.blueprint.BlueprintBlock in project Minechem by iopleke.
the class BlueprintProjectorTileEntity method projectGhostBlock.
private MultiBlockStatusEnum projectGhostBlock(int x, int y, int z, LocalPosition position) {
Pos3 worldPos = position.getLocalPos(x, y, z);
Integer structureID = structure[y][x][z];
Block block = worldObj.getBlock(worldPos.x, worldPos.y, worldPos.z);
int blockMetadata = worldObj.getBlockMetadata(worldPos.x, worldPos.y, worldPos.z);
if (structureID == MinechemBlueprint.wildcard) {
return MultiBlockStatusEnum.CORRECT;
} else if (structureID == air) {
if (block.isAir(worldObj, x, y, z)) {
return MultiBlockStatusEnum.CORRECT;
} else {
return MultiBlockStatusEnum.INCORRECT;
}
} else {
HashMap<Integer, BlueprintBlock> lut = blueprint.getBlockLookup();
BlueprintBlock blueprintBlock = lut.get(structureID);
if (block.isAir(worldObj, x, y, z)) {
createGhostBlock(worldPos.x, worldPos.y, worldPos.z, structureID);
return MultiBlockStatusEnum.INCORRECT;
} else if (block == blueprintBlock.block && (blockMetadata == blueprintBlock.metadata || blueprintBlock.metadata == -1)) {
return MultiBlockStatusEnum.CORRECT;
} else {
return MultiBlockStatusEnum.INCORRECT;
}
}
}
use of minechem.item.blueprint.BlueprintBlock in project Minechem by iopleke.
the class MultiBlockTileEntity method linkProxy.
private void linkProxy(int x, int y, int z) {
int worldX = xCoord + offsetX + x;
int worldY = yCoord + offsetY + y;
int worldZ = zCoord + offsetZ + z;
HashMap<Integer, BlueprintBlock> lut = blueprint.getBlockLookup();
TileEntity tileEntity = worldObj.getTileEntity(worldX, worldY, worldZ);
if (tileEntity != null && tileEntity instanceof TileEntityProxy) {
((TileEntityProxy) tileEntity).setManager(this);
}
}
Aggregations