Search in sources :

Example 6 with BlueprintBlock

use of minechem.item.blueprint.BlueprintBlock in project Minechem by iopleke.

the class BlueprintProjectorGui method drawBlueprintInfo.

private void drawBlueprintInfo(ItemStack blueprintStack) {
    MinechemBlueprint blueprint = MinechemItemsRegistration.blueprint.getBlueprint(blueprintStack);
    if (blueprint == null) {
        return;
    }
    String name = blueprintStack.getDisplayName().replace("Blueprint", "");
    this.fontRendererObj.drawStringWithShadow(name, 64, 12, 0xFFFFFF);
    HashMap<Integer, Integer> blockCount = getBlockCount(blueprint);
    HashMap<Integer, BlueprintBlock> blockLookup = blueprint.getBlockLookup();
    int y = 23;
    Iterator<Entry<Integer, Integer>> it = blockCount.entrySet().iterator();
    while (it.hasNext()) {
        Map.Entry<Integer, Integer> entry = it.next();
        BlueprintBlock block = blockLookup.get(entry.getKey());
        if (block != null) {
            ItemStack itemstack = new ItemStack(block.block, 1, block.metadata);
            String info = String.format("%dx%s", entry.getValue(), itemstack.getDisplayName());
            this.fontRendererObj.drawString(info, 64, y, 0xDDDDDD);
            y += 10;
        }
    }
}
Also used : BlueprintBlock(minechem.item.blueprint.BlueprintBlock) Entry(java.util.Map.Entry) MinechemBlueprint(minechem.item.blueprint.MinechemBlueprint) ItemStack(net.minecraft.item.ItemStack) HashMap(java.util.HashMap) Map(java.util.Map) MinechemBlueprint(minechem.item.blueprint.MinechemBlueprint)

Example 7 with BlueprintBlock

use of minechem.item.blueprint.BlueprintBlock in project Minechem by iopleke.

the class MultiBlockTileEntity method checkBlock.

private MultiBlockStatusEnum checkBlock(int x, int y, int z) {
    if (x == blueprint.getManagerPosX() && y == blueprint.getManagerPosY() && z == blueprint.getManagerPosZ()) {
        return MultiBlockStatusEnum.CORRECT;
    }
    int worldX = xCoord + (offsetX + x);
    int worldY = yCoord + (offsetY + y);
    int worldZ = zCoord + (offsetZ + z);
    Integer structureID = structure[y][x][z];
    Block block = worldObj.getBlock(worldX, worldY, worldZ);
    if (structureID == MinechemBlueprint.wildcard) {
        return MultiBlockStatusEnum.CORRECT;
    } else if (structureID == air) {
        if (block == Blocks.air) {
            return MultiBlockStatusEnum.CORRECT;
        } else {
            return MultiBlockStatusEnum.INCORRECT;
        }
    } else {
        HashMap<Integer, BlueprintBlock> lut = blueprint.getBlockLookup();
        BlueprintBlock blueprintBlock = lut.get(structureID);
        if (block == blueprintBlock.block && worldObj.getBlockMetadata(worldX, worldY, worldZ) == blueprintBlock.metadata) {
            return MultiBlockStatusEnum.CORRECT;
        } else {
            return MultiBlockStatusEnum.INCORRECT;
        }
    }
}
Also used : BlueprintBlock(minechem.item.blueprint.BlueprintBlock) HashMap(java.util.HashMap) Block(net.minecraft.block.Block) BlueprintBlock(minechem.item.blueprint.BlueprintBlock) MinechemBlueprint(minechem.item.blueprint.MinechemBlueprint)

Aggregations

BlueprintBlock (minechem.item.blueprint.BlueprintBlock)7 MinechemBlueprint (minechem.item.blueprint.MinechemBlueprint)5 HashMap (java.util.HashMap)3 FusionTileEntity (minechem.tileentity.multiblock.fusion.FusionTileEntity)3 Pos3 (minechem.utils.LocalPosition.Pos3)3 TileEntity (net.minecraft.tileentity.TileEntity)3 MultiBlockTileEntity (minechem.tileentity.multiblock.MultiBlockTileEntity)2 GhostBlockTileEntity (minechem.tileentity.multiblock.ghostblock.GhostBlockTileEntity)2 MinechemTileEntity (minechem.tileentity.prefab.MinechemTileEntity)2 TileEntityProxy (minechem.tileentity.prefab.TileEntityProxy)2 Block (net.minecraft.block.Block)2 Map (java.util.Map)1 Entry (java.util.Map.Entry)1 ItemStack (net.minecraft.item.ItemStack)1