Search in sources :

Example 1 with BuilderItemMetaPair

use of buildcraft.core.builders.BuilderItemMetaPair in project BuildCraft by BuildCraft.

the class BuildingSlotMapIterator method refresh.

public void refresh(TileAbstractBuilder builder) {
    if (!isCreative) {
        availablePairs.clear();
        availablePairs.add(new BuilderItemMetaPair(null));
        if (builder != null) {
            for (int i = 0; i < builder.getSizeInventory(); i++) {
                ItemStack stack = builder.getStackInSlot(i);
                if (stack != null) {
                    availablePairs.add(new BuilderItemMetaPair(stack));
                }
            }
            for (Tank t : builder.getFluidTanks()) {
                if (t.getFluid() != null && t.getFluid().getFluid().getBlock() != null) {
                    availablePairs.add(new BuilderItemMetaPair(new ItemStack(t.getFluid().getFluid().getBlock())));
                }
            }
        }
    }
}
Also used : ItemStack(net.minecraft.item.ItemStack) Tank(buildcraft.lib.fluids.Tank) BuilderItemMetaPair(buildcraft.core.builders.BuilderItemMetaPair)

Example 2 with BuilderItemMetaPair

use of buildcraft.core.builders.BuilderItemMetaPair in project BuildCraft by BuildCraft.

the class BptBuilderBlueprint method addToBuildList.

private void addToBuildList(BuildingSlotBlock b) {
    if (b != null) {
        BuilderItemMetaPair imp = new BuilderItemMetaPair(context, b);
        if (!buildList.containsKey(imp)) {
            buildList.put(imp, new ArrayList<BuildingSlotBlock>());
        }
        buildList.get(imp).add(b);
        if (buildStageOccurences == null) {
            buildStageOccurences = new int[Math.max(3, b.buildStage + 1)];
        } else if (buildStageOccurences.length <= b.buildStage) {
            int[] newBSO = new int[b.buildStage + 1];
            System.arraycopy(buildStageOccurences, 0, newBSO, 0, buildStageOccurences.length);
            buildStageOccurences = newBSO;
        }
        buildStageOccurences[b.buildStage]++;
        if (b.mode == Mode.Build) {
            requirementMap.add(b, context);
            b.internalRequirementRemovalListener = requirementMap;
        }
    }
}
Also used : BuildingSlotBlock(buildcraft.core.builders.BuildingSlotBlock) BuilderItemMetaPair(buildcraft.core.builders.BuilderItemMetaPair)

Aggregations

BuilderItemMetaPair (buildcraft.core.builders.BuilderItemMetaPair)2 BuildingSlotBlock (buildcraft.core.builders.BuildingSlotBlock)1 Tank (buildcraft.lib.fluids.Tank)1 ItemStack (net.minecraft.item.ItemStack)1