Search in sources :

Example 1 with InventoryMapper

use of mods.railcraft.common.util.inventory.wrappers.InventoryMapper in project Railcraft by Railcraft.

the class TileBoilerFireboxSolid method placeSolidBoiler.

public static void placeSolidBoiler(World world, BlockPos pos, int width, int height, boolean highPressure, int water, List<ItemStack> fuel) {
    for (MultiBlockPattern pattern : TileBoiler.patterns) {
        if (pattern.getPatternHeight() - 3 == height && pattern.getPatternWidthX() - 2 == width) {
            Map<Character, IBlockState> blockMapping = new HashMap<Character, IBlockState>();
            blockMapping.put('F', EnumMachineBeta.BOILER_FIREBOX_SOLID.getDefaultState());
            blockMapping.put('H', highPressure ? EnumMachineBeta.BOILER_TANK_HIGH_PRESSURE.getDefaultState() : EnumMachineBeta.BOILER_TANK_LOW_PRESSURE.getDefaultState());
            TileEntity tile = pattern.placeStructure(world, pos, blockMapping);
            if (tile instanceof TileBoilerFireboxSolid) {
                TileBoilerFireboxSolid master = (TileBoilerFireboxSolid) tile;
                master.tankWater.setFluid(Fluids.WATER.get(water));
                InventoryMapper masterFuel = InventoryMapper.make(master.inventory, SLOT_BURN, 4);
                for (ItemStack stack : fuel) {
                    InvTools.moveItemStack(stack, masterFuel);
                }
            }
            return;
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) IBlockState(net.minecraft.block.state.IBlockState) HashMap(java.util.HashMap) InventoryMapper(mods.railcraft.common.util.inventory.wrappers.InventoryMapper) MultiBlockPattern(mods.railcraft.common.blocks.machine.MultiBlockPattern) ItemStack(net.minecraft.item.ItemStack)

Aggregations

HashMap (java.util.HashMap)1 MultiBlockPattern (mods.railcraft.common.blocks.machine.MultiBlockPattern)1 InventoryMapper (mods.railcraft.common.util.inventory.wrappers.InventoryMapper)1 IBlockState (net.minecraft.block.state.IBlockState)1 ItemStack (net.minecraft.item.ItemStack)1 TileEntity (net.minecraft.tileentity.TileEntity)1