Search in sources :

Example 11 with BuildingSlotBlock

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

the class BptBuilderBlueprint method deploy.

public void deploy() {
    initialize();
    for (List<BuildingSlotBlock> lb : buildList.values()) {
        for (BuildingSlotBlock b : lb) {
            if (b.mode == Mode.ClearIfInvalid) {
                context.world.setBlockToAir(b.pos);
            } else if (!b.schematic.doNotBuild()) {
                b.stackConsumed = new LinkedList<>();
                try {
                    for (ItemStack stk : b.getRequirements(context)) {
                        if (stk != null) {
                            b.stackConsumed.add(stk.copy());
                        }
                    }
                } catch (Throwable t) {
                    // Defensive code against errors in implementers
                    t.printStackTrace();
                    BCLog.logger.throwing(t);
                }
                b.writeToWorld(context);
            }
        }
    }
    for (BuildingSlotEntity e : entityList) {
        e.stackConsumed = new LinkedList<>();
        try {
            for (ItemStack stk : e.getRequirements(context)) {
                if (stk != null) {
                    e.stackConsumed.add(stk.copy());
                }
            }
        } catch (Throwable t) {
            // Defensive code against errors in implementers
            t.printStackTrace();
            BCLog.logger.throwing(t);
        }
        e.writeToWorld(context);
    }
    for (List<BuildingSlotBlock> lb : buildList.values()) {
        for (BuildingSlotBlock b : lb) {
            if (b.mode != Mode.ClearIfInvalid) {
                b.postProcessing(context);
            }
        }
    }
    for (BuildingSlotEntity e : entityList) {
        e.postProcessing(context);
    }
}
Also used : BuildingSlotBlock(buildcraft.core.builders.BuildingSlotBlock) BuildingSlotEntity(buildcraft.core.builders.BuildingSlotEntity) ItemStack(net.minecraft.item.ItemStack) LinkedList(java.util.LinkedList)

Aggregations

BuildingSlotBlock (buildcraft.core.builders.BuildingSlotBlock)11 LinkedList (java.util.LinkedList)4 ItemStack (net.minecraft.item.ItemStack)4 BuildingSlotEntity (buildcraft.core.builders.BuildingSlotEntity)3 IInvSlot (buildcraft.api.core.IInvSlot)2 BlockPos (net.minecraft.util.math.BlockPos)2 SchematicBlock (buildcraft.api.blueprints.SchematicBlock)1 SchematicBlockBase (buildcraft.api.blueprints.SchematicBlockBase)1 SchematicEntity (buildcraft.api.blueprints.SchematicEntity)1 StackKey (buildcraft.api.core.StackKey)1 BuilderItemMetaPair (buildcraft.core.builders.BuilderItemMetaPair)1 BuildingSlotIterator (buildcraft.core.builders.BuildingSlotIterator)1 TileAbstractBuilder (buildcraft.core.builders.TileAbstractBuilder)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 ItemBlock (net.minecraft.item.ItemBlock)1 Fluid (net.minecraftforge.fluids.Fluid)1 FluidStack (net.minecraftforge.fluids.FluidStack)1